linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org, chandanrlinux@gmail.com
Subject: Re: [PATCH 2/2] xfs: fix fallocate functions when rtextsize is larger than 1
Date: Fri, 16 Oct 2020 15:02:15 -0700	[thread overview]
Message-ID: <20201016220215.GE9832@magnolia> (raw)
In-Reply-To: <20201015075439.GI14082@lst.de>

On Thu, Oct 15, 2020 at 09:54:39AM +0200, Christoph Hellwig wrote:
> I don't really like the xfs_inode_alloc_blocksize helper, given that
> it is very easy to be confused with the allocsize concept.
> 
> I'd just add a helper ala:
> 
> static bool
> xfs_falloc_is_unaligned(
> 	struct inode		*inode,
> 	loff_t			offset,
> 	loff_t			len)
> {
> 	struct xfs_mount	*mp = XFS_I(ip)->i_mount;
> 
> 	unsigned int blksize_mask = i_blocksize(inode) - 1;
> 
> 	if (XFS_IS_REALTIME_INODE(XFS_I(ip)))
> 		blksize_mask = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize) - 1;

UGH the thing that I just noticed (and fstests doesn't seem to cover
given the number of them that sort of blew up) is the fact that the rt
extent size only has to be some multiple of the fs blocksize, not the
power-of-2 multiple that I mistakenly assumed.

Soooo none of this masking stuff actually works properly and I'm going
to drop this patch until I figure out how to do this properly, with a
bunch of fugly division and whatnot... I guess the silver lining is that
rtextsize can't be larger than 1G so at least I can probably use simple
division and not the div64 mess.

Self NAK.

--D

> 
> 	return (offset & blksize_mask) || (len & blksize_mask);
> }

  reply	other threads:[~2020-10-16 22:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10 17:34 [PATCH 0/2] xfs: hopefully the last few rt fixes Darrick J. Wong
2020-10-10 17:34 ` [PATCH 1/2] xfs: annotate grabbing the realtime bitmap/summary locks in growfs Darrick J. Wong
2020-10-13  7:03   ` Chandan Babu R
2020-10-15  7:48   ` Christoph Hellwig
2020-10-10 17:34 ` [PATCH 2/2] xfs: fix fallocate functions when rtextsize is larger than 1 Darrick J. Wong
2020-10-12  6:28   ` Chandan Babu R
2020-10-15  7:54   ` Christoph Hellwig
2020-10-16 22:02     ` Darrick J. Wong [this message]
2020-10-10 17:50 ` [PATCH 3/2] xfs: test rtalloc alignment and math errors Darrick J. Wong
2020-10-12  8:33   ` Chandan Babu R
2020-10-10 17:50 ` [PATCH 4/2] xfs: test running growfs on the realtime volume Darrick J. Wong
2020-10-12 15:00   ` Chandan Babu R

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=20201016220215.GE9832@magnolia \
    --to=darrick.wong@oracle.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;
as well as URLs for NNTP newsgroup(s).