Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 May 2012 15:14:59 +0000 (08:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 May 2012 15:14:59 +0000 (08:14 -0700)
Pull ext2, ext3 and quota fixes from Jan Kara:
 "Interesting bits are:
   - removal of a special i_mutex locking subclass (I_MUTEX_QUOTA) since
     quota code does not need i_mutex anymore in any unusual way.
   - backport (from ext4) of a fix of a checkpointing bug (missing cache
     flush) that could lead to fs corruption on power failure

  The rest are just random small fixes & cleanups."

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  ext2: trivial fix to comment for ext2_free_blocks
  ext2: remove the redundant comment for ext2_export_ops
  ext3: return 32/64-bit dir name hash according to usage type
  quota: Get rid of nested I_MUTEX_QUOTA locking subclass
  quota: Use precomputed value of sb_dqopt in dquot_quota_sync
  ext2: Remove i_mutex use from ext2_quota_write()
  reiserfs: Remove i_mutex use from reiserfs_quota_write()
  ext4: Remove i_mutex use from ext4_quota_write()
  ext3: Remove i_mutex use from ext3_quota_write()
  quota: Fix double lock in add_dquot_ref() with CONFIG_QUOTA_DEBUG
  jbd: Write journal superblock with WRITE_FUA after checkpointing
  jbd: protect all log tail updates with j_checkpoint_mutex
  jbd: Split updating of journal superblock and marking journal empty
  ext2: do not register write_super within VFS
  ext2: Remove s_dirt handling
  ext2: write superblock only once on unmount
  ext3: update documentation with barrier=1 default
  ext3: remove max_debt in find_group_orlov()
  jbd: Refine commit writeout logic

19 files changed:
Documentation/filesystems/ext3.txt
fs/ext2/balloc.c
fs/ext2/ialloc.c
fs/ext2/super.c
fs/ext2/xattr.c
fs/ext3/dir.c
fs/ext3/ext3.h
fs/ext3/hash.c
fs/ext3/ialloc.c
fs/ext3/super.c
fs/ext4/super.c
fs/jbd/checkpoint.c
fs/jbd/commit.c
fs/jbd/journal.c
fs/jbd/transaction.c
fs/quota/dquot.c
fs/reiserfs/super.c
include/linux/jbd.h
include/trace/events/jbd.h

index b100adc..293855e 100644 (file)
@@ -59,9 +59,9 @@ commit=nrsec  (*)     Ext3 can be told to sync all its data and metadata
                        Setting it to very large values will improve
                        performance.
 
-barrier=<0(*)|1>       This enables/disables the use of write barriers in
-barrier                        the jbd code.  barrier=0 disables, barrier=1 enables.
-nobarrier      (*)     This also requires an IO stack which can support
+barrier=<0|1(*)>       This enables/disables the use of write barriers in
+barrier        (*)             the jbd code.  barrier=0 disables, barrier=1 enables.
+nobarrier              This also requires an IO stack which can support
                        barriers, and if jbd gets an error on a barrier
                        write, it will disable again with a warning.
                        Write barriers enforce proper on-disk ordering
index 030c6d2..1c36139 100644 (file)
@@ -165,7 +165,6 @@ static void release_blocks(struct super_block *sb, int count)
                struct ext2_sb_info *sbi = EXT2_SB(sb);
 
                percpu_counter_add(&sbi->s_freeblocks_counter, count);
-               sb->s_dirt = 1;
        }
 }
 
@@ -180,7 +179,6 @@ static void group_adjust_blocks(struct super_block *sb, int group_no,
                free_blocks = le16_to_cpu(desc->bg_free_blocks_count);
                desc->bg_free_blocks_count = cpu_to_le16(free_blocks + count);
                spin_unlock(sb_bgl_lock(sbi, group_no));
-               sb->s_dirt = 1;
                mark_buffer_dirty(bh);
        }
 }
@@ -479,7 +477,7 @@ void ext2_discard_reservation(struct inode *inode)
 }
 
 /**
- * ext2_free_blocks_sb() -- Free given blocks and update quota and i_blocks
+ * ext2_free_blocks() -- Free given blocks and update quota and i_blocks
  * @inode:             inode
  * @block:             start physcial block to free
  * @count:             number of blocks to free
index 8b15cf8..c13eb7b 100644 (file)
@@ -81,7 +81,6 @@ static void ext2_release_inode(struct super_block *sb, int group, int dir)
        spin_unlock(sb_bgl_lock(EXT2_SB(sb), group));
        if (dir)
                percpu_counter_dec(&EXT2_SB(sb)->s_dirs_counter);
-       sb->s_dirt = 1;
        mark_buffer_dirty(bh);
 }
 
@@ -543,7 +542,6 @@ got:
        }
        spin_unlock(sb_bgl_lock(sbi, group));
 
-       sb->s_dirt = 1;
        mark_buffer_dirty(bh2);
        if (test_opt(sb, GRPID)) {
                inode->i_mode = mode;
index 38f8160..b3621cb 100644 (file)
@@ -130,9 +130,6 @@ static void ext2_put_super (struct super_block * sb)
 
        dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
 
-       if (sb->s_dirt)
-               ext2_write_super(sb);
-
        ext2_xattr_put_super(sb);
        if (!(sb->s_flags & MS_RDONLY)) {
                struct ext2_super_block *es = sbi->s_es;
@@ -307,7 +304,6 @@ static const struct super_operations ext2_sops = {
        .write_inode    = ext2_write_inode,
        .evict_inode    = ext2_evict_inode,
        .put_super      = ext2_put_super,
-       .write_super    = ext2_write_super,
        .sync_fs        = ext2_sync_fs,
        .statfs         = ext2_statfs,
        .remount_fs     = ext2_remount,
@@ -358,11 +354,6 @@ static struct dentry *ext2_fh_to_parent(struct super_block *sb, struct fid *fid,
                                    ext2_nfs_get_inode);
 }
 
-/* Yes, most of these are left as NULL!!
- * A NULL value implies the default, which works with ext2-like file
- * systems, but can be improved upon.
- * Currently only get_parent is required.
- */
 static const struct export_operations ext2_export_ops = {
        .fh_to_dentry = ext2_fh_to_dentry,
        .fh_to_parent = ext2_fh_to_parent,
@@ -1176,7 +1167,6 @@ static void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es,
        mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
        if (wait)
                sync_dirty_buffer(EXT2_SB(sb)->s_sbh);
-       sb->s_dirt = 0;
 }
 
 /*
@@ -1209,8 +1199,6 @@ void ext2_write_super(struct super_block *sb)
 {
        if (!(sb->s_flags & MS_RDONLY))
                ext2_sync_fs(sb, 1);
-       else
-               sb->s_dirt = 0;
 }
 
 static int ext2_remount (struct super_block * sb, int * flags, char * data)
@@ -1456,7 +1444,6 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
        struct buffer_head tmp_bh;
        struct buffer_head *bh;
 
-       mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
        while (towrite > 0) {
                tocopy = sb->s_blocksize - offset < towrite ?
                                sb->s_blocksize - offset : towrite;
@@ -1486,16 +1473,13 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
                blk++;
        }
 out:
-       if (len == towrite) {
-               mutex_unlock(&inode->i_mutex);
+       if (len == towrite)
                return err;
-       }
        if (inode->i_size < off+len-towrite)
                i_size_write(inode, off+len-towrite);
        inode->i_version++;
        inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        mark_inode_dirty(inode);
-       mutex_unlock(&inode->i_mutex);
        return len - towrite;
 }
 
index 6dcafc7..b6754db 100644 (file)
@@ -339,7 +339,6 @@ static void ext2_xattr_update_super_block(struct super_block *sb)
        spin_lock(&EXT2_SB(sb)->s_lock);
        EXT2_SET_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR);
        spin_unlock(&EXT2_SB(sb)->s_lock);
-       sb->s_dirt = 1;
        mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
 }
 
index cc761ad..92490e9 100644 (file)
  *
  */
 
