Commit b0cb9085 authored by Anna Schumaker's avatar Anna Schumaker Committed by J. Bruce Fields

nfsd: Add DEALLOCATE support

DEALLOCATE only returns a status value, meaning we can use the noop()
xdr encoder to reply to the client.
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 95d871f0
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <linux/file.h> #include <linux/file.h>
#include <linux/falloc.h>
#include <linux/slab.h> #include <linux/slab.h>
#include "idmap.h" #include "idmap.h"
...@@ -1043,6 +1044,14 @@ nfsd4_allocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -1043,6 +1044,14 @@ nfsd4_allocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return nfsd4_fallocate(rqstp, cstate, fallocate, 0); return nfsd4_fallocate(rqstp, cstate, fallocate, 0);
} }
static __be32
nfsd4_deallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_fallocate *fallocate)
{
return nfsd4_fallocate(rqstp, cstate, fallocate,
FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE);
}
static __be32 static __be32
nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_seek *seek) struct nfsd4_seek *seek)
...@@ -1965,6 +1974,12 @@ static struct nfsd4_operation nfsd4_ops[] = { ...@@ -1965,6 +1974,12 @@ static struct nfsd4_operation nfsd4_ops[] = {
.op_name = "OP_ALLOCATE", .op_name = "OP_ALLOCATE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize, .op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,
}, },
[OP_DEALLOCATE] = {
.op_func = (nfsd4op_func)nfsd4_deallocate,
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
.op_name = "OP_DEALLOCATE",
.op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,
},
[OP_SEEK] = { [OP_SEEK] = {
.op_func = (nfsd4op_func)nfsd4_seek, .op_func = (nfsd4op_func)nfsd4_seek,
.op_name = "OP_SEEK", .op_name = "OP_SEEK",
......
...@@ -1624,7 +1624,7 @@ static nfsd4_dec nfsd4_dec_ops[] = { ...@@ -1624,7 +1624,7 @@ static nfsd4_dec nfsd4_dec_ops[] = {
[OP_ALLOCATE] = (nfsd4_dec)nfsd4_decode_fallocate, [OP_ALLOCATE] = (nfsd4_dec)nfsd4_decode_fallocate,
[OP_COPY] = (nfsd4_dec)nfsd4_decode_notsupp, [OP_COPY] = (nfsd4_dec)nfsd4_decode_notsupp,
[OP_COPY_NOTIFY] = (nfsd4_dec)nfsd4_decode_notsupp, [OP_COPY_NOTIFY] = (nfsd4_dec)nfsd4_decode_notsupp,
[OP_DEALLOCATE] = (nfsd4_dec)nfsd4_decode_notsupp, [OP_DEALLOCATE] = (nfsd4_dec)nfsd4_decode_fallocate,
[OP_IO_ADVISE] = (nfsd4_dec)nfsd4_decode_notsupp, [OP_IO_ADVISE] = (nfsd4_dec)nfsd4_decode_notsupp,
[OP_LAYOUTERROR] = (nfsd4_dec)nfsd4_decode_notsupp, [OP_LAYOUTERROR] = (nfsd4_dec)nfsd4_decode_notsupp,
[OP_LAYOUTSTATS] = (nfsd4_dec)nfsd4_decode_notsupp, [OP_LAYOUTSTATS] = (nfsd4_dec)nfsd4_decode_notsupp,
......
...@@ -494,6 +494,7 @@ struct nfsd4_op { ...@@ -494,6 +494,7 @@ struct nfsd4_op {
/* NFSv4.2 */ /* NFSv4.2 */
struct nfsd4_fallocate allocate; struct nfsd4_fallocate allocate;
struct nfsd4_fallocate deallocate;
struct nfsd4_seek seek; struct nfsd4_seek seek;
} u; } u;
struct nfs4_replay * replay; struct nfs4_replay * replay;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment