diff options
author | Omar Sandoval <osandov@fb.com> | 2018-05-11 13:13:38 -0700 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-05-28 18:23:57 +0200 |
commit | a575ceeb1338e7eae6d14e223b077b3c6fd3bb6b (patch) | |
tree | 4217b93527ffc4a31a9c85dd787dde1c24bb1154 /fs/btrfs/inode.c | |
parent | 27919067f182c35f825406ad76a0e2e5644d33af (diff) | |
download | linux-stable-a575ceeb1338e7eae6d14e223b077b3c6fd3bb6b.tar.gz linux-stable-a575ceeb1338e7eae6d14e223b077b3c6fd3bb6b.tar.bz2 linux-stable-a575ceeb1338e7eae6d14e223b077b3c6fd3bb6b.zip |
Btrfs: get rid of unused orphan infrastructure
Now that we don't keep long-standing reservations for orphan items,
root->orphan_block_rsv isn't used. We can git rid of it, along with:
- root->orphan_lock, which was used to protect root->orphan_block_rsv
- root->orphan_inodes, which was used as a refcount for root->orphan_block_rsv
- BTRFS_INODE_ORPHAN_META_RESERVED, which was used to track reservations
in root->orphan_block_rsv
- btrfs_orphan_commit_root(), which was the last user of any of these
and does nothing else
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f8af40d02595..b247ea31c436 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3298,42 +3298,6 @@ void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info) } /* - * This is called in transaction commit time. If there are no orphan - * files in the subvolume, it removes orphan item and frees block_rsv - * structure. - */ -void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans, - struct btrfs_root *root) -{ - struct btrfs_fs_info *fs_info = root->fs_info; - struct btrfs_block_rsv *block_rsv; - - if (atomic_read(&root->orphan_inodes) || - root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE) - return; - - spin_lock(&root->orphan_lock); - if (atomic_read(&root->orphan_inodes)) { - spin_unlock(&root->orphan_lock); - return; - } - - if (root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE) { - spin_unlock(&root->orphan_lock); - return; - } - - block_rsv = root->orphan_block_rsv; - root->orphan_block_rsv = NULL; - spin_unlock(&root->orphan_lock); - - if (block_rsv) { - WARN_ON(block_rsv->size > 0); - btrfs_free_block_rsv(fs_info, block_rsv); - } -} - -/* * This creates an orphan entry for the given inode in case something goes wrong * in the middle of an unlink. */ @@ -3526,12 +3490,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) root->orphan_cleanup_state = ORPHAN_CLEANUP_DONE; - if (root->orphan_block_rsv) - btrfs_block_rsv_release(fs_info, root->orphan_block_rsv, - (u64)-1); - - if (root->orphan_block_rsv || - test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state)) { + if (test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state)) { trans = btrfs_join_transaction(root); if (!IS_ERR(trans)) btrfs_end_transaction(trans); |