Skip to content

Commit 8eedadd

Browse files
fdmananakdave
authored andcommitted
btrfs: rename btrfs_check_shared() to a more descriptive name
The function btrfs_check_shared() is supposed to be used to check if a data extent is shared, but its name is too generic, may easily cause confusion in the sense that it may be used for metadata extents. So rename it to btrfs_is_data_extent_shared(), which will also make it less confusing after the next change that adds a backref lookup cache for the b+tree nodes that lead to the leaf that contains the file extent item that points to the target data extent. Reviewed-by: Josef Bacik <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 09fbc1c commit 8eedadd

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

fs/btrfs/backref.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1511,16 +1511,16 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
15111511
return ret;
15121512
}
15131513

1514-
/**
1515-
* Check if an extent is shared or not
1514+
/*
1515+
* Check if a data extent is shared or not.
15161516
*
15171517
* @root: root inode belongs to
15181518
* @inum: inode number of the inode whose extent we are checking
15191519
* @bytenr: logical bytenr of the extent we are checking
15201520
* @roots: list of roots this extent is shared among
15211521
* @tmp: temporary list used for iteration
15221522
*
1523-
* btrfs_check_shared uses the backref walking code but will short
1523+
* btrfs_is_data_extent_shared uses the backref walking code but will short
15241524
* circuit as soon as it finds a root or inode that doesn't match the
15251525
* one passed in. This provides a significant performance benefit for
15261526
* callers (such as fiemap) which want to know whether the extent is
@@ -1531,8 +1531,8 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
15311531
*
15321532
* Return: 0 if extent is not shared, 1 if it is shared, < 0 on error.
15331533
*/
1534-
int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr,
1535-
struct ulist *roots, struct ulist *tmp)
1534+
int btrfs_is_data_extent_shared(struct btrfs_root *root, u64 inum, u64 bytenr,
1535+
struct ulist *roots, struct ulist *tmp)
15361536
{
15371537
struct btrfs_fs_info *fs_info = root->fs_info;
15381538
struct btrfs_trans_handle *trans;

fs/btrfs/backref.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
6262
u64 start_off, struct btrfs_path *path,
6363
struct btrfs_inode_extref **ret_extref,
6464
u64 *found_off);
65-
int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr,
66-
struct ulist *roots, struct ulist *tmp_ulist);
65+
int btrfs_is_data_extent_shared(struct btrfs_root *root, u64 inum, u64 bytenr,
66+
struct ulist *roots, struct ulist *tmp);
6767

6868
int __init btrfs_prelim_ref_init(void);
6969
void __cold btrfs_prelim_ref_exit(void);

fs/btrfs/extent_io.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -5585,8 +5585,9 @@ int extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
55855585
* then we're just getting a count and we can skip the
55865586
* lookup stuff.
55875587
*/
5588-
ret = btrfs_check_shared(root, btrfs_ino(inode),
5589-
bytenr, roots, tmp_ulist);
5588+
ret = btrfs_is_data_extent_shared(root, btrfs_ino(inode),
5589+
bytenr, roots,
5590+
tmp_ulist);
55905591
if (ret < 0)
55915592
goto out_free;
55925593
if (ret)

0 commit comments

Comments
 (0)