]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Mon, 15 Aug 2016 02:36:50 +0000 (10:36 +0800)
committerChris Mason <clm@fb.com>
Thu, 25 Aug 2016 10:58:21 +0000 (03:58 -0700)
commitccfc2d97aeb021d22572a663a76a85e2c5665189
treeb6c954acb2fea1d90fd513f231ffb33f6f956852
parentcb8ab35b5975ab7a62a46ef066c71bddc3b777c4
btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()

Refactor btrfs_qgroup_insert_dirty_extent() function, to two functions:
1. btrfs_qgroup_insert_dirty_extent_nolock()
   Almost the same with original code.
   For delayed_ref usage, which has delayed refs locked.

   Change the return value type to int, since caller never needs the
   pointer, but only needs to know if they need to free the allocated
   memory.

2. btrfs_qgroup_insert_dirty_extent()
   The more encapsulated version.

   Will do the delayed_refs lock, memory allocation, quota enabled check
   and other things.

The original design is to keep exported functions to minimal, but since
more btrfs hacks exposed, like replacing path in balance, we need to
record dirty extents manually, so we have to add such functions.

Also, add comment for both functions, to info developers how to keep
qgroup correct when doing hacks.

Cc: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-and-Tested-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/delayed-ref.c
fs/btrfs/extent-tree.c
fs/btrfs/qgroup.c
fs/btrfs/qgroup.h