aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-02-05 09:26:17 -0500
committerDavid Sterba <dsterba@suse.cz>2014-11-12 10:53:12 -0500
commit572d9ab7845ea0e043ec34cd733a75228130ad03 (patch)
tree0dcf250edd2859e3dd64b0b33f9694c3fd61c29b /fs/btrfs/transaction.c
parent206c5f60a3d902bc4b56dab2de3e88de5eb06108 (diff)
btrfs: add support for processing pending changes
There are some actions that modify global filesystem state but cannot be performed at the time of request, but later at the transaction commit time when the filesystem is in a known state. For example enabling new incompat features on-the-fly or issuing transaction commit from unsafe contexts (sysfs handlers). Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index dcaae3616728..7a4024a55e5c 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1850,6 +1850,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1850 else 1850 else
1851 btrfs_clear_opt(root->fs_info->mount_opt, INODE_MAP_CACHE); 1851 btrfs_clear_opt(root->fs_info->mount_opt, INODE_MAP_CACHE);
1852 1852
1853 btrfs_apply_pending_changes(root->fs_info);
1854
1853 /* commit_fs_roots gets rid of all the tree log roots, it is now 1855 /* commit_fs_roots gets rid of all the tree log roots, it is now
1854 * safe to free the root of tree log roots 1856 * safe to free the root of tree log roots
1855 */ 1857 */
@@ -2019,3 +2021,17 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
2019 2021
2020 return (ret < 0) ? 0 : 1; 2022 return (ret < 0) ? 0 : 1;
2021} 2023}
2024
2025void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info)
2026{
2027 unsigned long prev;
2028 unsigned long bit;
2029
2030 prev = cmpxchg(&fs_info->pending_changes, 0, 0);
2031 if (!prev)
2032 return;
2033
2034 if (prev)
2035 btrfs_warn(fs_info,
2036 "unknown pending changes left 0x%lx, ignoring", prev);
2037}