Message ID | 1600255152-16086-9-git-send-email-kaixuxia@tencent.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xfs: cleanup the useless backslash in xfs_attr_leaf_entsize_remote | expand |
On Wed, Sep 16, 2020 at 07:19:11PM +0800, xiakaixu1987@gmail.com wrote: > From: Kaixu Xia <kaixuxia@tencent.com> > > The backslash is useless and remove it. > > Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> > --- > fs/xfs/libxfs/xfs_da_format.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h > index b40a4e80f5ee..4fe974773d85 100644 > --- a/fs/xfs/libxfs/xfs_da_format.h > +++ b/fs/xfs/libxfs/xfs_da_format.h > @@ -746,7 +746,7 @@ xfs_attr3_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) > */ > static inline int xfs_attr_leaf_entsize_remote(int nlen) > { > - return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ > + return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + > XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); If you're going to go mess with these, you might as well clean up the typedef usage, the unnecessary parentheses, and the open-coded round_up call: static inline int xfs_attr_leaf_entsize_remote(int nlen) { return round_up(sizeof(struct xfs_attr_leaf_name_remote) - 1 + nlen, XFS_ATTR_LEAF_NAME_ALIGN); } (and similar for xfs_attr_leaf_entsize_local().) --D > } > > -- > 2.20.0 >
On 2020/9/17 2:50, Darrick J. Wong wrote: > On Wed, Sep 16, 2020 at 07:19:11PM +0800, xiakaixu1987@gmail.com wrote: >> From: Kaixu Xia <kaixuxia@tencent.com> >> >> The backslash is useless and remove it. >> >> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> >> --- >> fs/xfs/libxfs/xfs_da_format.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h >> index b40a4e80f5ee..4fe974773d85 100644 >> --- a/fs/xfs/libxfs/xfs_da_format.h >> +++ b/fs/xfs/libxfs/xfs_da_format.h >> @@ -746,7 +746,7 @@ xfs_attr3_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) >> */ >> static inline int xfs_attr_leaf_entsize_remote(int nlen) >> { >> - return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ >> + return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + >> XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); > > If you're going to go mess with these, you might as well clean up the > typedef usage, the unnecessary parentheses, and the open-coded round_up > call: > > static inline int xfs_attr_leaf_entsize_remote(int nlen) > { > return round_up(sizeof(struct xfs_attr_leaf_name_remote) - 1 + nlen, > XFS_ATTR_LEAF_NAME_ALIGN); > } > > (and similar for xfs_attr_leaf_entsize_local().) > Okay, will do these code cleanups in the next version:) Thanks, Kaixu > --D > >> } >> >> -- >> 2.20.0 >>
diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h index b40a4e80f5ee..4fe974773d85 100644 --- a/fs/xfs/libxfs/xfs_da_format.h +++ b/fs/xfs/libxfs/xfs_da_format.h @@ -746,7 +746,7 @@ xfs_attr3_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) */ static inline int xfs_attr_leaf_entsize_remote(int nlen) { - return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ + return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); }