[PATCH] pnfsd: provide helper for xdr encoding of deviceid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxx>
---
 fs/exportfs/nfs4filelayoutxdr.c |    3 +--
 fs/nfsd/nfs4callback.c          |    3 +--
 fs/nfsd/nfs4xdr.c               |    2 +-
 include/linux/nfsd/nfsd4_pnfs.h |    7 +++++++
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/fs/exportfs/nfs4filelayoutxdr.c b/fs/exportfs/nfs4filelayoutxdr.c
index f63c311..e5b9a92 100644
--- a/fs/exportfs/nfs4filelayoutxdr.c
+++ b/fs/exportfs/nfs4filelayoutxdr.c
@@ -174,8 +174,7 @@ enum nfsstat4
 	p++;
 
 	/* encode device id */
-	p = exp_xdr_encode_u64(p, flp->device_id.sbid);
-	p = exp_xdr_encode_u64(p, flp->device_id.devid);
+	p = nfsd4_encode_deviceid(p, &flp->device_id);
 
 	/* set and encode flags */
 	nfl_util = flp->lg_stripe_unit;
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 8734ef0..0a37f3a 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -511,8 +511,7 @@ static void encode_cb_device4args(struct xdr_stream *xdr,
 		else
 			*p++ = cpu_to_be32(20);
 		*p++ = cpu_to_be32(cbd[i].cbd_layout_type);
-		p = xdr_encode_hyper(p, cbd[i].cbd_devid.sbid);
-		xdr_encode_hyper(p, cbd[i].cbd_devid.devid);
+		p = nfsd4_encode_deviceid(p, &cbd[i].cbd_devid);
 
 		if (cbd[i].cbd_notify_type == NOTIFY_DEVICEID4_CHANGE) {
 			p = xdr_reserve_space(xdr, 4);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d57ccb1..ee227f7 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3641,7 +3641,7 @@ static __be32 nfsd4_encode_bind_conn_to_session(struct nfsd4_compoundres *resp,
 
 		/* Encode device id and layout type */
 		RESERVE_SPACE(sizeof(struct nfsd4_pnfs_deviceid));
-		WRITE64((__be64)sbid);
+		WRITE64(sbid);
 		WRITE64(res.gd_devid);	/* devid minor */
 		ADJUST_ARGS();
 		(*dev_count)++;
diff --git a/include/linux/nfsd/nfsd4_pnfs.h b/include/linux/nfsd/nfsd4_pnfs.h
index d5195b6..8d3d384 100644
--- a/include/linux/nfsd/nfsd4_pnfs.h
+++ b/include/linux/nfsd/nfsd4_pnfs.h
@@ -44,6 +44,13 @@ struct nfsd4_pnfs_deviceid {
 	u64	devid;			/* filesystem-wide unique device ID */
 };
 
+static inline __be32 *nfsd4_encode_deviceid(__be32 *p,
+					const struct nfsd4_pnfs_deviceid *dp)
+{
+        p = exp_xdr_encode_u64(p, dp->sbid);
+        return exp_xdr_encode_u64(p, dp->devid);
+}
+
 struct nfsd4_pnfs_dev_iter_res {
 	u64		gd_cookie;	/* request/repsonse */
 	u64		gd_verf;	/* request/repsonse */
-- 
1.7.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux