On Tue, Jan 30, 2018 at 03:36:28PM +0800, Qu Wenruo wrote: > On 2018年01月26日 15:26, Gu Jinxiang wrote: > > In function leaf_data_end, root is just used to get fs_info, > > so change the parameter of this function from btrfs_root to > > btrfs_fs_info. > > And also make it consistent with kernel. > > > > Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> > > --- > > ctree.c | 32 +++++++++++++++++--------------- > > 1 file changed, 17 insertions(+), 15 deletions(-) > > > > diff --git a/ctree.c b/ctree.c > > index 11d207e7..2417483d 100644 > > --- a/ctree.c > > +++ b/ctree.c > > @@ -410,12 +410,12 @@ static int btrfs_comp_keys(struct btrfs_disk_key > > *disk, struct btrfs_key *k2) > > * this returns the address of the start of the last item, > > * which is the stop of the leaf data stack > > */ > > -static inline unsigned int leaf_data_end(struct btrfs_root *root, > > - struct extent_buffer *leaf) > > +static inline unsigned int leaf_data_end(const struct btrfs_fs_info > > *fs_info, > > + const struct extent_buffer *leaf) > > Here leaf is const, which is fine. > > > { > > u32 nr = btrfs_header_nritems(leaf); > > if (nr == 0) > > - return BTRFS_LEAF_DATA_SIZE(root->fs_info); > > + return BTRFS_LEAF_DATA_SIZE(fs_info); > > return btrfs_item_offset_nr(leaf, nr - 1); > > But btrfs_item_offset_nr() doesn't have const prefix for leaf. > Leaving the following warning: > > passing argument 1 of ‘btrfs_item_offset_nr’ discards ‘const’ qualifier > from pointer target type [-Wdiscarded-qualifiers] > return btrfs_item_offset_nr(leaf, nr - 1); > ^~~~
I don't want to add the warning, so I'll skip this patch for now. The constification of arguments will likely propagate to more helpers so it's not a trivial fix to this patch. Gu Jinxiang, please fix the warning and resend with possibly more preparatory cleanups if necessary. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html