diff options
author | David Sterba <dsterba@suse.cz> | 2014-11-12 08:24:35 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-11-12 10:53:14 -0500 |
commit | d51033d05547675f898ce4233a7d8d1a0dfe2984 (patch) | |
tree | dbdf9ce4507515b1305ee354d6e968ab3aa01b15 | |
parent | 7e1876aca815029d5c3023a66a91e249eca3e533 (diff) |
btrfs: introduce pending action: commit
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>
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1c9157e4ab0c..817fc19b8159 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2132,6 +2132,7 @@ struct btrfs_ioctl_defrag_range_args { | |||
2132 | 2132 | ||
2133 | #define BTRFS_PENDING_SET_INODE_MAP_CACHE (0) | 2133 | #define BTRFS_PENDING_SET_INODE_MAP_CACHE (0) |
2134 | #define BTRFS_PENDING_CLEAR_INODE_MAP_CACHE (1) | 2134 | #define BTRFS_PENDING_CLEAR_INODE_MAP_CACHE (1) |
2135 | #define BTRFS_PENDING_COMMIT (2) | ||
2135 | 2136 | ||
2136 | #define btrfs_test_pending(info, opt) \ | 2137 | #define btrfs_test_pending(info, opt) \ |
2137 | test_bit(BTRFS_PENDING_##opt, &(info)->pending_changes) | 2138 | test_bit(BTRFS_PENDING_##opt, &(info)->pending_changes) |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 703238ed7337..9d8e2b8d12b4 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -2036,6 +2036,11 @@ void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info) | |||
2036 | btrfs_clear_opt(fs_info->mount_opt, INODE_MAP_CACHE); | 2036 | btrfs_clear_opt(fs_info->mount_opt, INODE_MAP_CACHE); |
2037 | prev &= ~bit; | 2037 | prev &= ~bit; |
2038 | 2038 | ||
2039 | bit = 1 << BTRFS_PENDING_COMMIT; | ||
2040 | if (prev & bit) | ||
2041 | btrfs_debug(fs_info, "pending commit done"); | ||
2042 | prev &= ~bit; | ||
2043 | |||
2039 | if (prev) | 2044 | if (prev) |
2040 | btrfs_warn(fs_info, | 2045 | btrfs_warn(fs_info, |
2041 | "unknown pending changes left 0x%lx, ignoring", prev); | 2046 | "unknown pending changes left 0x%lx, ignoring", prev); |