Skip to content

Commit 6308bc9

Browse files
olgakorn1J. Bruce Fields
authored andcommitted
NFSD OFFLOAD_STATUS xdr
Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 9eb190f commit 6308bc9

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,13 @@ nfsd4_fallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
11441144
fput(file);
11451145
return status;
11461146
}
1147+
static __be32
1148+
nfsd4_offload_status(struct svc_rqst *rqstp,
1149+
struct nfsd4_compound_state *cstate,
1150+
union nfsd4_op_u *u)
1151+
{
1152+
return nfserr_notsupp;
1153+
}
11471154

11481155
static __be32
11491156
nfsd4_allocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
@@ -2047,6 +2054,14 @@ static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
20472054
1 /* cr_synchronous */) * sizeof(__be32);
20482055
}
20492056

2057+
static inline u32 nfsd4_offload_status_rsize(struct svc_rqst *rqstp,
2058+
struct nfsd4_op *op)
2059+
{
2060+
return (op_encode_hdr_size +
2061+
2 /* osr_count */ +
2062+
1 /* osr_complete<1> optional 0 for now */) * sizeof(__be32);
2063+
}
2064+
20502065
#ifdef CONFIG_NFSD_PNFS
20512066
static inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
20522067
{
@@ -2460,6 +2475,11 @@ static const struct nfsd4_operation nfsd4_ops[] = {
24602475
.op_name = "OP_SEEK",
24612476
.op_rsize_bop = nfsd4_seek_rsize,
24622477
},
2478+
[OP_OFFLOAD_STATUS] = {
2479+
.op_func = nfsd4_offload_status,
2480+
.op_name = "OP_OFFLOAD_STATUS",
2481+
.op_rsize_bop = nfsd4_offload_status_rsize,
2482+
},
24632483
};
24642484

24652485
/**

fs/nfsd/nfs4xdr.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,13 @@ nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy)
17671767
DECODE_TAIL;
17681768
}
17691769

1770+
static __be32
1771+
nfsd4_decode_offload_status(struct nfsd4_compoundargs *argp,
1772+
struct nfsd4_offload_status *os)
1773+
{
1774+
return nfsd4_decode_stateid(argp, &os->stateid);
1775+
}
1776+
17701777
static __be32
17711778
nfsd4_decode_seek(struct nfsd4_compoundargs *argp, struct nfsd4_seek *seek)
17721779
{
@@ -1874,7 +1881,7 @@ static const nfsd4_dec nfsd4_dec_ops[] = {
18741881
[OP_LAYOUTERROR] = (nfsd4_dec)nfsd4_decode_notsupp,
18751882
[OP_LAYOUTSTATS] = (nfsd4_dec)nfsd4_decode_notsupp,
18761883
[OP_OFFLOAD_CANCEL] = (nfsd4_dec)nfsd4_decode_notsupp,
1877-
[OP_OFFLOAD_STATUS] = (nfsd4_dec)nfsd4_decode_notsupp,
1884+
[OP_OFFLOAD_STATUS] = (nfsd4_dec)nfsd4_decode_offload_status,
18781885
[OP_READ_PLUS] = (nfsd4_dec)nfsd4_decode_notsupp,
18791886
[OP_SEEK] = (nfsd4_dec)nfsd4_decode_seek,
18801887
[OP_WRITE_SAME] = (nfsd4_dec)nfsd4_decode_notsupp,
@@ -4256,6 +4263,22 @@ nfsd4_encode_copy(struct nfsd4_compoundres *resp, __be32 nfserr,
42564263
return 0;
42574264
}
42584265

4266+
static __be32
4267+
nfsd4_encode_offload_status(struct nfsd4_compoundres *resp, __be32 nfserr,
4268+
struct nfsd4_offload_status *os)
4269+
{
4270+
struct xdr_stream *xdr = &resp->xdr;
4271+
__be32 *p;
4272+
4273+
p = xdr_reserve_space(xdr, 8 + 4);
4274+
if (!p)
4275+
return nfserr_resource;
4276+
p = xdr_encode_hyper(p, os->count);
4277+
*p++ = cpu_to_be32(0);
4278+
4279+
return nfserr;
4280+
}
4281+
42594282
static __be32
42604283
nfsd4_encode_seek(struct nfsd4_compoundres *resp, __be32 nfserr,
42614284
struct nfsd4_seek *seek)
@@ -4359,7 +4382,7 @@ static const nfsd4_enc nfsd4_enc_ops[] = {
43594382
[OP_LAYOUTERROR] = (nfsd4_enc)nfsd4_encode_noop,
43604383
[OP_LAYOUTSTATS] = (nfsd4_enc)nfsd4_encode_noop,
43614384
[OP_OFFLOAD_CANCEL] = (nfsd4_enc)nfsd4_encode_noop,
4362-
[OP_OFFLOAD_STATUS] = (nfsd4_enc)nfsd4_encode_noop,
4385+
[OP_OFFLOAD_STATUS] = (nfsd4_enc)nfsd4_encode_offload_status,
43634386
[OP_READ_PLUS] = (nfsd4_enc)nfsd4_encode_noop,
43644387
[OP_SEEK] = (nfsd4_enc)nfsd4_encode_seek,
43654388
[OP_WRITE_SAME] = (nfsd4_enc)nfsd4_encode_noop,

fs/nfsd/xdr4.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,15 @@ struct nfsd4_seek {
545545
loff_t seek_pos;
546546
};
547547

548+
struct nfsd4_offload_status {
549+
/* request */
550+
stateid_t stateid;
551+
552+
/* response */
553+
u64 count;
554+
u32 status;
555+
};
556+
548557
struct nfsd4_op {
549558
int opnum;
550559
const struct nfsd4_operation * opdesc;
@@ -603,6 +612,7 @@ struct nfsd4_op {
603612
struct nfsd4_fallocate deallocate;
604613
struct nfsd4_clone clone;
605614
struct nfsd4_copy copy;
615+
struct nfsd4_offload_status offload_status;
606616
struct nfsd4_seek seek;
607617
} u;
608618
struct nfs4_replay * replay;

0 commit comments

Comments
 (0)