Btrfs: use the inode own lock to protect its delalloc_bytes
PATCH 8/11 Btrfs: use the inode own lock to protect its delalloc_bytes
We need not use a global lock to protect the delalloc_bytes of the inode, just use its own lock. In this way, we can reduce the lock contention and ->delalloc_lock will just protect delalloc inode list.
Signed-off-by Miao Xie <[email protected]>
--- fs/btrfs/btrfs_inode.h | 1 + fs/btrfs/disk-io.c | 2 ++ fs/btrfs/inode.c | 47 ++++++++++++++++++++++++++++++++++------------- 3 files changed, 37 insertions(+), 13 deletions(-)
fs/btrfs/btrfs_inode.h +1 -0
@@ -40,6 +40,7 @@#define BTRFS_INODE_HAS_ASYNC_EXTENT 6#define BTRFS_INODE_NEEDS_FULL_SYNC 7#define BTRFS_INODE_COPY_EVERYTHING 8 +#define BTRFS_INODE_IN_DELALLOC_LIST 9/* in memory btrfs inode */ struct btrfs_inode {
fs/btrfs/disk-io.c +2 -0
@@ -3685,6 +3685,8 @@ static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root) delalloc_inodes);list_del_init (&btrfs_inode->delalloc_inodes); +clear_bit (BTRFS_INODE_IN_DELALLOC_LIST , + &btrfs_inode->runtime_flags);btrfs_invalidate_inodes (btrfs_inode->root); }
fs/btrfs/inode.c +34 -13
87 lines not on this page · raw message
Signature · 1 line
1.7.11.7