Messages in this thread Patch in this message | | | Date | Thu, 2 Oct 2008 22:24:38 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH] Give kjournald a IOPRIO_CLASS_RT io priority |
| |
On Thu, 2 Oct 2008 22:00:40 -0700 Arjan van de Ven <arjan@infradead.org> wrote:
> > Of course, fixing this running-vs-committing contention point would > > fix a lot more things than just atime updates. > > yes clearly. It's waaay above my paygrade to hack on though; JBD is one > of those places in the kernel that scare me for doing fundamental > changes ;-(
If someone has an hour or so to kill, we can pretend to fix it:
fs/ext3/super.c | 12 +++++++++++- fs/jbd/transaction.c | 13 +++++++++++-- include/linux/ext3_fs.h | 1 + include/linux/jbd.h | 1 + 4 files changed, 24 insertions(+), 3 deletions(-)
diff -puN fs/ext3/super.c~a fs/ext3/super.c --- a/fs/ext3/super.c~a +++ a/fs/ext3/super.c @@ -617,6 +617,8 @@ static int ext3_show_options(struct seq_ seq_puts(seq, ",barrier=1"); if (test_opt(sb, NOBH)) seq_puts(seq, ",nobh"); + if (test_opt(sb, AKPM)) + seq_puts(seq, ",akpm"); if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) seq_puts(seq, ",data=journal"); @@ -757,7 +759,7 @@ enum { Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota, Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota, - Opt_grpquota + Opt_grpquota, Opt_akpm, }; static match_table_t tokens = { @@ -808,6 +810,7 @@ static match_table_t tokens = { {Opt_usrquota, "usrquota"}, {Opt_barrier, "barrier=%u"}, {Opt_resize, "resize"}, + {Opt_akpm, "akpm"}, {Opt_err, NULL}, }; @@ -1097,6 +1100,9 @@ set_qf_format: set_opt(sbi->s_mount_opt, QUOTA); set_opt(sbi->s_mount_opt, GRPQUOTA); break; + case Opt_akpm: + set_opt(sbi->s_mount_opt, AKPM); + break; case Opt_noquota: if (sb_any_quota_enabled(sb) || sb_any_quota_suspended(sb)) { @@ -1986,6 +1992,10 @@ static void ext3_init_journal_params(str journal->j_flags |= JFS_BARRIER; else journal->j_flags &= ~JFS_BARRIER; + if (test_opt(sb, AKPM)) + journal->j_flags |= JFS_AKPM; + else + journal->j_flags &= ~JFS_AKPM; spin_unlock(&journal->j_state_lock); } diff -puN include/linux/ext3_fs.h~a include/linux/ext3_fs.h --- a/include/linux/ext3_fs.h~a +++ a/include/linux/ext3_fs.h @@ -380,6 +380,7 @@ struct ext3_inode { #define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ #define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ +#define EXT3_MOUNT_AKPM 0x400000 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ #ifndef _LINUX_EXT2_FS_H diff -puN include/linux/jbd.h~a include/linux/jbd.h --- a/include/linux/jbd.h~a +++ a/include/linux/jbd.h @@ -816,6 +816,7 @@ struct journal_s #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ #define JFS_BARRIER 0x020 /* Use IDE barriers */ +#define JFS_AKPM 0x040 /* * Function declarations for the journaling transaction and buffer diff -puN fs/jbd/transaction.c~a fs/jbd/transaction.c --- a/fs/jbd/transaction.c~a +++ a/fs/jbd/transaction.c @@ -537,6 +537,7 @@ do_get_write_access(handle_t *handle, st int error; char *frozen_buffer = NULL; int need_copy = 0; + int locked; if (is_handle_aborted(handle)) return -EROFS; @@ -552,7 +553,14 @@ repeat: /* @@@ Need to check for errors here at some point. */ - lock_buffer(bh); + locked = 0; + if (journal->j_flags & JFS_AKPM) { + if (trylock_buffer(bh)) + locked = 1; /* lolz */ + } else { + lock_buffer(bh); + locked = 1; + } jbd_lock_bh_state(bh); /* We now hold the buffer lock so it is safe to query the buffer @@ -591,7 +599,8 @@ repeat: jbd_unexpected_dirty_buffer(jh); } - unlock_buffer(bh); + if (locked) + unlock_buffer(bh); error = -EROFS; if (is_handle_aborted(handle)) { _
(might emit nasty warnings or assertion failures which will need to be disabled)
Mount a junk partition with `-oakpm' and run some benchmarks. If the results are "wow" then it's worth spending time on. If the results are "meh" then we can not bother..
| |