From: Christoph Hellwig <hch@lst.de>
To: daejun7.park@samsung.com
Cc: Chuck Lever <cel@kernel.org>, Jeff Layton <jlayton@kernel.org>,
NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Christoph Hellwig <hch@lst.de>, Carlos Maiolino <cem@kernel.org>,
Amir Goldstein <amir73il@gmail.com>,
"Darrick J. Wong" <djwong@kernel.org>,
Dave Chinner <dgc@kernel.org>,
Sergey Bashirov <sergeybashirov@gmail.com>,
Christian Brauner <brauner@kernel.org>,
linux-nfs@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] xfs: factor the mapping of one pNFS extent out of xfs_fs_map_blocks()
Date: Tue, 1 Dec 2026 09:17:28 +0100 [thread overview]
Message-ID: <20261201081728.GB26856@lst.de> (raw)
In-Reply-To: <20261126-xfs-nfsd-map-blocks-v2-1-6d85b1388739@samsung.com>
> + * can change in between, so a mapping that reaches back can overlap
> + * one already in the layout. Don't extend the mapping past EOF
> + * beyond the range either: xfs_free_eofblocks() can free blocks past
> + * EOF without breaking the layout.
> + */
> + error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb,
> + imap, &nimaps, XFS_BMAPI_ENTIRE);
> + if (error) {
> + xfs_iunlock(ip, lock_flags);
> + return error;
> + }
> + if (nimaps)
> + xfs_trim_extent(imap, offset_fsb,
> + max_t(xfs_fileoff_t, end_fsb,
> + XFS_B_TO_FSB(mp, XFS_ISIZE(ip))) -
> + offset_fsb);
nimaps must be non-NULL here (I should have spotted that in your
original patch adding the check).
> + *seq = xfs_iomap_inode_sequence(ip, 0);
> +
> + ASSERT(!nimaps || imap->br_startblock != DELAYSTARTBLOCK);
Or the very original addition. IIRC we used to have a corner case
where 0 nimaps with a 0 return value could happen, but we fied that a long
time ago.
> +
> + if (!write || (nimaps && imap->br_startblock != HOLESTARTBLOCK)) {
> + xfs_iunlock(ip, lock_flags);
> + return 0;
> + }
> +
> + if (end > XFS_ISIZE(ip))
> + end_fsb = xfs_iomap_eof_align_last_fsb(ip, end_fsb);
> + else if (nimaps)
> + end_fsb = min(end_fsb, imap->br_startoff + imap->br_blockcount);
> + xfs_iunlock(ip, lock_flags);
> +
> + error = xfs_iomap_write_direct(ip, offset_fsb, end_fsb - offset_fsb, 0,
> + imap, seq);
> + if (error)
> + return error;
> + *update_inode = true;
Maybe keep the original flow here that leaves the alloction is the more
exceptional path in the branch?
> + error = xfs_fs_map_extent(ip, XFS_B_TO_FSBT(mp, offset),
> + offset + length, write, &imap, &seq, &update_inode);
Passing the offset as FSB and the end as bytes is a bit odd. I'll
see if there is a good reason for that in the next patch, but in doubt
we should avoid this if possible.
next prev parent reply other threads:[~2026-12-01 8:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 1:52 [PATCH v2 0/2] exportfs, xfs, nfsd: map a whole pNFS block layout in one ->map_blocks call Daejun Park via B4 Relay
2026-11-26 1:52 ` [PATCH v2 1/2] xfs: factor the mapping of one pNFS extent out of xfs_fs_map_blocks() Daejun Park via B4 Relay
2026-12-01 8:17 ` Christoph Hellwig [this message]
2026-11-26 1:52 ` [PATCH v2 2/2] exportfs, xfs, nfsd: map a whole pNFS block layout in one ->map_blocks call Daejun Park via B4 Relay
2026-12-01 8:24 ` Christoph Hellwig
2026-12-01 8:21 ` [PATCH v2 0/2] " Christoph Hellwig
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=20261201081728.GB26856@lst.de \
--to=hch@lst.de \
--cc=Dai.Ngo@oracle.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=cel@kernel.org \
--cc=cem@kernel.org \
--cc=daejun7.park@samsung.com \
--cc=dgc@kernel.org \
--cc=djwong@kernel.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=sergeybashirov@gmail.com \
--cc=tom@talpey.com \
/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