public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: Chandan Babu R <chandanrlinux@gmail.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/6] xfs: use XFS_IFORK_BOFF xchk_bmap_check_rmaps
Date: Tue, 12 May 2020 08:38:54 -0700	[thread overview]
Message-ID: <20200512153854.GC6714@magnolia> (raw)
In-Reply-To: <20200512153132.GE37029@bfoster>

On Tue, May 12, 2020 at 11:31:32AM -0400, Brian Foster wrote:
> On Mon, May 11, 2020 at 05:10:04PM +0530, Chandan Babu R wrote:
> > On Sunday 10 May 2020 12:53:59 PM IST Christoph Hellwig wrote:
> > > XFS_IFORK_Q is to be used in boolean context, not for a size.  This
> > > doesn't make a difference in practice as size is only checked for
> > > 0, but this keeps the logic sane.
> > >
> > 
> > Wouldn't XFS_IFORK_ASIZE() be a better fit since it gives the space used by the
> > attr fork inside an inode's literal area?
> > 
> 
> I had the same thought. It's not clear to me what size is really
> supposed to be between the file size for a data fork and fork offset for
> the attr fork. I was also wondering if this should use
> XFS_IFORK_DSIZE(), but that won't be conditional based on population of
> the fork. At the same time, I don't think i_size != 0 necessarily
> correlates with the existence of blocks. The file could be completely
> sparse or could have any number of post-eof preallocated extents.

TBH I should have made that variable "bool empty" or something.

case XFS_DATA_FORK:
	empty = i_size_read() == 0;

case XFS_ATTR_FORK:
	empty = !XFS_IFORK_Q();

default:
	empty = true;

if ((is not btree) && (empty || nextents > 0))
	return 0;

--D

> Brian
> 
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > > ---
> > >  fs/xfs/scrub/bmap.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
> > > index add8598eacd5d..283424d6d2bb6 100644
> > > --- a/fs/xfs/scrub/bmap.c
> > > +++ b/fs/xfs/scrub/bmap.c
> > > @@ -591,7 +591,7 @@ xchk_bmap_check_rmaps(
> > >  		size = i_size_read(VFS_I(sc->ip));
> > >  		break;
> > >  	case XFS_ATTR_FORK:
> > > -		size = XFS_IFORK_Q(sc->ip);
> > > +		size = XFS_IFORK_BOFF(sc->ip);
> > >  		break;
> > >  	default:
> > >  		size = 0;
> > > 
> > 
> > 
> > -- 
> > chandan
> > 
> > 
> > 
> 

  reply	other threads:[~2020-05-12 15:39 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-10  7:23 move the extent count and format into struct xfs_ifork Christoph Hellwig
2020-05-10  7:23 ` [PATCH 1/6] xfs: use XFS_IFORK_BOFF xchk_bmap_check_rmaps Christoph Hellwig
2020-05-11 11:40   ` Chandan Babu R
2020-05-12 15:31     ` Brian Foster
2020-05-12 15:38       ` Darrick J. Wong [this message]
2020-05-12 16:14         ` Brian Foster
2020-05-12 19:16           ` Darrick J. Wong
2020-05-13 13:19             ` Brian Foster
2020-05-13 13:21               ` Christoph Hellwig
2020-05-16 18:42   ` [PATCH] xfs: clean up xchk_bmap_check_rmaps usage of XFS_IFORK_Q Darrick J. Wong
2020-05-16 20:01     ` Christoph Hellwig
2020-05-17  8:05       ` Christoph Hellwig
2020-05-10  7:24 ` [PATCH 2/6] xfs: remove the XFS_DFORK_Q macro Christoph Hellwig
2020-05-11 12:39   ` Chandan Babu R
2020-05-12 15:31   ` Brian Foster
2020-05-16 18:02   ` Darrick J. Wong
2020-05-10  7:24 ` [PATCH 3/6] xfs: remove xfs_ifree_local_data Christoph Hellwig
2020-05-11 16:32   ` Chandan Babu R
2020-05-12 15:31   ` Brian Foster
2020-05-16 18:07   ` Darrick J. Wong
2022-07-24 12:14     ` Alex Lyakas
2020-05-10  7:24 ` [PATCH 4/6] xfs: move the per-fork nextents fields into struct xfs_ifork Christoph Hellwig
2020-05-12  5:26   ` Chandan Babu R
2020-05-12 16:10   ` Brian Foster
2020-05-16 18:09     ` Darrick J. Wong
2020-05-17  8:12     ` Christoph Hellwig
2020-05-10  7:24 ` [PATCH 5/6] xfs: move the fork format " Christoph Hellwig
2020-05-12  9:37   ` Chandan Babu R
2020-05-12 18:53   ` Brian Foster
2020-05-14 21:25   ` Darrick J. Wong
2020-05-16 13:58     ` Christoph Hellwig
2020-05-16 17:01       ` Darrick J. Wong
2020-05-16 18:01         ` Darrick J. Wong
2020-05-16 18:16           ` Christoph Hellwig
2020-05-16 18:29             ` Darrick J. Wong
2020-05-10  7:24 ` [PATCH 6/6] xfs: cleanup xfs_idestroy_fork Christoph Hellwig
2020-05-12  9:48   ` Chandan Babu R
2020-05-12 18:54   ` Brian Foster
2020-05-16 18:10     ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512153854.GC6714@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=chandanrlinux@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox