public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chuck Lever <chuck.lever@oracle.com>,
	Jeff Layton <jlayton@kernel.org>,
	Amir Goldstein <amir73il@gmail.com>
Cc: NeilBrown <neil@brown.name>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
	Carlos Maiolino <cem@kernel.org>,
	linux-nfs@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH 6/7] exportfs: return a device index from ->map_blocks
Date: Mon, 23 Mar 2026 08:07:22 +0100	[thread overview]
Message-ID: <20260323070746.2940140-7-hch@lst.de> (raw)
In-Reply-To: <20260323070746.2940140-1-hch@lst.de>

Allow file systems to return a device index from ->map_block that
indicates which device the layout is placed on.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/nfsd/blocklayout.c          | 7 +++++--
 fs/xfs/xfs_pnfs.c              | 3 +++
 include/linux/exportfs_block.h | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index fb13f86f8eb5..636ccefe1959 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -30,10 +30,12 @@ nfsd4_block_map_extent(struct inode *inode, const struct svc_fh *fhp,
 	struct super_block *sb = inode->i_sb;
 	struct iomap iomap;
 	u32 device_generation = 0;
+	u32 dev_idx = 0;
 	int error;
 
 	error = sb->s_export_op->block_ops->map_blocks(inode, offset, length,
-			&iomap, iomode != IOMODE_READ, &device_generation);
+			&iomap, iomode != IOMODE_READ, &dev_idx,
+			&device_generation);
 	if (error) {
 		if (error == -ENXIO)
 			return nfserr_layoutunavailable;
@@ -75,7 +77,8 @@ nfsd4_block_map_extent(struct inode *inode, const struct svc_fh *fhp,
 		return nfserr_layoutunavailable;
 	}
 
-	error = nfsd4_set_deviceid(&bex->vol_id, fhp, 0, device_generation);
+	error = nfsd4_set_deviceid(&bex->vol_id, fhp, dev_idx,
+			device_generation);
 	if (error)
 		return nfserrno(error);
 
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
index acefa0b99f53..7ef5a3f522f6 100644
--- a/fs/xfs/xfs_pnfs.c
+++ b/fs/xfs/xfs_pnfs.c
@@ -123,6 +123,7 @@ xfs_fs_map_blocks(
 	u64			length,
 	struct iomap		*iomap,
 	bool			write,
+	u32			*dev_idx,
 	u32			*device_generation)
 {
 	struct xfs_inode	*ip = XFS_I(inode);
@@ -139,6 +140,8 @@ xfs_fs_map_blocks(
 	if (xfs_is_shutdown(mp))
 		return -EIO;
 
+	*dev_idx = 0;
+
 	/*
 	 * We can't export inodes residing on the realtime device.  The realtime
 	 * device doesn't have a UUID to identify it, so the client has no way
diff --git a/include/linux/exportfs_block.h b/include/linux/exportfs_block.h
index a3f4054784e3..ec2f846c6b08 100644
--- a/include/linux/exportfs_block.h
+++ b/include/linux/exportfs_block.h
@@ -52,7 +52,7 @@ struct exportfs_block_ops {
 	 * If @write is %true, also allocate the blocks for the range if needed.
 	 */
 	int (*map_blocks)(struct inode *inode, loff_t offset, u64 len,
-			struct iomap *iomap, bool write,
+			struct iomap *iomap, bool write, u32 *dev_idx,
 			u32 *device_generation);
 
 	/*
-- 
2.47.3


  parent reply	other threads:[~2026-03-23  7:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23  7:07 support multiple block devices per file system for block-style layouts Christoph Hellwig
2026-03-23  7:07 ` [PATCH 1/7] exportfs: split out the ops for layout-based block device access Christoph Hellwig
2026-03-23 13:39   ` Chuck Lever
2026-03-26  5:33     ` Christoph Hellwig
2026-03-23  7:07 ` [PATCH 2/7] exportfs: don't pass struct iattr to ->commit_blocks Christoph Hellwig
2026-03-23 14:05   ` Chuck Lever
2026-03-26  5:36     ` Christoph Hellwig
2026-03-23  7:07 ` [PATCH 3/7] exportfs,nfsd: rework checking for layout-based block device access support Christoph Hellwig
2026-03-23  7:07 ` [PATCH 4/7] nfsd: support multiple pNFS device IDs Christoph Hellwig
2026-03-23  7:07 ` [PATCH 5/7] nfsd/blocklayout: support GETDEVICEINFO for multiple devices Christoph Hellwig
2026-03-23 13:53   ` Chuck Lever
2026-03-26  5:38     ` Christoph Hellwig
2026-03-26 12:37       ` Chuck Lever
2026-03-23  7:07 ` Christoph Hellwig [this message]
2026-03-23  7:07 ` [PATCH 7/7] xfs: support layout-based block device access on the RT device 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=20260323070746.2940140-7-hch@lst.de \
    --to=hch@lst.de \
    --cc=Dai.Ngo@oracle.com \
    --cc=amir73il@gmail.com \
    --cc=cem@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.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