Message ID | 4a8d8601602d7ceef622286c259bc4c11d7e3585.1701762681.git.wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: fix mismatching parameter names for btrfs_get_extent() | expand |
On Tue, Dec 05, 2023 at 06:21:29PM +1030, Qu Wenruo wrote: > The definition for btrfs_get_extent() is using "u64 end" as the last > parameter, but in implementation we go "u64 len", and all call sites > follows the implementation. > > This can be very confusing during development, as most developers > including me, would just use the snippet returned by LSP (clangd in my > case), which would only check the definition. It's possible that there are more mismatches, this is clearly a job for some tool. > Unfortunately this mismatch is introduced from the very beginning of > btrfs. > > Fix it to prevent further confusion. > > Signed-off-by: Qu Wenruo <wqu@suse.com> Added to misc-next, thanks.
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 5572ae52444e..9feb7e96d85a 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -487,7 +487,7 @@ struct inode *btrfs_iget_path(struct super_block *s, u64 ino, struct inode *btrfs_iget(struct super_block *s, u64 ino, struct btrfs_root *root); struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, struct page *page, size_t pg_offset, - u64 start, u64 end); + u64 start, u64 len); int btrfs_update_inode(struct btrfs_trans_handle *trans, struct btrfs_inode *inode); int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
The definition for btrfs_get_extent() is using "u64 end" as the last parameter, but in implementation we go "u64 len", and all call sites follows the implementation. This can be very confusing during development, as most developers including me, would just use the snippet returned by LSP (clangd in my case), which would only check the definition. Unfortunately this mismatch is introduced from the very beginning of btrfs. Fix it to prevent further confusion. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/btrfs_inode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)