+#include <linux/compat.h>
 #include "ext3.h"
 
 static unsigned char ext3_filetype_table[] = {
        DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK
 };
 
-static int ext3_readdir(struct file *, void *, filldir_t);
 static int ext3_dx_readdir(struct file * filp,
                           void * dirent, filldir_t filldir);
-static int ext3_release_dir (struct inode * inode,
-                               struct file * filp);
-
-const struct file_operations ext3_dir_operations = {
-       .llseek         = generic_file_llseek,
-       .read           = generic_read_dir,
-       .readdir        = ext3_readdir,         /* we take BKL. needed?*/
-       .unlocked_ioctl = ext3_ioctl,
-#ifdef CONFIG_COMPAT
-       .compat_ioctl   = ext3_compat_ioctl,
-#endif
-       .fsync          = ext3_sync_file,       /* BKL held */
-       .release        = ext3_release_dir,
-};
-
 
 static unsigned char get_dtype(struct super_block *sb, int filetype)
 {
@@ -55,6 +40,25 @@ static unsigned char get_dtype(struct super_block *sb, int filetype)
        return (ext3_filetype_table[filetype]);
 }
 
+/**
+ * Check if the given dir-inode refers to an htree-indexed directory
+ * (or a directory which chould potentially get coverted to use htree
+ * indexing).
+ *
+ * Return 1 if it is a dx dir, 0 if not
+ */
+static int is_dx_dir(struct inode *inode)
+{
+       struct super_block *sb = inode->i_sb;
+
+       if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb,
+                    EXT3_FEATURE_COMPAT_DIR_INDEX) &&
+           ((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) ||
+            ((inode->i_size >> sb->s_blocksize_bits) == 1)))
+               return 1;
+
+       return 0;
+}
 
 int ext3_check_dir_entry (const char * function, struct inode * dir,
                          struct ext3_dir_entry_2 * de,
@@ -94,18 +98,13 @@ static int ext3_readdir(struct file * filp,
        unsigned long offset;
        int i, stored;
        struct ext3_dir_entry_2 *de;
-       struct super_block *sb;
        int err;
        struct inode *inode = filp->f_path.dentry->d_inode;
+       struct super_block *sb = inode->i_sb;
        int ret = 0;
        int dir_has_error = 0;
 
-       sb = inode->i_sb;
-
-       if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb,
-                                   EXT3_FEATURE_COMPAT_DIR_INDEX) &&
-           ((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) ||
-            ((inode->i_size >> sb->s_blocksize_bits) == 1))) {
+       if (is_dx_dir(inode)) {
                err = ext3_dx_readdir(filp, dirent, filldir);
                if (err != ERR_BAD_DX_DIR) {
                        ret = err;
@@ -227,22 +226,87 @@ out:
        return ret;
 }
 
+static inline int is_32bit_api(void)
+{
+#ifdef CONFIG_COMPAT
+       return is_compat_task();
+#else
+       return (BITS_PER_LONG == 32);
+#endif
+}
+
 /*
  * These functions convert from the major/minor hash to an f_pos
- * value.
+ * value for dx directories
  *
- * Currently we only use major hash numer.  This is unfortunate, but
- * on 32-bit machines, the same VFS interface is used for lseek and
- * llseek, so if we use the 64 bit offset, then the 32-bit versions of
- * lseek/telldir/seekdir will blow out spectacularly, and from within
- * the ext2 low-level routine, we don't know if we're being called by
- * a 64-bit version of the system call or the 32-bit version of the
- * system call.  Worse yet, NFSv2 only allows for a 32-bit readdir
- * cookie.  Sigh.
+ * Upper layer (for example NFS) should specify FMODE_32BITHASH or
+ * FMODE_64BITHASH explicitly. On the other hand, we allow ext3 to be mounted
+ * directly on both 32-bit and 64-bit nodes, under such case, neither
+ * FMODE_32BITHASH nor FMODE_64BITHASH is specified.
  */
-#define hash2pos(major, minor) (major >> 1)
-#define pos2maj_hash(pos)      ((pos << 1) & 0xffffffff)
-#define pos2min_hash(pos)      (0)
+static inline loff_t hash2pos(struct file *filp, __u32 major, __u32 minor)
+{
+       if ((filp->f_mode & FMODE_32BITHASH) ||
+           (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
+               return major >> 1;
+       else
+               return ((__u64)(major >> 1) << 32) | (__u64)minor;
+}
+
+static inline __u32 pos2maj_hash(struct file *filp, loff_t pos)
+{
+       if ((filp->f_mode & FMODE_32BITHASH) ||
+           (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
+               return (pos << 1) & 0xffffffff;
+       else
+               return ((pos >> 32) << 1) & 0xffffffff;
+}
+
+static inline __u32 pos2min_hash(struct file *filp, loff_t pos)
+{
+       if ((filp->f_mode & FMODE_32BITHASH) ||
+           (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
+               return 0;
+       else
+               return pos & 0xffffffff;
+}
+
+/*
+ * Return 32- or 64-bit end-of-file for dx directories
+ */
+static inline loff_t ext3_get_htree_eof(struct file *filp)
+{
+       if ((filp->f_mode & FMODE_32BITHASH) ||
+           (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
+               return EXT3_HTREE_EOF_32BIT;
+       else
+               return EXT3_HTREE_EOF_64BIT;
+}
+
+
+/*
+ * ext3_dir_llseek() calls generic_file_llseek[_size]() to handle both
+ * non-htree and htree directories, where the "offset" is in terms
+ * of the filename hash value instead of the byte offset.
+ *
+ * Because we may return a 64-bit hash that is well beyond s_maxbytes,
+ * we need to pass the max hash as the maximum allowable offset in
+ * the htree directory case.
+ *
+ * NOTE: offsets obtained *before* ext3_set_inode_flag(dir, EXT3_INODE_INDEX)
+ *       will be invalid once the directory was converted into a dx directory
+ */
+loff_t ext3_dir_llseek(struct file *file, loff_t offset, int origin)
+{
+       struct inode *inode = file->f_mapping->host;
+       int dx_dir = is_dx_dir(inode);
+
+       if (likely(dx_dir))
+               return generic_file_llseek_size(file, offset, origin,
+                                               ext3_get_htree_eof(file));
+       else
+               return generic_file_llseek(file, offset, origin);
+}
 
 /*
  * This structure holds the nodes of the red-black tree used to store
@@ -303,15 +367,16 @@ static void free_rb_tree_fname(struct rb_root *root)
 }
 
 
-static struct dir_private_info *ext3_htree_create_dir_info(loff_t pos)
+static struct dir_private_info *ext3_htree_create_dir_info(struct file *filp,
+                                                          loff_t pos)
 {
        struct dir_private_info *p;
 
        p = kzalloc(sizeof(struct dir_private_info), GFP_KERNEL);
        if (!p)
                return NULL;
-       p->curr_hash = pos2maj_hash(pos);
-       p->curr_minor_hash = pos2min_hash(pos);
+       p->curr_hash = pos2maj_hash(filp, pos);
+       p->curr_minor_hash = pos2min_hash(filp, pos);
        return p;
 }
 
@@ -401,7 +466,7 @@ static int call_filldir(struct file * filp, void * dirent,
                printk("call_filldir: called with null fname?!?\n");
                return 0;
        }
-       curr_pos = hash2pos(fname->hash, fname->minor_hash);
+       curr_pos = hash2pos(filp, fname->hash, fname->minor_hash);
        while (fname) {
                error = filldir(dirent, fname->name,
                                fname->name_len, curr_pos,
@@ -426,13 +491,13 @@ static int ext3_dx_readdir(struct file * filp,
        int     ret;
 
        if (!info) {
-               info = ext3_htree_create_dir_info(filp->f_pos);
+               info = ext3_htree_create_dir_info(filp, filp->f_pos);
                if (!info)
                        return -ENOMEM;
                filp->private_data = info;
        }
 
-       if (filp->f_pos == EXT3_HTREE_EOF)
+       if (filp->f_pos == ext3_get_htree_eof(filp))
                return 0;       /* EOF */
 
        /* Some one has messed with f_pos; reset the world */
@@ -440,8 +505,8 @@ static int ext3_dx_readdir(struct file * filp,
                free_rb_tree_fname(&info->root);
                info->curr_node = NULL;
                info->extra_fname = NULL;
-               info->curr_hash = pos2maj_hash(filp->f_pos);
-               info->curr_minor_hash = pos2min_hash(filp->f_pos);
+               info->curr_hash = pos2maj_hash(filp, filp->f_pos);
+               info->curr_minor_hash = pos2min_hash(filp, filp->f_pos);
        }
 
        /*
@@ -473,7 +538,7 @@ static int ext3_dx_readdir(struct file * filp,
                        if (ret < 0)
                                return ret;
                        if (ret == 0) {
-                               filp->f_pos = EXT3_HTREE_EOF;
+                               filp->f_pos = ext3_get_htree_eof(filp);
                                break;
                        }
                        info->curr_node = rb_first(&info->root);
@@ -493,7 +558,7 @@ static int ext3_dx_readdir(struct file * filp,
                        info->curr_minor_hash = fname->minor_hash;
                } else {
                        if (info->next_hash == ~0) {
-                               filp->f_pos = EXT3_HTREE_EOF;
+                               filp->f_pos = ext3_get_htree_eof(filp);
                                break;
                        }
                        info->curr_hash = info->next_hash;
@@ -512,3 +577,15 @@ static int ext3_release_dir (struct inode * inode, struct file * filp)
 
        return 0;
 }
+
+const struct file_operations ext3_dir_operations = {
+       .llseek         = ext3_dir_llseek,
+       .read           = generic_read_dir,
+       .readdir        = ext3_readdir,
+       .unlocked_ioctl = ext3_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl   = ext3_compat_ioctl,
+#endif
+       .fsync          = ext3_sync_file,
+       .release        = ext3_release_dir,
+};
index 7977973..e85ff15 100644 (file)
@@ -920,7 +920,11 @@ struct dx_hash_info
        u32             *seed;
 };
 
-#define EXT3_HTREE_EOF 0x7fffffff
+
+/* 32 and 64 bit signed EOF for dx directories */
+#define EXT3_HTREE_EOF_32BIT   ((1UL  << (32 - 1)) - 1)
+#define EXT3_HTREE_EOF_64BIT   ((1ULL << (64 - 1)) - 1)
+
 
 /*
  * Control parameters used by ext3_htree_next_block
index d10231d..ede315c 100644 (file)
@@ -198,8 +198,8 @@ int ext3fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
                return -1;
        }
        hash = hash & ~1;
-       if (hash == (EXT3_HTREE_EOF << 1))
-               hash = (EXT3_HTREE_EOF-1) << 1;
+       if (hash == (EXT3_HTREE_EOF_32BIT << 1))
+               hash = (EXT3_HTREE_EOF_32BIT - 1) << 1;
        hinfo->hash = hash;
        hinfo->minor_hash = minor_hash;
        return 0;
index e3c39e4..082afd7 100644 (file)
@@ -180,8 +180,7 @@ error_return:
  * It's OK to put directory into a group unless
  * it has too many directories already (max_dirs) or
  * it has too few free inodes left (min_inodes) or
- * it has too few free blocks left (min_blocks) or
- * it's already running too large debt (max_debt).
+ * it has too few free blocks left (min_blocks).
  * Parent's group is preferred, if it doesn't satisfy these
  * conditions we search cyclically through the rest. If none
  * of the groups look good we just look for a group with more
@@ -191,21 +190,16 @@ error_return:
  * when we allocate an inode, within 0--255.
  */
 
-#define INODE_COST 64
-#define BLOCK_COST 256
-
 static int find_group_orlov(struct super_block *sb, struct inode *parent)
 {
        int parent_group = EXT3_I(parent)->i_block_group;
        struct ext3_sb_info *sbi = EXT3_SB(sb);
-       struct ext3_super_block *es = sbi->s_es;
        int ngroups = sbi->s_groups_count;
        int inodes_per_group = EXT3_INODES_PER_GROUP(sb);
        unsigned int freei, avefreei;
        ext3_fsblk_t freeb, avefreeb;
-       ext3_fsblk_t blocks_per_dir;
        unsigned int ndirs;
-       int max_debt, max_dirs, min_inodes;
+       int max_dirs, min_inodes;
        ext3_grpblk_t min_blocks;
        int group = -1, i;
        struct ext3_group_desc *desc;
@@ -242,20 +236,10 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
                goto fallback;
        }
 
-       blocks_per_dir = (le32_to_cpu(es->s_blocks_count) - freeb) / ndirs;
-
        max_dirs = ndirs / ngroups + inodes_per_group / 16;
        min_inodes = avefreei - inodes_per_group / 4;
        min_blocks = avefreeb - EXT3_BLOCKS_PER_GROUP(sb) / 4;
 
-       max_debt = EXT3_BLOCKS_PER_GROUP(sb) / max(blocks_per_dir, (ext3_fsblk_t)BLOCK_COST);
-       if (max_debt * INODE_COST > inodes_per_group)
-               max_debt = inodes_per_group / INODE_COST;
-       if (max_debt > 255)
-               max_debt = 255;
-       if (max_debt == 0)
-               max_debt = 1;
-
        for (i = 0; i < ngroups; i++) {
                group = (parent_group + i) % ngroups;
                desc = ext3_get_group_desc (sb, group, NULL);
index 94ef7e6..8c3a44b 100644 (file)
@@ -3015,7 +3015,6 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
                        (unsigned long long)off, (unsigned long long)len);
                return -EIO;
        }
-       mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
        bh = ext3_bread(handle, inode, blk, 1, &err);
        if (!bh)
                goto out;
@@ -3039,10 +3038,8 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
        }
        brelse(bh);
 out:
-       if (err) {
-               mutex_unlock(&inode->i_mutex);
+       if (err)
                return err;
-       }
        if (inode->i_size < off + len) {
                i_size_write(inode, off + len);
                EXT3_I(inode)->i_disksize = inode->i_size;
@@ -3050,7 +3047,6 @@ out:
        inode->i_version++;
        inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        ext3_mark_inode_dirty(handle, inode);
-       mutex_unlock(&inode->i_mutex);
        return len;
 }
 
index 436b422..1867a98 100644 (file)
@@ -4758,7 +4758,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
                return -EIO;
        }
 
-       mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
        bh = ext4_bread(handle, inode, blk, 1, &err);
        if (!bh)
                goto out;
@@ -4774,16 +4773,13 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
        err = ext4_handle_dirty_metadata(handle, NULL, bh);
        brelse(bh);
 out:
-       if (err) {
-               mutex_unlock(&inode->i_mutex);
+       if (err)
                return err;
-       }
        if (inode->i_size < off + len) {
                i_size_write(inode, off + len);
                EXT4_I(inode)->i_disksize = inode->i_size;
                ext4_mark_inode_dirty(handle, inode);
        }
-       mutex_unlock(&inode->i_mutex);
        return len;
 }
 
index 05f0754..08c0304 100644 (file)
@@ -508,20 +508,19 @@ int cleanup_journal_tail(journal_t *journal)
        /*
         * We need to make sure that any blocks that were recently written out
         * --- perhaps by log_do_checkpoint() --- are flushed out before we
-        * drop the transactions from the journal. It's unlikely this will be
-        * necessary, especially with an appropriately sized journal, but we
-        * need this to guarantee correctness.  Fortunately
-        * cleanup_journal_tail() doesn't get called all that often.
+        * drop the transactions from the journal. Similarly we need to be sure
+        * superblock makes it to disk before next transaction starts reusing
+        * freed space (otherwise we could replay some blocks of the new
+        * transaction thinking they belong to the old one). So we use
+        * WRITE_FLUSH_FUA. It's unlikely this will be necessary, especially
+        * with an appropriately sized journal, but we need this to guarantee
+        * correctness.  Fortunately cleanup_journal_tail() doesn't get called
+        * all that often.
         */
-       if (journal->j_flags & JFS_BARRIER)
-               blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
+       journal_update_sb_log_tail(journal, first_tid, blocknr,
+                                  WRITE_FLUSH_FUA);
 
        spin_lock(&journal->j_state_lock);
-       if (!tid_gt(first_tid, journal->j_tail_sequence)) {
-               spin_unlock(&journal->j_state_lock);
-               /* Someone else cleaned up journal so return 0 */
-               return 0;
-       }
        /* OK, update the superblock to recover the freed space.
         * Physical blocks come first: have we wrapped beyond the end of
         * the log?  */
@@ -539,8 +538,6 @@ int cleanup_journal_tail(journal_t *journal)
        journal->j_tail_sequence = first_tid;
        journal->j_tail = blocknr;
        spin_unlock(&journal->j_state_lock);
-       if (!(journal->j_flags & JFS_ABORT))
-               journal_update_superblock(journal, 1);
        return 0;
 }
 
index f2b9a57..52c15c7 100644 (file)
@@ -298,6 +298,7 @@ void journal_commit_transaction(journal_t *journal)
        int tag_flag;
        int i;
        struct blk_plug plug;
+       int write_op = WRITE;
 
        /*
         * First job: lock down the current transaction and wait for
@@ -307,7 +308,16 @@ void journal_commit_transaction(journal_t *journal)
        /* Do we need to erase the effects of a prior journal_flush? */
        if (journal->j_flags & JFS_FLUSHED) {
                jbd_debug(3, "super block updated\n");
-               journal_update_superblock(journal, 1);
+               mutex_lock(&journal->j_checkpoint_mutex);
+               /*
+                * We hold j_checkpoint_mutex so tail cannot change under us.
+                * We don't need any special data guarantees for writing sb
+                * since journal is empty and it is ok for write to be
+                * flushed only with transaction commit.
+                */
+               journal_update_sb_log_tail(journal, journal->j_tail_sequence,
+                                          journal->j_tail, WRITE_SYNC);
+               mutex_unlock(&journal->j_checkpoint_mutex);
        } else {
                jbd_debug(3, "superblock not updated\n");
        }
@@ -413,13 +423,16 @@ void journal_commit_transaction(journal_t *journal)
 
        jbd_debug (3, "JBD: commit phase 2\n");
 
+       if (tid_geq(journal->j_commit_waited, commit_transaction->t_tid))
+               write_op = WRITE_SYNC;
+
        /*
         * Now start flushing things to disk, in the order they appear
         * on the transaction lists.  Data blocks go first.
         */
        blk_start_plug(&plug);
        err = journal_submit_data_buffers(journal, commit_transaction,
-                                         WRITE_SYNC);
+                                         write_op);
        blk_finish_plug(&plug);
 
        /*
@@ -478,7 +491,7 @@ void journal_commit_transaction(journal_t *journal)
 
        blk_start_plug(&plug);
 
-       journal_write_revoke_records(journal, commit_transaction, WRITE_SYNC);
+       journal_write_revoke_records(journal, commit_transaction, write_op);
 
        /*
         * If we found any dirty or locked buffers, then we should have
@@ -649,7 +662,7 @@ start_journal_io:
                                clear_buffer_dirty(bh);
                                set_buffer_uptodate(bh);
                                bh->b_end_io = journal_end_buffer_io_sync;
-                               submit_bh(WRITE_SYNC, bh);
+                               submit_bh(write_op, bh);
                        }
                        cond_resched();
 
index 0971e92..425c2f2 100644 (file)
@@ -563,6 +563,8 @@ int log_wait_commit(journal_t *journal, tid_t tid)
        spin_unlock(&journal->j_state_lock);
 #endif
        spin_lock(&journal->j_state_lock);
+       if (!tid_geq(journal->j_commit_waited, tid))
+               journal->j_commit_waited = tid;
        while (tid_gt(tid, journal->j_commit_sequence)) {
                jbd_debug(1, "JBD: want %d, j_commit_sequence=%d\n",
                                  tid, journal->j_commit_sequence);
@@ -921,8 +923,33 @@ static int journal_reset(journal_t *journal)
 
        journal->j_max_transaction_buffers = journal->j_maxlen / 4;
 
-       /* Add the dynamic fields and write it to disk. */
-       journal_update_superblock(journal, 1);
+       /*
+        * As a special case, if the on-disk copy is already marked as needing
+        * no recovery (s_start == 0), then we can safely defer the superblock
+        * update until the next commit by setting JFS_FLUSHED.  This avoids
+        * attempting a write to a potential-readonly device.
+        */
+       if (sb->s_start == 0) {
+               jbd_debug(1,"JBD: Skipping superblock update on recovered sb "
+                       "(start %u, seq %d, errno %d)\n",
+                       journal->j_tail, journal->j_tail_sequence,
+                       journal->j_errno);
+               journal->j_flags |= JFS_FLUSHED;
+       } else {
+               /* Lock here to make assertions happy... */
+               mutex_lock(&journal->j_checkpoint_mutex);
+               /*
+                * Update log tail information. We use WRITE_FUA since new
+                * transaction will start reusing journal space and so we
+                * must make sure information about current log tail is on
+                * disk before that.
+                */
+               journal_update_sb_log_tail(journal,
+                                          journal->j_tail_sequence,
+                                          journal->j_tail,
+                                          WRITE_FUA);
+               mutex_unlock(&journal->j_checkpoint_mutex);
+       }
        return journal_start_thread(journal);
 }
 
@@ -999,35 +1026,15 @@ int journal_create(journal_t *journal)
        return journal_reset(journal);
 }
 
-/**
- * void journal_update_superblock() - Update journal sb on disk.
- * @journal: The journal to update.
- * @wait: Set to '0' if you don't want to wait for IO completion.
- *
- * Update a journal's dynamic superblock fields and write it to disk,
- * optionally waiting for the IO to complete.
- */
-void journal_update_superblock(journal_t *journal, int wait)
+static void journal_write_superblock(journal_t *journal, int write_op)
 {
-       journal_superblock_t *sb = journal->j_superblock;
        struct buffer_head *bh = journal->j_sb_buffer;
+       int ret;
 
-       /*
-        * As a special case, if the on-disk copy is already marked as needing
-        * no recovery (s_start == 0) and there are no outstanding transactions
-        * in the filesystem, then we can safely defer the superblock update
-        * until the next commit by setting JFS_FLUSHED.  This avoids
-        * attempting a write to a potential-readonly device.
-        */
-       if (sb->s_start == 0 && journal->j_tail_sequence ==
-                               journal->j_transaction_sequence) {
-               jbd_debug(1,"JBD: Skipping superblock update on recovered sb "
-                       "(start %u, seq %d, errno %d)\n",
-                       journal->j_tail, journal->j_tail_sequence,
-                       journal->j_errno);
-               goto out;
-       }
-
+       trace_journal_write_superblock(journal, write_op);
+       if (!(journal->j_flags & JFS_BARRIER))
+               write_op &= ~(REQ_FUA | REQ_FLUSH);
+       lock_buffer(bh);
        if (buffer_write_io_error(bh)) {
                char b[BDEVNAME_SIZE];
                /*
@@ -1045,42 +1052,100 @@ void journal_update_superblock(journal_t *journal, int wait)
                set_buffer_uptodate(bh);
        }
 
+       get_bh(bh);
+       bh->b_end_io = end_buffer_write_sync;
+       ret = submit_bh(write_op, bh);
+       wait_on_buffer(bh);
+       if (buffer_write_io_error(bh)) {
+               clear_buffer_write_io_error(bh);
+               set_buffer_uptodate(bh);
+               ret = -EIO;
+       }
+       if (ret) {
+               char b[BDEVNAME_SIZE];
+               printk(KERN_ERR "JBD: Error %d detected "
+                      "when updating journal superblock for %s.\n",
+                      ret, journal_dev_name(journal, b));
+       }
+}
+
+/**
+ * journal_update_sb_log_tail() - Update log tail in journal sb on disk.
+ * @journal: The journal to update.
+ * @tail_tid: TID of the new transaction at the tail of the log
+ * @tail_block: The first block of the transaction at the tail of the log
+ * @write_op: With which operation should we write the journal sb
+ *
+ * Update a journal's superblock information about log tail and write it to
+ * disk, waiting for the IO to complete.
+ */
+void journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,
+                               unsigned int tail_block, int write_op)
+{
+       journal_superblock_t *sb = journal->j_superblock;
+
+       BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
+       jbd_debug(1,"JBD: updating superblock (start %u, seq %u)\n",
+                 tail_block, tail_tid);
+
+       sb->s_sequence = cpu_to_be32(tail_tid);
+       sb->s_start    = cpu_to_be32(tail_block);
+
+       journal_write_superblock(journal, write_op);
+
+       /* Log is no longer empty */
+       spin_lock(&journal->j_state_lock);
+       WARN_ON(!sb->s_sequence);
+       journal->j_flags &= ~JFS_FLUSHED;
+       spin_unlock(&journal->j_state_lock);
+}
+
+/**
+ * mark_journal_empty() - Mark on disk journal as empty.
+ * @journal: The journal to update.
+ *
+ * Update a journal's dynamic superblock fields to show that journal is empty.
+ * Write updated superblock to disk waiting for IO to complete.
+ */
+static void mark_journal_empty(journal_t *journal)
+{
+       journal_superblock_t *sb = journal->j_superblock;
+
+       BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
        spin_lock(&journal->j_state_lock);
-       jbd_debug(1,"JBD: updating superblock (start %u, seq %d, errno %d)\n",
-                 journal->j_tail, journal->j_tail_sequence, journal->j_errno);
+       jbd_debug(1, "JBD: Marking journal as empty (seq %d)\n",
+                 journal->j_tail_sequence);
 
        sb->s_sequence = cpu_to_be32(journal->j_tail_sequence);
-       sb->s_start    = cpu_to_be32(journal->j_tail);
-       sb->s_errno    = cpu_to_be32(journal->j_errno);
+       sb->s_start    = cpu_to_be32(0);
        spin_unlock(&journal->j_state_lock);
 
-       BUFFER_TRACE(bh, "marking dirty");
-       mark_buffer_dirty(bh);
-       if (wait) {
-               sync_dirty_buffer(bh);
-               if (buffer_write_io_error(bh)) {
-                       char b[BDEVNAME_SIZE];
-                       printk(KERN_ERR "JBD: I/O error detected "
-                              "when updating journal superblock for %s.\n",
-                              journal_dev_name(journal, b));
-                       clear_buffer_write_io_error(bh);
-                       set_buffer_uptodate(bh);
-               }
-       } else
-               write_dirty_buffer(bh, WRITE);
+       journal_write_superblock(journal, WRITE_FUA);
 
-       trace_jbd_update_superblock_end(journal, wait);
-out:
-       /* If we have just flushed the log (by marking s_start==0), then
-        * any future commit will have to be careful to update the
-        * superblock again to re-record the true start of the log. */
+       spin_lock(&journal->j_state_lock);
+       /* Log is empty */
+       journal->j_flags |= JFS_FLUSHED;
+       spin_unlock(&journal->j_state_lock);
+}
+
+/**
+ * journal_update_sb_errno() - Update error in the journal.
+ * @journal: The journal to update.
+ *
+ * Update a journal's errno.  Write updated superblock to disk waiting for IO
+ * to complete.
+ */
+static void journal_update_sb_errno(journal_t *journal)
+{
+       journal_superblock_t *sb = journal->j_superblock;
 
        spin_lock(&journal->j_state_lock);
-       if (sb->s_start)
-               journal->j_flags &= ~JFS_FLUSHED;
-       else
-               journal->j_flags |= JFS_FLUSHED;
+       jbd_debug(1, "JBD: updating superblock error (errno %d)\n",
+                 journal->j_errno);
+       sb->s_errno = cpu_to_be32(journal->j_errno);
        spin_unlock(&journal->j_state_lock);
+
+       journal_write_superblock(journal, WRITE_SYNC);
 }
 
 /*
@@ -1251,6 +1316,8 @@ int journal_destroy(journal_t *journal)
 
        /* Force any old transactions to disk */
 
+       /* We cannot race with anybody but must keep assertions happy */
+       mutex_lock(&journal->j_checkpoint_mutex);
        /* Totally anal locking here... */
        spin_lock(&journal->j_list_lock);
        while (journal->j_checkpoint_transactions != NULL) {
@@ -1266,16 +1333,14 @@ int journal_destroy(journal_t *journal)
 
        if (journal->j_sb_buffer) {
                if (!is_journal_aborted(journal)) {
-                       /* We can now mark the journal as empty. */
-                       journal->j_tail = 0;
                        journal->j_tail_sequence =
                                ++journal->j_transaction_sequence;
-                       journal_update_superblock(journal, 1);
-               } else {
+                       mark_journal_empty(journal);
+               } else
                        err = -EIO;
-               }
                brelse(journal->j_sb_buffer);
        }
+       mutex_unlock(&journal->j_checkpoint_mutex);
 
        if (journal->j_inode)
                iput(journal->j_inode);
@@ -1455,7 +1520,6 @@ int journal_flush(journal_t *journal)
 {
        int err = 0;
        transaction_t *transaction = NULL;
-       unsigned int old_tail;
 
        spin_lock(&journal->j_state_lock);
 
@@ -1490,6 +1554,7 @@ int journal_flush(journal_t *journal)
        if (is_journal_aborted(journal))
                return -EIO;
 
+       mutex_lock(&journal->j_checkpoint_mutex);
        cleanup_journal_tail(journal);
 
        /* Finally, mark the journal as really needing no recovery.
@@ -1497,14 +1562,9 @@ int journal_flush(journal_t *journal)
         * the magic code for a fully-recovered superblock.  Any future
         * commits of data to the journal will restore the current
         * s_start value. */
+       mark_journal_empty(journal);
+       mutex_unlock(&journal->j_checkpoint_mutex);
        spin_lock(&journal->j_state_lock);
-       old_tail = journal->j_tail;
-       journal->j_tail = 0;
-       spin_unlock(&journal->j_state_lock);
-       journal_update_superblock(journal, 1);
-       spin_lock(&journal->j_state_lock);
-       journal->j_tail = old_tail;
-
        J_ASSERT(!journal->j_running_transaction);
        J_ASSERT(!journal->j_committing_transaction);
        J_ASSERT(!journal->j_checkpoint_transactions);
@@ -1544,8 +1604,12 @@ int journal_wipe(journal_t *journal, int write)
                write ? "Clearing" : "Ignoring");
 
        err = journal_skip_recovery(journal);
-       if (write)
-               journal_update_superblock(journal, 1);
+       if (write) {
+               /* Lock to make assertions happy... */
+               mutex_lock(&journal->j_checkpoint_mutex);
+               mark_journal_empty(journal);
+               mutex_unlock(&journal->j_checkpoint_mutex);
+       }
 
  no_recovery:
        return err;
@@ -1613,7 +1677,7 @@ static void __journal_abort_soft (journal_t *journal, int errno)
        __journal_abort_hard(journal);
 
        if (errno)
-               journal_update_superblock(journal, 1);
+               journal_update_sb_errno(journal);
 }
 
 /**
index b2a7e52..febc10d 100644 (file)
@@ -1433,8 +1433,6 @@ int journal_stop(handle_t *handle)
                }
        }
 
-       if (handle->h_sync)
-               transaction->t_synchronous_commit = 1;
        current->journal_info = NULL;
        spin_lock(&journal->j_state_lock);
        spin_lock(&transaction->t_handle_lock);
index d69a1d1..10cbe84 100644 (file)
  * spinlock to internal buffers before writing.
  *
  * Lock ordering (including related VFS locks) is the following:
- *   i_mutex > dqonoff_sem > journal_lock > dqptr_sem > dquot->dq_lock >
+ *   dqonoff_mutex > i_mutex > journal_lock > dqptr_sem > dquot->dq_lock >
  *   dqio_mutex
+ * dqonoff_mutex > i_mutex comes from dquot_quota_sync, dquot_enable, etc.
  * The lock ordering of dqptr_sem imposed by quota code is only dqonoff_sem >
  * dqptr_sem. But filesystem has to count with the fact that functions such as
  * dquot_alloc_space() acquire dqptr_sem and they usually have to be called
  * from inside a transaction to keep filesystem consistency after a crash. Also
  * filesystems usually want to do some IO on dquot from ->mark_dirty which is
  * called with dqptr_sem held.
- * i_mutex on quota files is special (it's below dqio_mutex)
  */
 
 static __cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_list_lock);
@@ -638,7 +638,7 @@ int dquot_quota_sync(struct super_block *sb, int type, int wait)
        dqstats_inc(DQST_SYNCS);
        mutex_unlock(&dqopt->dqonoff_mutex);
 
-       if (!wait || (sb_dqopt(sb)->flags & DQUOT_QUOTA_SYS_FILE))
+       if (!wait || (dqopt->flags & DQUOT_QUOTA_SYS_FILE))
                return 0;
 
        /* This is not very clever (and fast) but currently I don't know about
@@ -652,18 +652,17 @@ int dquot_quota_sync(struct super_block *sb, int type, int wait)
         * Now when everything is written we can discard the pagecache so
         * that userspace sees the changes.
         */
-       mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
+       mutex_lock(&dqopt->dqonoff_mutex);
        for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
                if (type != -1 && cnt != type)
                        continue;
                if (!sb_has_quota_active(sb, cnt))
                        continue;
-               mutex_lock_nested(&sb_dqopt(sb)->files[cnt]->i_mutex,
-                                 I_MUTEX_QUOTA);
-               truncate_inode_pages(&sb_dqopt(sb)->files[cnt]->i_data, 0);
-               mutex_unlock(&sb_dqopt(sb)->files[cnt]->i_mutex);
+               mutex_lock(&dqopt->files[cnt]->i_mutex);
+               truncate_inode_pages(&dqopt->files[cnt]->i_data, 0);
+               mutex_unlock(&dqopt->files[cnt]->i_mutex);
        }
