Message ID | 20200510072404.986627-3-hch@lst.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/6] xfs: use XFS_IFORK_BOFF xchk_bmap_check_rmaps | expand |
On Sunday 10 May 2020 12:54:00 PM IST Christoph Hellwig wrote: > Just checking di_forkoff directly is a little easier to follow. > Looks good to me. Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > fs/xfs/libxfs/xfs_format.h | 5 ++--- > fs/xfs/libxfs/xfs_inode_buf.c | 6 +++--- > 2 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h > index 045556e78ee2c..3cc352000b8a1 100644 > --- a/fs/xfs/libxfs/xfs_format.h > +++ b/fs/xfs/libxfs/xfs_format.h > @@ -964,13 +964,12 @@ enum xfs_dinode_fmt { > /* > * Inode data & attribute fork sizes, per inode. > */ > -#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0) > #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3)) > > #define XFS_DFORK_DSIZE(dip,mp) \ > - (XFS_DFORK_Q(dip) ? XFS_DFORK_BOFF(dip) : XFS_LITINO(mp)) > + ((dip)->di_forkoff ? XFS_DFORK_BOFF(dip) : XFS_LITINO(mp)) > #define XFS_DFORK_ASIZE(dip,mp) \ > - (XFS_DFORK_Q(dip) ? XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : 0) > + ((dip)->di_forkoff ? XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : 0) > #define XFS_DFORK_SIZE(dip,mp,w) \ > ((w) == XFS_DATA_FORK ? \ > XFS_DFORK_DSIZE(dip, mp) : \ > diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c > index 05f939adea944..5547bbb3cf945 100644 > --- a/fs/xfs/libxfs/xfs_inode_buf.c > +++ b/fs/xfs/libxfs/xfs_inode_buf.c > @@ -265,7 +265,7 @@ xfs_inode_from_disk( > error = xfs_iformat_data_fork(ip, from); > if (error) > return error; > - if (XFS_DFORK_Q(from)) { > + if (from->di_forkoff) { > error = xfs_iformat_attr_fork(ip, from); > if (error) > goto out_destroy_data_fork; > @@ -435,7 +435,7 @@ xfs_dinode_verify_forkoff( > struct xfs_dinode *dip, > struct xfs_mount *mp) > { > - if (!XFS_DFORK_Q(dip)) > + if (!dip->di_forkoff) > return NULL; > > switch (dip->di_format) { > @@ -538,7 +538,7 @@ xfs_dinode_verify( > return __this_address; > } > > - if (XFS_DFORK_Q(dip)) { > + if (dip->di_forkoff) { > fa = xfs_dinode_verify_fork(dip, mp, XFS_ATTR_FORK); > if (fa) > return fa; >
On Sun, May 10, 2020 at 09:24:00AM +0200, Christoph Hellwig wrote: > Just checking di_forkoff directly is a little easier to follow. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- Reviewed-by: Brian Foster <bfoster@redhat.com> > fs/xfs/libxfs/xfs_format.h | 5 ++--- > fs/xfs/libxfs/xfs_inode_buf.c | 6 +++--- > 2 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h > index 045556e78ee2c..3cc352000b8a1 100644 > --- a/fs/xfs/libxfs/xfs_format.h > +++ b/fs/xfs/libxfs/xfs_format.h > @@ -964,13 +964,12 @@ enum xfs_dinode_fmt { > /* > * Inode data & attribute fork sizes, per inode. > */ > -#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0) > #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3)) > > #define XFS_DFORK_DSIZE(dip,mp) \ > - (XFS_DFORK_Q(dip) ? XFS_DFORK_BOFF(dip) : XFS_LITINO(mp)) > + ((dip)->di_forkoff ? XFS_DFORK_BOFF(dip) : XFS_LITINO(mp)) > #define XFS_DFORK_ASIZE(dip,mp) \ > - (XFS_DFORK_Q(dip) ? XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : 0) > + ((dip)->di_forkoff ? XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : 0) > #define XFS_DFORK_SIZE(dip,mp,w) \ > ((w) == XFS_DATA_FORK ? \ > XFS_DFORK_DSIZE(dip, mp) : \ > diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c > index 05f939adea944..5547bbb3cf945 100644 > --- a/fs/xfs/libxfs/xfs_inode_buf.c > +++ b/fs/xfs/libxfs/xfs_inode_buf.c > @@ -265,7 +265,7 @@ xfs_inode_from_disk( > error = xfs_iformat_data_fork(ip, from); > if (error) > return error; > - if (XFS_DFORK_Q(from)) { > + if (from->di_forkoff) { > error = xfs_iformat_attr_fork(ip, from); > if (error) > goto out_destroy_data_fork; > @@ -435,7 +435,7 @@ xfs_dinode_verify_forkoff( > struct xfs_dinode *dip, > struct xfs_mount *mp) > { > - if (!XFS_DFORK_Q(dip)) > + if (!dip->di_forkoff) > return NULL; > > switch (dip->di_format) { > @@ -538,7 +538,7 @@ xfs_dinode_verify( > return __this_address; > } > > - if (XFS_DFORK_Q(dip)) { > + if (dip->di_forkoff) { > fa = xfs_dinode_verify_fork(dip, mp, XFS_ATTR_FORK); > if (fa) > return fa; > -- > 2.26.2 >
On Sun, May 10, 2020 at 09:24:00AM +0200, Christoph Hellwig wrote: > Just checking di_forkoff directly is a little easier to follow. > > Signed-off-by: Christoph Hellwig <hch@lst.de> /me hates macros Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> --D > --- > fs/xfs/libxfs/xfs_format.h | 5 ++--- > fs/xfs/libxfs/xfs_inode_buf.c | 6 +++--- > 2 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h > index 045556e78ee2c..3cc352000b8a1 100644 > --- a/fs/xfs/libxfs/xfs_format.h > +++ b/fs/xfs/libxfs/xfs_format.h > @@ -964,13 +964,12 @@ enum xfs_dinode_fmt { > /* > * Inode data & attribute fork sizes, per inode. > */ > -#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0) > #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3)) > > #define XFS_DFORK_DSIZE(dip,mp) \ > - (XFS_DFORK_Q(dip) ? XFS_DFORK_BOFF(dip) : XFS_LITINO(mp)) > + ((dip)->di_forkoff ? XFS_DFORK_BOFF(dip) : XFS_LITINO(mp)) > #define XFS_DFORK_ASIZE(dip,mp) \ > - (XFS_DFORK_Q(dip) ? XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : 0) > + ((dip)->di_forkoff ? XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : 0) > #define XFS_DFORK_SIZE(dip,mp,w) \ > ((w) == XFS_DATA_FORK ? \ > XFS_DFORK_DSIZE(dip, mp) : \ > diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c > index 05f939adea944..5547bbb3cf945 100644 > --- a/fs/xfs/libxfs/xfs_inode_buf.c > +++ b/fs/xfs/libxfs/xfs_inode_buf.c > @@ -265,7 +265,7 @@ xfs_inode_from_disk( > error = xfs_iformat_data_fork(ip, from); > if (error) > return error; > - if (XFS_DFORK_Q(from)) { > + if (from->di_forkoff) { > error = xfs_iformat_attr_fork(ip, from); > if (error) > goto out_destroy_data_fork; > @@ -435,7 +435,7 @@ xfs_dinode_verify_forkoff( > struct xfs_dinode *dip, > struct xfs_mount *mp) > { > - if (!XFS_DFORK_Q(dip)) > + if (!dip->di_forkoff) > return NULL; > > switch (dip->di_format) { > @@ -538,7 +538,7 @@ xfs_dinode_verify( > return __this_address; > } > > - if (XFS_DFORK_Q(dip)) { > + if (dip->di_forkoff) { > fa = xfs_dinode_verify_fork(dip, mp, XFS_ATTR_FORK); > if (fa) > return fa; > -- > 2.26.2 >
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 045556e78ee2c..3cc352000b8a1 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -964,13 +964,12 @@ enum xfs_dinode_fmt { /* * Inode data & attribute fork sizes, per inode. */ -#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0) #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3)) #define XFS_DFORK_DSIZE(dip,mp) \ - (XFS_DFORK_Q(dip) ? XFS_DFORK_BOFF(dip) : XFS_LITINO(mp)) + ((dip)->di_forkoff ? XFS_DFORK_BOFF(dip) : XFS_LITINO(mp)) #define XFS_DFORK_ASIZE(dip,mp) \ - (XFS_DFORK_Q(dip) ? XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : 0) + ((dip)->di_forkoff ? XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : 0) #define XFS_DFORK_SIZE(dip,mp,w) \ ((w) == XFS_DATA_FORK ? \ XFS_DFORK_DSIZE(dip, mp) : \ diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index 05f939adea944..5547bbb3cf945 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c @@ -265,7 +265,7 @@ xfs_inode_from_disk( error = xfs_iformat_data_fork(ip, from); if (error) return error; - if (XFS_DFORK_Q(from)) { + if (from->di_forkoff) { error = xfs_iformat_attr_fork(ip, from); if (error) goto out_destroy_data_fork; @@ -435,7 +435,7 @@ xfs_dinode_verify_forkoff( struct xfs_dinode *dip, struct xfs_mount *mp) { - if (!XFS_DFORK_Q(dip)) + if (!dip->di_forkoff) return NULL; switch (dip->di_format) { @@ -538,7 +538,7 @@ xfs_dinode_verify( return __this_address; } - if (XFS_DFORK_Q(dip)) { + if (dip->di_forkoff) { fa = xfs_dinode_verify_fork(dip, mp, XFS_ATTR_FORK); if (fa) return fa;
Just checking di_forkoff directly is a little easier to follow. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/libxfs/xfs_format.h | 5 ++--- fs/xfs/libxfs/xfs_inode_buf.c | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-)