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 4/7] nfsd: support multiple pNFS device IDs
Date: Mon, 23 Mar 2026 08:07:20 +0100 [thread overview]
Message-ID: <20260323070746.2940140-5-hch@lst.de> (raw)
In-Reply-To: <20260323070746.2940140-1-hch@lst.de>
Add support for a device index in the device ID so that we can support
multiple different devices and not just different generations when
the devids are refreshed. This will be used for block layout exports
of multi-device file systems.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/nfsd/blocklayout.c | 2 +-
fs/nfsd/flexfilelayout.c | 3 +--
fs/nfsd/nfs4layouts.c | 3 ++-
fs/nfsd/pnfs.h | 2 +-
fs/nfsd/xdr4.h | 5 +++--
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index 0dd36f3d5a51..8ca8fd8f70cb 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -75,7 +75,7 @@ nfsd4_block_map_extent(struct inode *inode, const struct svc_fh *fhp,
return nfserr_layoutunavailable;
}
- error = nfsd4_set_deviceid(&bex->vol_id, fhp, device_generation);
+ error = nfsd4_set_deviceid(&bex->vol_id, fhp, 0, device_generation);
if (error)
return nfserrno(error);
diff --git a/fs/nfsd/flexfilelayout.c b/fs/nfsd/flexfilelayout.c
index 6d531285ab43..b57db4b4dda7 100644
--- a/fs/nfsd/flexfilelayout.c
+++ b/fs/nfsd/flexfilelayout.c
@@ -24,7 +24,6 @@ nfsd4_ff_proc_layoutget(struct svc_rqst *rqstp, struct inode *inode,
const struct svc_fh *fhp, struct nfsd4_layoutget *args)
{
struct nfsd4_layout_seg *seg = &args->lg_seg;
- u32 device_generation = 0;
int error;
uid_t u;
@@ -57,7 +56,7 @@ nfsd4_ff_proc_layoutget(struct svc_rqst *rqstp, struct inode *inode,
fl->uid = inode->i_uid;
fl->gid = inode->i_gid;
- error = nfsd4_set_deviceid(&fl->deviceid, fhp, device_generation);
+ error = nfsd4_set_deviceid(&fl->deviceid, fhp, 0, 0);
if (error)
goto out_error;
diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 7b849b637b5e..ace6057f5d63 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -110,7 +110,7 @@ nfsd4_find_devid_map(int idx)
int
nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
- u32 device_generation)
+ u32 dev_idx, u32 device_generation)
{
if (!fhp->fh_export->ex_devid_map) {
nfsd4_alloc_devid_map(fhp);
@@ -120,6 +120,7 @@ nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
id->fsid_idx = fhp->fh_export->ex_devid_map->idx;
id->generation = device_generation;
+ id->dev_idx = dev_idx;
return 0;
}
diff --git a/fs/nfsd/pnfs.h b/fs/nfsd/pnfs.h
index db9af780438b..4a6b0ad2ec9b 100644
--- a/fs/nfsd/pnfs.h
+++ b/fs/nfsd/pnfs.h
@@ -65,7 +65,7 @@ __be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate,
struct nfsd4_layoutreturn *lrp);
int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
- u32 device_generation);
+ u32 dev_idx, u32 device_generation);
struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
#endif /* CONFIG_NFSD_V4 */
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 417e9ad9fbb3..ddeba134b9af 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -602,6 +602,7 @@ struct nfsd4_reclaim_complete {
struct nfsd4_deviceid {
u64 fsid_idx;
u32 generation;
+ u32 dev_idx;
};
static inline __be32 *
@@ -612,7 +613,7 @@ svcxdr_encode_deviceid4(__be32 *p, const struct nfsd4_deviceid *devid)
*q = (__force __be64)devid->fsid_idx;
p += 2;
*p++ = (__force __be32)devid->generation;
- *p++ = xdr_zero;
+ *p++ = (__force __be32)devid->dev_idx;
return p;
}
@@ -624,7 +625,7 @@ svcxdr_decode_deviceid4(__be32 *p, struct nfsd4_deviceid *devid)
devid->fsid_idx = (__force u64)(*q);
p += 2;
devid->generation = (__force u32)(*p++);
- p++; /* NFSD does not use the remaining octets */
+ devid->dev_idx = (__force u32)(*p++);
return p;
}
--
2.47.3
next prev 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 ` Christoph Hellwig [this message]
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 ` [PATCH 6/7] exportfs: return a device index from ->map_blocks Christoph Hellwig
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-5-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