]> git.hungrycats.org Git - linux/commitdiff
btrfs: introduce pending action: commit
authorDavid Sterba <dsterba@suse.cz>
Wed, 12 Nov 2014 13:24:35 +0000 (14:24 +0100)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Fri, 23 Jan 2015 13:15:45 +0000 (08:15 -0500)
In some contexts, like in sysfs handlers, we don't want to trigger a
transaction commit. It's a heavy operation, we don't know what external
locks may be taken. Instead, make it possible to finish the operation
through sync syscall or SYNC_FS ioctl.

Signed-off-by: David Sterba <dsterba@suse.cz>
(cherry picked from commit d51033d05547675f898ce4233a7d8d1a0dfe2984)

fs/btrfs/ctree.h
fs/btrfs/transaction.c

index 1c9157e4ab0c9f6dc6584a805125740055f40756..817fc19b81594f4549ffe29f51e12ad30b900071 100644 (file)
@@ -2132,6 +2132,7 @@ struct btrfs_ioctl_defrag_range_args {
 
 #define BTRFS_PENDING_SET_INODE_MAP_CACHE      (0)
 #define BTRFS_PENDING_CLEAR_INODE_MAP_CACHE    (1)
+#define BTRFS_PENDING_COMMIT                   (2)
 
 #define btrfs_test_pending(info, opt)  \
        test_bit(BTRFS_PENDING_##opt, &(info)->pending_changes)
index 059fb6d4025567a7cbc3b4ad12fe879b4fc29d60..929b8a69f56e47c9b4d65b6d6cd2aa1ed3aa8590 100644 (file)
@@ -2069,6 +2069,11 @@ void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info)
                btrfs_clear_opt(fs_info->mount_opt, INODE_MAP_CACHE);
        prev &= ~bit;
 
+       bit = 1 << BTRFS_PENDING_COMMIT;
+       if (prev & bit)
+               btrfs_debug(fs_info, "pending commit done");
+       prev &= ~bit;
+
        if (prev)
                btrfs_warn(fs_info,
                        "unknown pending changes left 0x%lx, ignoring", prev);