ext3 0.9.10 for Alan's tree
Subsystems (2)
Stephen, Andrew:
Alan has said recently that he would merge a newer ext3 soon as the maintainer sends him such a patch, but no sooner. That was in response to a few users asking why ext3 was "outdated" in his tree.
Attached is a patch against 2.4.10-ac3 of ext-0.9.9 + Ted's directory speedup. Bringing 0.9.10 inline with Alan will take some VM work, but this is a start.
I've been using it for some time, and I am sure you have proved it stable. Can it be passed on to him?
Thanks,
Signature · 3 lines
Robert M. Love rml at ufl.edu rml at tech9.net
fs/ext3/inode.c +184 -98
@@ -49,9 +49,9 @@* still needs to be revoked. */ -static void ext3_forget (handle_t *handle,int is_metadata, -struct inode *inode,struct buffer_head *bh, -int blocknr) +static int ext3_forget (handle_t *handle,int is_metadata, +struct inode *inode,struct buffer_head *bh, +int blocknr) {int err;
@@ -73,7 +73,7 @@BUFFER_TRACE (bh,"call journal_forget" );ext3_journal_forget (handle, bh); } -return ; +return 0 ; }/*
@@ -81,11 +81,11 @@*/ BUFFER_TRACE (bh,"call ext3_journal_revoke" ); err =ext3_journal_revoke (handle, blocknr, bh); -if (err == -ENOMEM ) +if (err)ext3_abort (inode->i_sb, __FUNCTION__, -"out of memory during revoke" ); -J_ASSERT (!err); +"error %d when attempting revoke" , err);BUFFER_TRACE (bh,"exit" ); +return err; }/*
@@ -102,11 +102,18 @@static handle_t *start_transaction (struct inode *inode) {long needed; +handle_t *result; + needed = inode->i_blocks;if (needed >EXT3_MAX_TRANS_DATA ) needed =EXT3_MAX_TRANS_DATA ; - -return ext3_journal_start (inode,EXT3_DATA_TRANS_BLOCKS + needed); + + result =ext3_journal_start (inode,EXT3_DATA_TRANS_BLOCKS + needed); +if (!IS_ERR (result)) +return result; + +ext3_std_error (inode->i_sb,PTR_ERR (result)); +return result; }/*
@@ -157,7 +164,7 @@void ext3_delete_inode (struct inode * inode) {handle_t *handle; - +if (is_bad_inode (inode) || inode->i_ino ==EXT3_ACL_IDX_INO || inode->i_ino ==EXT3_ACL_DATA_INO )
@@ -165,9 +172,21 @@lock_kernel (); handle =start_transaction (inode); -/* @@@ AKPM: how to report this? Mark as bad inode? */ -if (IS_ERR (handle)) - goto out; +if (IS_ERR (handle)) { +/* If we're going to skip the ext3_orphan_del, then at +* least we need to keep the orphan linked list in +* memory intact. */ +jbd_debug (4 ,"remove inode %ld from in-core orphan list\n" , + inode->i_ino); + +list_del (&inode->u.ext3_i.i_orphan); +INIT_LIST_HEAD (&inode->u.ext3_i.i_orphan); + +ext3_std_error (inode->i_sb,PTR_ERR (handle)); +unlock_kernel (); + goto no_delete; + } +if (IS_SYNC (inode)) handle->h_sync =1 ; inode->i_size =0 ;
@@ -183,10 +202,20 @@*/ ext3_orphan_del (handle, inode); inode->u.ext3_i.i_dtime =CURRENT_TIME ; -ext3_mark_inode_dirty (handle, inode); -ext3_free_inode (handle, inode); + +/* +* One subtle ordering requirement: if anything has gone wrong +* (transaction abort, IO errors, whatever), then we can still +* do these next steps (the fs will already have been marked as +* having errors), but we can't free the inode if the mark_dirty +* fails. +*/ +if (ext3_mark_inode_dirty (handle, inode)) +/* If that failed, just do the required in-core inode clear. */ +clear_inode (inode); +else +ext3_free_inode (handle, inode);ext3_journal_stop (handle, inode); -out:unlock_kernel ();return ; no_delete:
@@ -534,6 +563,7 @@* parent to disk. */ bh =getblk (inode->i_dev, parent, blocksize); + branch[n].bh = bh;lock_buffer (bh);BUFFER_TRACE (bh,"call get_create_access" ); err =ext3_journal_get_create_access (handle, bh);
@@ -544,7 +574,6 @@ }memset (bh->b_data,0 , blocksize); - branch[n].bh = bh; branch[n].p = (u32 *) bh->b_data + offsets[n]; *branch[n].p = branch[n].key;BUFFER_TRACE (bh,"marking uptodate" );
@@ -555,8 +584,11 @@ err =ext3_journal_dirty_metadata (handle, bh);if (err)break ; + parent = nr; } +if (IS_SYNC (inode)) + handle->h_sync =1 ; }if (n == num)return 0 ;
@@ -564,10 +596,9 @@/* Allocation failed, free what we already allocated */ for (i =1 ; i < keys; i++) {BUFFER_TRACE (branch[i].bh,"call journal_forget" ); -ext3_forget (handle,1 , inode, - branch[i].bh, branch[i].bh->b_blocknr); +ext3_journal_forget (handle, branch[i].bh); } -for (i =0 ; i < n; i++) +for (i =0 ; i < keys; i++)ext3_free_blocks (handle, inode,le32_to_cpu (branch[i].key),1 );return err; }
@@ -604,7 +635,7 @@BUFFER_TRACE (where->bh,"get_write_access" ); err =ext3_journal_get_write_access (handle, where->bh);if (err) -return err; + goto err_out; }/* Verify that place we are splicing to is still there and vacant */
@@ -645,6 +676,8 @@jbd_debug (5 ,"splicing indirect only\n" );BUFFER_TRACE (where->bh,"call ext3_journal_dirty_metadata" ); err =ext3_journal_dirty_metadata (handle, where->bh); +if (err) + goto err_out; }else {/* * OK, we spliced it into the inode itself on a direct block.
@@ -660,13 +693,21 @@* transaction then we explode nastily. Test this code path. */ jbd_debug (1 ,"the chain changed: try again\n" ); + err = -EAGAIN ; + +err_out:for (i =1 ; i < num; i++) {BUFFER_TRACE (where[i].bh,"call journal_forget" );ext3_journal_forget (handle, where[i].bh); } -for (i =0 ; i < num; i++) -ext3_free_blocks (handle, inode,le32_to_cpu (where[i].key),1 ); -return -EAGAIN ; +/* For the normal collision cleanup case, we free up the blocks. +* On genuine filesystem errors we don't even think about doing +* that. */ +if (err == -EAGAIN ) +for (i =0 ; i < num; i++) +ext3_free_blocks (handle, inode, +le32_to_cpu (where[i].key),1 ); +return err; }/*
@@ -693,7 +734,7 @@Indirect chain[4 ];Indirect *partial;unsigned long goal; -int left, res; +int left;int depth =ext3_block_to_path (inode, iblock, offsets);loff_t new_size;
@@ -751,20 +792,20 @@down_read (&inode->u.ext3_i.truncate_sem); err =ext3_alloc_branch (handle, inode, left, goal, offsets+(partial-chain), partial); -if (err) { -up_read (&inode->u.ext3_i.truncate_sem); - goto cleanup; - }/* The ext3_splice_branch call will free and forget any buffers * on the new chain if there is a failure, but that risks using * up transaction credits, especially for bitmaps where the * credits cannot be returned. Can we handle this somehow? We * may need to return -EAGAIN upwards in the worst case. --sct */ - res =ext3_splice_branch (handle, inode, iblock, chain, partial, left); +if (!err) + err =ext3_splice_branch (handle, inode, iblock, chain, + partial, left);up_read (&inode->u.ext3_i.truncate_sem); -if (res <0 ) +if (err == -EAGAIN ) goto changed; +if (err) + goto cleanup; new_size = inode->i_size;/*
@@ -972,6 +1013,13 @@* is elevated. We'll still have enough credits for the tiny quotafile * write. */ + +static int do_journal_get_write_access (handle_t *handle, +struct buffer_head *bh) +{ +return ext3_journal_get_write_access (handle, bh); +} +static int ext3_prepare_write (struct file *file,struct page *page,unsigned from,unsigned to) {
@@ -991,7 +1039,7 @@if (ext3_should_journal_data (inode)) ret =walk_page_buffers (handle, page, - from, to,NULL , ext3_journal_get_write_access); + from, to,NULL , do_journal_get_write_access); prepare_write_failed:if (ret)ext3_journal_stop (handle, inode);
@@ -1078,7 +1126,7 @@ } ret2 =ext3_journal_stop (handle, inode);unlock_kernel (); -if (ret ==0 ) +if (!ret) ret = ret2;return ret; }
@@ -1475,7 +1523,9 @@ }else { *top = *p->p;/* Nope, don't do this in ext3. Must leave the tree intact */ -// *p->p = 0; +#if 0 + *p->p =0 ; +#endif }/* Writer: end */
@@ -1575,10 +1625,15 @@unsigned long nr;/* Current block # */ u32 *p;/* Pointer into inode/ind for current block */ +int err;if (this_bh) {/* For indirect block */ BUFFER_TRACE (this_bh,"get_write_access" ); -ext3_journal_get_write_access (handle, this_bh); + err =ext3_journal_get_write_access (handle, this_bh); +/* Important: if we can't update the indirect pointers +* to the blocks, we can't free them. */ +if (err) +return ; }for (p = first; p < last; p++) {
@@ -1632,6 +1687,9 @@unsigned long nr;u32 *p; +if (is_handle_aborted (handle)) +return ; +if (depth--) {struct buffer_head *bh;int addr_per_block =EXT3_ADDR_PER_BLOCK (inode->i_sb);
@@ -1662,6 +1720,27 @@ depth);/* +* We've probably journalled the indirect block several +* times during the truncate. But it's no longer +* needed and we now drop it from the transaction via +* journal_revoke(). +* +* That's easy if it's exclusively part of this +* transaction. But if it's part of the committing +* transaction then journal_forget() will simply +* brelse() it. That means that if the underlying +* block is reallocated in ext3_get_block(), +* unmap_underlying_metadata() will find this block +* and will try to get rid of it. damn, damn. +* +* If this block has already been committed to the +* journal, a revoke record will be written. And +* revoke records must be emitted *before* clearing +* this block's bit in the bitmaps. +*/ +ext3_forget (handle,1 , inode, bh, bh->b_blocknr); + +/* * Everything below this this pointer has been * released. Now let this top-of-subtree go. *
@@ -1677,31 +1756,13 @@* will merely complain about releasing a free block, * rather than leaking blocks. */ +if (is_handle_aborted (handle)) +return ;if (try_to_extend_transaction (handle, inode)) {ext3_mark_inode_dirty (handle, inode);ext3_journal_test_restart (handle, inode); } -/* -* We've probably journalled the indirect block several -* times during the truncate. But it's no longer -* needed and we now drop it from the transaction via -* journal_revoke(). -* -* That's easy if it's exclusively part of this -* transaction. But if it's part of the committing -* transaction then journal_forget() will simply -* brelse() it. That means that if the underlying -* block is reallocated in ext3_get_block(), -* unmap_underlying_metadata() will find this block -* and will try to get rid of it. damn, damn. -* -* If this block has already been committed to the -* journal, a revoke record will be written. And -* revoke records must be emitted *before* clearing -* this block's bit in the bitmaps. -*/ -ext3_forget (handle,1 , inode, bh, bh->b_blocknr);#ifndef EXT3_NEW_QUOTAS /* Release the child block now */ inode->i_blocks -= inode->i_sb->s_blocksize /512 ;
@@ -1714,11 +1775,14 @@* pointed to by an indirect block: journal it */ BUFFER_TRACE (parent_bh,"get_write_access" ); -ext3_journal_get_write_access (handle,parent_bh); - *p =0 ; -BUFFER_TRACE (parent_bh, +if (!ext3_journal_get_write_access (handle, + parent_bh)){ + *p =0 ; +BUFFER_TRACE (parent_bh,"call ext3_journal_dirty_metadata" ); -ext3_journal_dirty_metadata (handle, parent_bh); +ext3_journal_dirty_metadata (handle, + parent_bh); + } } } }else {
@@ -1794,15 +1858,6 @@ goto out_stop;/* error */ /* -* The orphan list entry will now protect us from any crash which -* occurs before the truncate completes, so it is now safe to propagate -* the new, shorter inode size (held for now in i_size) into the -* on-disk inode. We do this via i_disksize, which is the value which -* ext3 *really* writes onto the disk inode. -*/ - inode->u.ext3_i.i_disksize = inode->i_size; - -/* * OK. This truncate is going to happen. We add the inode to the * orphan list, so that if this truncate spans multiple transactions, * and we crash, we will resume the truncate when the filesystem
@@ -1811,7 +1866,17 @@* Implication: the file must always be in a sane, consistent * truncatable state while each transaction commits. */ -ext3_orphan_add (handle, inode); +if (ext3_orphan_add (handle, inode)) + goto out_stop; + +/* +* The orphan list entry will now protect us from any crash which +* occurs before the truncate completes, so it is now safe to propagate +* the new, shorter inode size (held for now in i_size) into the +* on-disk inode. We do this via i_disksize, which is the value which +* ext3 *really* writes onto the disk inode. +*/ + inode->u.ext3_i.i_disksize = inode->i_size;/* * From here we block out all ext3_get_block() callers who want to
@@ -2000,18 +2065,17 @@* the test is that same one that e2fsck uses * NeilBrown 1999oct15 */ -/* -* akpm: during orphan recovery, non-zero i_dtime is expected, -* and is not an error. -*/ if (inode->i_nlink ==0 ) {if (inode->i_mode ==0 || - (inode->u.ext3_i.i_dtime && - !(inode->i_sb->u.ext3_sb.s_mount_state &EXT3_ORPHAN_FS ))){ + !(inode->i_sb->u.ext3_sb.s_mount_state &EXT3_ORPHAN_FS )) {/* this inode is deleted */ brelse (bh); goto bad_inode; } +/* The only unlinked inodes we let through here have +* valid i_mode and are being read by the orphan +* recovery code: that's fine, we're about to complete +* the process of deleting those. */ } inode->i_blksize =PAGE_SIZE ;/* This is the optimal IO size * (for stat), not the fs block
@@ -2104,11 +2168,13 @@ {struct ext3_inode *raw_inode = iloc->raw_inode;struct buffer_head *bh = iloc->bh; -int err =0 , block; +int err =0 , rc, block;if (handle) {BUFFER_TRACE (bh,"get_write_access" ); -ext3_journal_get_write_access (handle, bh); + err =ext3_journal_get_write_access (handle, bh); +if (err) + goto out_brelse; } raw_inode->i_mode =cpu_to_le16 (inode->i_mode);if (!(test_opt (inode->i_sb,NO_UID32 ))) {
@@ -2172,14 +2238,16 @@/* If this is the first large file * created, add a flag to the superblock. */ -/* @@@ error handling */ -ext3_journal_get_write_access (handle, + err =ext3_journal_get_write_access (handle, sb->u.ext3_sb.s_sbh); +if (err) + goto out_brelse;ext3_update_dynamic_rev (sb);EXT3_SET_RO_COMPAT_FEATURE (sb,EXT3_FEATURE_RO_COMPAT_LARGE_FILE ); sb->s_dirt =1 ; -ext3_journal_dirty_metadata (handle, + handle->h_sync =1 ; + err =ext3_journal_dirty_metadata (handle, sb->u.ext3_sb.s_sbh); } }
@@ -2192,9 +2260,14 @@ raw_inode->i_block[block] = inode->u.ext3_i.i_data[block];BUFFER_TRACE (bh,"call ext3_journal_dirty_metadata" ); -ext3_journal_dirty_metadata (handle, bh); + rc =ext3_journal_dirty_metadata (handle, bh); +if (!err) + err = rc; inode->u.ext3_i.i_state &= ~EXT3_STATE_NEW ; + +out_brelse:brelse (bh); +ext3_std_error (inode->i_sb, err);return err; }
@@ -2274,7 +2347,7 @@int ext3_setattr (struct dentry *dentry,struct iattr *attr) {struct inode *inode = dentry->d_inode; -int error; +int error, rc; error =inode_change_ok (inode, attr);if (error)
@@ -2284,17 +2357,22 @@handle_t *handle; handle =ext3_journal_start (inode,3 ); -if (IS_ERR (handle)) -return PTR_ERR (handle); -ext3_orphan_add (handle, inode); +if (IS_ERR (handle)) { + error =PTR_ERR (handle); + goto err_out; + } + + error =ext3_orphan_add (handle, inode); inode->u.ext3_i.i_disksize = attr->ia_size; -ext3_mark_inode_dirty (handle, inode); + rc =ext3_mark_inode_dirty (handle, inode); +if (!error) + error = rc;ext3_journal_stop (handle, inode); } - +inode_setattr (inode, attr); -if (IS_SYNC (inode)) -ext3_force_commit (inode->i_sb); +err_out: +ext3_std_error (inode->i_sb, error);return 0 ; }
@@ -2349,16 +2427,18 @@struct inode *inode, struct ext3_iloc *iloc) { + int err = 0; +if (handle) {/* the do_update_inode consumes one bh->b_count */ atomic_inc (&iloc->bh->b_count); -ext3_do_update_inode (handle, inode, iloc);/* @@@ ERROR */ + err =ext3_do_update_inode (handle, inode, iloc);/* ext3_do_update_inode() does journal_dirty_metadata */ brelse (iloc->bh); }else { printk(KERN_EMERG __FUNCTION__ ": called with no handle!\n"); } -return 0 ; +return err; }/*
@@ -2372,7 +2452,7 @@ {int err =0 ;if (handle) { - err =ext3_get_inode_loc (inode, iloc);/* @@@ ERROR */ + err =ext3_get_inode_loc (inode, iloc);if (!err) {BUFFER_TRACE (iloc->bh,"get_write_access" ); err =ext3_journal_get_write_access (handle, iloc->bh);
@@ -2382,8 +2462,7 @@ } } } -if (err) - printk(KERN_EMERG __FUNCTION__ ": failed\n"); +ext3_std_error (inode->i_sb, err);return err; }
@@ -2476,10 +2555,12 @@BUFFER_TRACE (iloc.bh,"get_write_access" ); err =journal_get_write_access (handle, iloc.bh);if (!err) -ext3_journal_dirty_metadata (handle, iloc.bh); + err =ext3_journal_dirty_metadata (handle, + iloc.bh); brelse(iloc.bh); } } +ext3_std_error (inode->i_sb, err);return err; }#endif
@@ -2488,6 +2569,7 @@ {journal_t *journal;handle_t *handle; +int err;/* * We have to be very careful here: changing a data block's
@@ -2500,6 +2582,9 @@*/ journal =EXT3_JOURNAL (inode); +if (is_journal_aborted (journal) ||IS_RDONLY (inode)) +return -EROFS ; +journal_lock_updates (journal);journal_flush (journal);
@@ -2524,11 +2609,12 @@if (IS_ERR (handle))return PTR_ERR (handle); -ext3_mark_inode_dirty (handle, inode); + err =ext3_mark_inode_dirty (handle, inode); handle->h_sync =1 ;ext3_journal_stop (handle, inode); - -return 0 ; +ext3_std_error (inode->i_sb, err); + +return err; }
fs/ext3/namei.c +164 -112
356 lines not on this page · raw message
fs/ext3/super.c +110 -64
449 lines not on this page · raw message
fs/jbd/checkpoint.c +2 -4
@@ -394,9 +394,6 @@if (journal->j_tail_sequence == first_tid)return 1 ; -if (journal->j_flags &JFS_ABORT ) -return -EROFS ; -/* OK, update the superblock to recover the freed space. * Physical blocks come first: have we wrapped beyond the end of * the log? */
@@ -412,7 +409,8 @@ journal->j_free += freed; journal->j_tail_sequence = first_tid; journal->j_tail = blocknr; -journal_update_superblock (journal,1 ); +if (!(journal->j_flags &JFS_ABORT )) +journal_update_superblock (journal,1 );return 0 ; }
fs/jbd/commit.c +17 -10
@@ -19,6 +19,7 @@#include <linux/errno.h> #include <linux/slab.h> #include <linux/locks.h> +#include <linux/smp_lock.h> extern spinlock_t journal_datalist_lock;
@@ -60,7 +61,7 @@* all outstanding updates to complete. */ -lock_journal (journal); +lock_journal (journal);/* Protect journal->j_running_transaction */ #ifdef COMMIT_STATS spin_lock (&journal_datalist_lock);
@@ -68,6 +69,8 @@spin_unlock (&journal_datalist_lock);#endif +lock_kernel (); +J_ASSERT (journal->j_running_transaction !=NULL );J_ASSERT (journal->j_committing_transaction ==NULL );
@@ -158,6 +161,8 @@ commit_transaction->t_log_start = journal->j_head; +unlock_kernel (); +jbd_debug (3 ,"JBD: commit phase 2\n" );/*
@@ -324,9 +329,15 @@/* If we're in abort mode, we just un-journal the buffer and release it for background writing. */ -if (is_journal_abort (journal)) { +if (is_journal_aborted (journal)) {JBUFFER_TRACE (jh,"journal is aborting: refile" );journal_refile_buffer (jh); +/* If that was the last one, we need to clean up +* any descriptor buffers which may have been +* already allocated, even if we are now +* aborting. */ +if (!commit_transaction->t_buffers) + goto start_journal_io;continue ; }
@@ -425,6 +436,7 @@ tag->t_flags |=htonl (JFS_FLAG_LAST_TAG ); +start_journal_io:unlock_journal (journal);for (i=0 ; i<bufs; i++) {struct buffer_head *bh = wbuf[i];
@@ -489,9 +501,8 @@ bh =jh2bh (jh);BUFFER_TRACE (bh,"dumping temporary bh" );journal_unlock_journal_head (jh); -journal_remove_journal_head (bh); -__brelse (bh);/* For journal_add_journal_head() */ -__brelse (bh);/* to zero */ +__brelse (bh); +J_ASSERT_BH (bh,atomic_read (&bh->b_count) ==0 );put_unused_buffer_head (bh);/* We also have to unlock and free the corresponding
@@ -537,9 +548,7 @@journal_unfile_buffer (jh); jh->b_transaction =NULL ;journal_unlock_journal_head (jh); -journal_remove_journal_head (bh);__brelse (bh);/* One for getblk */ -__brelse (bh);/* One for journal_add_journal_head */ /* AKPM: bforget here */ }
@@ -550,7 +559,7 @@* mode we can now just skip the rest of the journal write * entirely. */ -if (is_journal_abort (journal)) +if (is_journal_aborted (journal)) goto skip_commit; descriptor =journal_get_descriptor_buffer (journal);
@@ -572,8 +581,6 @@wait_on_buffer (bh);__brelse (bh);/* One for getblk() */ journal_unlock_journal_head (descriptor); -journal_remove_journal_head (bh); -__brelse (bh);/* One for journal_add_journal_head() */ }lock_journal (journal);
fs/jbd/journal.c +39 -8
100 lines not on this page · raw message
fs/jbd/revoke.c +54 -7
101 lines not on this page · raw message
fs/jbd/transaction.c +92 -19
286 lines not on this page · raw message
include/linux/ext3_fs.h +5 -4
@@ -36,8 +36,8 @@/* * The second extended file system version */ -#define EXT3FS_DATE "11 Aug 2001" -#define EXT3FS_VERSION "2.4-0.9.6" +#define EXT3FS_DATE "5 Sep 2001" +#define EXT3FS_VERSION "2.4-0.9.9"/* * Debug code
@@ -661,8 +661,8 @@/* namei.c */ extern struct inode_operations ext3_dir_inode_operations; -extern void ext3_orphan_add (handle_t *,struct inode *); -extern void ext3_orphan_del (handle_t *,struct inode *); +extern int ext3_orphan_add (handle_t *,struct inode *); +extern int ext3_orphan_del (handle_t *,struct inode *);/* super.c */ extern void ext3_error (struct super_block *,const char *,const char *, ...)
@@ -692,6 +692,7 @@if ((errno)) \__ext3_std_error ((sb), __FUNCTION__, (errno)); \ }while (0 ) +extern const char *ext3_decode_error(struct super_block *sb, int errno);/* * Inodes and files operations
include/linux/ext3_fs_i.h +1 -0
@@ -41,6 +41,7 @@__u32 i_prealloc_block;__u32 i_prealloc_count;#endif +__u32 i_dir_start_lookup;struct list_head i_orphan;/* unlinked but open inodes */
include/linux/ext3_jbd.h +86 -15
144 lines not on this page · raw message
include/linux/jbd.h +26 -2
@@ -33,6 +33,13 @@extern int journal_oom_retry;#ifdef CONFIG_JBD_DEBUG +/* +* Define JBD_EXPENSIVE_CHECKING to enable more expensive internal +* consistency checks. By default we don't do this unless +* CONFIG_JBD_DEBUG is on. +*/ +#define JBD_EXPENSIVE_CHECKING +extern int journal_enable_debug;extern int journal_no_write[2 ];
@@ -270,9 +277,14 @@/* Reference count on this handle */ int h_ref; +/* Field for caller's use to track errors through large fs +operations */ +int h_err; +/* Flags */ unsigned int h_sync: 1; /* sync-on-close */ unsigned int h_jdata: 1; /* force data journaling */ + unsigned int h_aborted: 1; /* fatal error on handle */ };
@@ -698,7 +710,7 @@*/ extern int log_space_left (journal_t *);/* Called with journal locked */ -extern void log_start_commit (journal_t *,transaction_t *); +extern tid_t log_start_commit (journal_t *,transaction_t *);extern void log_wait_commit (journal_t *,tid_t );extern int log_do_checkpoint (journal_t *,int );
@@ -728,11 +740,23 @@* transactions. */ -static inline int is_journal_abort (journal_t *journal) +static inline int is_journal_aborted (journal_t *journal) {return journal->j_flags &JFS_ABORT ; } +static inline int is_handle_aborted (handle_t *handle) +{ +if (handle->h_aborted) +return 1 ; +return is_journal_aborted (handle->h_transaction->t_journal); +} + +static inline void journal_abort_handle (handle_t *handle) +{ + handle->h_aborted =1 ; +} +/* Not all architectures define BUG() */ #ifndef BUG #define BUG () do { \
mm/filemap.c +17 -23
@@ -199,31 +199,28 @@spin_unlock (&pagecache_lock); } -static inline void truncate_partial_page (struct page *page,unsigned partial) +static int do_flushpage (struct page *page,unsigned long offset) {int (*flushpage) (struct page *,unsigned long ); - flushpage = page->mapping->a_ops->flushpage; -if (!flushpage) - flushpage = block_flushpage; - -memclear_highpage_flush (page, partial,PAGE_CACHE_SIZE -partial); -if (page->buffers) -flushpage (page, partial); +if (flushpage) +return (*flushpage)(page, offset); +return block_flushpage (page, offset); +} + +static inline void truncate_partial_page (struct page *page,unsigned partial) +{ +memclear_highpage_flush (page, partial,PAGE_CACHE_SIZE -partial); +if (page->buffers) +do_flushpage (page, partial); }static inline void truncate_complete_page (struct page *page) { -int (*flushpage) (struct page *,unsigned long ); - - flushpage = page->mapping->a_ops->flushpage; -if (!flushpage) - flushpage = block_flushpage; -/* Leave it on the LRU if it gets converted into anonymous buffers */ -if (!page->buffers ||flushpage (page,0 )) +if (!page->buffers ||do_flushpage (page,0 ))lru_cache_del (page); - +/* * We remove the page from the page cache _after_ we have * destroyed all buffer-cache references to it. Otherwise some
@@ -2637,6 +2634,7 @@while (count) {unsigned long index, offset; +long page_fault;char *kaddr;int deactivate =1 ;
@@ -2677,14 +2675,11 @@if (status) goto sync_failure; kaddr =page_address (page); - status =__copy_from_user (kaddr+offset, buf, bytes); + page_fault =__copy_from_user (kaddr+offset, buf, bytes);flush_dcache_page (page); -if (status) { -if (mapping->a_ops->abort_write) - mapping->a_ops->abort_write (file, page); - goto fail_write; - } status = mapping->a_ops->commit_write (file, page, offset, offset+bytes); +if (page_fault) + goto fail_write;if (!status) status = bytes;
@@ -2728,7 +2723,6 @@ fail_write: status = -EFAULT ;ClearPageUptodate (page); -kunmap (page); goto unlock; sync_failure:UnlockPage (page);
Quoted 6 lines · Robert Love
Stephen, Andrew:
Alan has said recently that he would merge a newer ext3 soon as the maintainer sends him such a patch, but no sooner. That was in response to a few users asking why ext3 was "outdated" in his tree.
Yes, sorry. It's turning out to be a lot of work keeping the master ext3 tree in sync with two (rather different) kernels, and running around after all the changes which are happening in (ahem) one of them.
We prefer to test a lot before releasing, and the one time I skipped that step was for 2.4.10, and it was the one which is broken. Sigh.
Quoted 3 lines
Attached is a patch against 2.4.10-ac3 of ext-0.9.9 + Ted's directory speedup. Bringing 0.9.10 inline with Alan will take some VM work, but this is a start.
Rob, I've added this patch to the download site for interested parties to use. http://www.uow.edu.au/~andrewm/linux/ext3/
But for a merge with Alan we do have a few more changes backed up, and some more testing must be done. I'll try to prepare 0.9.11 for -ac this week. I'm inclined to down-tools on Linus kernels for a while, wait for things to settle down there.
Thanks!
-
Quoted 3 lines · Andrew Morton
Yes, sorry. It's turning out to be a lot of work keeping the master ext3 tree in sync with two (rather different) kernels, and running around after all the changes which are happening in (ahem) one of them.
Don't explain that -- I know :) I think all of us are wanting a single-tree development kernel about now...
Quoted 5 lines
We prefer to test a lot before releasing, and the one time I skipped that step was for 2.4.10, and it was the one which is broken. Sigh.
Rob, I've added this patch to the download site for interested parties to use. http://www.uow.edu.au/~andrewm/linux/ext3/
Great.
Quoted 4 lines
But for a merge with Alan we do have a few more changes backed up, and some more testing must be done. I'll try to prepare 0.9.11 for -ac this week. I'm inclined to down-tools on Linus kernels for a while, wait for things to settle down there.
I'll be happy to test and do anything else I can. Thanks for the reply and all.
Quoted 1 line
Thanks!
You are welcome :)
Signature · 3 lines
Robert M. Love rml at ufl.edu rml at tech9.net