-       mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
+       mutex_unlock(&dqopt->dqonoff_mutex);
 
        return 0;
 }
@@ -907,14 +906,14 @@ static void add_dquot_ref(struct super_block *sb, int type)
                        spin_unlock(&inode->i_lock);
                        continue;
                }
-#ifdef CONFIG_QUOTA_DEBUG
-               if (unlikely(inode_get_rsv_space(inode) > 0))
-                       reserved = 1;
-#endif
                __iget(inode);
                spin_unlock(&inode->i_lock);
                spin_unlock(&inode_sb_list_lock);
 
+#ifdef CONFIG_QUOTA_DEBUG
+               if (unlikely(inode_get_rsv_space(inode) > 0))
+                       reserved = 1;
+#endif
                iput(old_inode);
                __dquot_initialize(inode, type);
 
@@ -2037,8 +2036,7 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags)
                        /* If quota was reenabled in the meantime, we have
                         * nothing to do */
                        if (!sb_has_quota_loaded(sb, cnt)) {
-                               mutex_lock_nested(&toputinode[cnt]->i_mutex,
-                                                 I_MUTEX_QUOTA);
+                               mutex_lock(&toputinode[cnt]->i_mutex);
                                toputinode[cnt]->i_flags &= ~(S_IMMUTABLE |
                                  S_NOATIME | S_NOQUOTA);
                                truncate_inode_pages(&toputinode[cnt]->i_data,
@@ -2133,7 +2131,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
                /* We don't want quota and atime on quota files (deadlocks
                 * possible) Also nobody should write to the file - we use
                 * special IO operations which ignore the immutable bit. */
-               mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
+               mutex_lock(&inode->i_mutex);
                oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE |
                                             S_NOQUOTA);
                inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE;
@@ -2180,7 +2178,7 @@ out_file_init:
        iput(inode);
 out_lock:
        if (oldflags != -1) {
-               mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
+               mutex_lock(&inode->i_mutex);
                /* Set the flags back (in the case of accidental quotaon()
                 * on a wrong file we don't want to mess up the flags) */
                inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE);
index 8b7616e..c07b7d7 100644 (file)
@@ -2270,7 +2270,6 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
                        (unsigned long long)off, (unsigned long long)len);
                return -EIO;
        }
