@@ -76,6 +76,17 @@ static __be32 *xdr_encode_empty_array(__be32 *p)
76
76
* 1 Protocol"
77
77
*/
78
78
79
+ static void encode_uint32 (struct xdr_stream * xdr , u32 n )
80
+ {
81
+ WARN_ON_ONCE (xdr_stream_encode_u32 (xdr , n ) < 0 );
82
+ }
83
+
84
+ static void encode_bitmap4 (struct xdr_stream * xdr , const __u32 * bitmap ,
85
+ size_t len )
86
+ {
87
+ WARN_ON_ONCE (xdr_stream_encode_uint32_array (xdr , bitmap , len ) < 0 );
88
+ }
89
+
79
90
/*
80
91
* nfs_cb_opnum4
81
92
*
@@ -328,6 +339,24 @@ static void encode_cb_recall4args(struct xdr_stream *xdr,
328
339
hdr -> nops ++ ;
329
340
}
330
341
342
+ /*
343
+ * CB_RECALLANY4args
344
+ *
345
+ * struct CB_RECALLANY4args {
346
+ * uint32_t craa_objects_to_keep;
347
+ * bitmap4 craa_type_mask;
348
+ * };
349
+ */
350
+ static void
351
+ encode_cb_recallany4args (struct xdr_stream * xdr ,
352
+ struct nfs4_cb_compound_hdr * hdr , struct nfsd4_cb_recall_any * ra )
353
+ {
354
+ encode_nfs_cb_opnum4 (xdr , OP_CB_RECALL_ANY );
355
+ encode_uint32 (xdr , ra -> ra_keep );
356
+ encode_bitmap4 (xdr , ra -> ra_bmval , ARRAY_SIZE (ra -> ra_bmval ));
357
+ hdr -> nops ++ ;
358
+ }
359
+
331
360
/*
332
361
* CB_SEQUENCE4args
333
362
*
@@ -482,6 +511,26 @@ static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr,
482
511
encode_cb_nops (& hdr );
483
512
}
484
513
514
+ /*
515
+ * 20.6. Operation 8: CB_RECALL_ANY - Keep Any N Recallable Objects
516
+ */
517
+ static void
518
+ nfs4_xdr_enc_cb_recall_any (struct rpc_rqst * req ,
519
+ struct xdr_stream * xdr , const void * data )
520
+ {
521
+ const struct nfsd4_callback * cb = data ;
522
+ struct nfsd4_cb_recall_any * ra ;
523
+ struct nfs4_cb_compound_hdr hdr = {
524
+ .ident = cb -> cb_clp -> cl_cb_ident ,
525
+ .minorversion = cb -> cb_clp -> cl_minorversion ,
526
+ };
527
+
528
+ ra = container_of (cb , struct nfsd4_cb_recall_any , ra_cb );
529
+ encode_cb_compound4args (xdr , & hdr );
530
+ encode_cb_sequence4args (xdr , cb , & hdr );
531
+ encode_cb_recallany4args (xdr , & hdr , ra );
532
+ encode_cb_nops (& hdr );
533
+ }
485
534
486
535
/*
487
536
* NFSv4.0 and NFSv4.1 XDR decode functions
@@ -520,6 +569,28 @@ static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp,
520
569
return decode_cb_op_status (xdr , OP_CB_RECALL , & cb -> cb_status );
521
570
}
522
571
572
+ /*
573
+ * 20.6. Operation 8: CB_RECALL_ANY - Keep Any N Recallable Objects
574
+ */
575
+ static int
576
+ nfs4_xdr_dec_cb_recall_any (struct rpc_rqst * rqstp ,
577
+ struct xdr_stream * xdr ,
578
+ void * data )
579
+ {
580
+ struct nfsd4_callback * cb = data ;
581
+ struct nfs4_cb_compound_hdr hdr ;
582
+ int status ;
583
+
584
+ status = decode_cb_compound4res (xdr , & hdr );
585
+ if (unlikely (status ))
586
+ return status ;
587
+ status = decode_cb_sequence4res (xdr , cb );
588
+ if (unlikely (status || cb -> cb_seq_status ))
589
+ return status ;
590
+ status = decode_cb_op_status (xdr , OP_CB_RECALL_ANY , & cb -> cb_status );
591
+ return status ;
592
+ }
593
+
523
594
#ifdef CONFIG_NFSD_PNFS
524
595
/*
525
596
* CB_LAYOUTRECALL4args
@@ -783,6 +854,7 @@ static const struct rpc_procinfo nfs4_cb_procedures[] = {
783
854
#endif
784
855
PROC (CB_NOTIFY_LOCK , COMPOUND , cb_notify_lock , cb_notify_lock ),
785
856
PROC (CB_OFFLOAD , COMPOUND , cb_offload , cb_offload ),
857
+ PROC (CB_RECALL_ANY , COMPOUND , cb_recall_any , cb_recall_any ),
786
858
};
787
859
788
860
static unsigned int nfs4_cb_counts [ARRAY_SIZE (nfs4_cb_procedures )];
0 commit comments