-       mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA);
        while (towrite > 0) {
                tocopy = sb->s_blocksize - offset < towrite ?
                    sb->s_blocksize - offset : towrite;
@@ -2302,16 +2301,13 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
                blk++;
        }
 out:
-       if (len == towrite) {
-               mutex_unlock(&inode->i_mutex);
+       if (len == towrite)
                return err;
-       }
        if (inode->i_size < off + len - towrite)
                i_size_write(inode, off + len - towrite);
        inode->i_version++;
        inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        mark_inode_dirty(inode);
-       mutex_unlock(&inode->i_mutex);
        return len - towrite;
 }
 
index d211732..c8f3297 100644 (file)
@@ -479,12 +479,6 @@ struct transaction_s
         * How many handles used this transaction? [t_handle_lock]
         */
        int t_handle_count;
-
-       /*
-        * This transaction is being forced and some process is
-        * waiting for it to finish.
-        */
-       unsigned int t_synchronous_commit:1;
 };
 
 /**
@@ -531,6 +525,8 @@ struct transaction_s
  *  transaction
  * @j_commit_request: Sequence number of the most recent transaction wanting
  *     commit
+ * @j_commit_waited: Sequence number of the most recent transaction someone
+ *     is waiting for to commit.
  * @j_uuid: Uuid of client object.
  * @j_task: Pointer to the current commit thread for this journal
  * @j_max_transaction_buffers:  Maximum number of metadata buffers to allow in a
@@ -695,6 +691,13 @@ struct journal_s
         */
        tid_t                   j_commit_request;
 
+       /*
+        * Sequence number of the most recent transaction someone is waiting
+        * for to commit.
+        * [j_state_lock]
+        */
+       tid_t                   j_commit_waited;
+
        /*
         * Journal uuid: identifies the object (filesystem, LVM volume etc)
         * backed by this journal.  This will eventually be replaced by an array
@@ -861,7 +864,8 @@ extern int     journal_destroy    (journal_t *);
 extern int        journal_recover    (journal_t *journal);
 extern int        journal_wipe       (journal_t *, int);
 extern int        journal_skip_recovery        (journal_t *);
-extern void       journal_update_superblock    (journal_t *, int);
+extern void       journal_update_sb_log_tail   (journal_t *, tid_t, unsigned int,
+                                                int);
 extern void       journal_abort      (journal_t *, int);
 extern int        journal_errno      (journal_t *);
 extern void       journal_ack_err    (journal_t *);
index aff64d8..da6f259 100644 (file)
@@ -36,19 +36,17 @@ DECLARE_EVENT_CLASS(jbd_commit,
 
        TP_STRUCT__entry(
                __field(        dev_t,  dev                     )
-               __field(        char,   sync_commit             )
                __field(        int,    transaction             )
        ),
 
        TP_fast_assign(
                __entry->dev            = journal->j_fs_dev->bd_dev;
-               __entry->sync_commit = commit_transaction->t_synchronous_commit;
                __entry->transaction    = commit_transaction->t_tid;
        ),
 
-       TP_printk("dev %d,%d transaction %d sync %d",
+       TP_printk("dev %d,%d transaction %d",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
-                 __entry->transaction, __entry->sync_commit)
+                 __entry->transaction)
 );
 
 DEFINE_EVENT(jbd_commit, jbd_start_commit,
@@ -87,19 +85,17 @@ TRACE_EVENT(jbd_drop_transaction,
 
        TP_STRUCT__entry(
                __field(        dev_t,  dev                     )
-               __field(        char,   sync_commit             )
                __field(        int,    transaction             )
        ),
 
        TP_fast_assign(
                __entry->dev            = journal->j_fs_dev->bd_dev;
-               __entry->sync_commit = commit_transaction->t_synchronous_commit;
                __entry->transaction    = commit_transaction->t_tid;
        ),
 
-       TP_printk("dev %d,%d transaction %d sync %d",
+       TP_printk("dev %d,%d transaction %d",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
-                 __entry->transaction, __entry->sync_commit)
+                 __entry->transaction)
 );
 
 TRACE_EVENT(jbd_end_commit,
@@ -109,21 +105,19 @@ TRACE_EVENT(jbd_end_commit,
 
        TP_STRUCT__entry(
                __field(        dev_t,  dev                     )
-               __field(        char,   sync_commit             )
                __field(        int,    transaction             )
                __field(        int,    head                    )
        ),
 
        TP_fast_assign(
                __entry->dev            = journal->j_fs_dev->bd_dev;
-               __entry->sync_commit = commit_transaction->t_synchronous_commit;
                __entry->transaction    = commit_transaction->t_tid;
                __entry->head           = journal->j_tail_sequence;
        ),
 
-       TP_printk("dev %d,%d transaction %d sync %d head %d",
+       TP_printk("dev %d,%d transaction %d head %d",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
-                 __entry->transaction, __entry->sync_commit, __entry->head)
+                 __entry->transaction, __entry->head)
 );
 
 TRACE_EVENT(jbd_do_submit_data,
@@ -133,19 +127,17 @@ TRACE_EVENT(jbd_do_submit_data,
 
        TP_STRUCT__entry(
                __field(        dev_t,  dev                     )
-               __field(        char,   sync_commit             )
                __field(        int,    transaction             )
        ),
 
        TP_fast_assign(
                __entry->dev            = journal->j_fs_dev->bd_dev;
-               __entry->sync_commit = commit_transaction->t_synchronous_commit;
                __entry->transaction    = commit_transaction->t_tid;
        ),
 
-       TP_printk("dev %d,%d transaction %d sync %d",
+       TP_printk("dev %d,%d transaction %d",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
-                  __entry->transaction, __entry->sync_commit)
+                  __entry->transaction)
 );
 
 TRACE_EVENT(jbd_cleanup_journal_tail,
@@ -177,24 +169,23 @@ TRACE_EVENT(jbd_cleanup_journal_tail,
                  __entry->block_nr, __entry->freed)
 );
 
-TRACE_EVENT(jbd_update_superblock_end,
-       TP_PROTO(journal_t *journal, int wait),
+TRACE_EVENT(journal_write_superblock,
+       TP_PROTO(journal_t *journal, int write_op),
 
-       TP_ARGS(journal, wait),
+       TP_ARGS(journal, write_op),
 
        TP_STRUCT__entry(
                __field(        dev_t,  dev                     )
-               __field(        int,    wait                    )
+               __field(        int,    write_op                )
        ),
 
        TP_fast_assign(
                __entry->dev            = journal->j_fs_dev->bd_dev;
-               __entry->wait           = wait;
+               __entry->write_op       = write_op;
        ),
 
-       TP_printk("dev %d,%d wait %d",
-                 MAJOR(__entry->dev), MINOR(__entry->dev),
-                  __entry->wait)
+       TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
+                 MINOR(__entry->dev), __entry->write_op)
 );
 
 #endif /* _TRACE_JBD_H */