1940
client3_3_fallocate_cbk (struct rpc_req *req, struct iovec *iov, int count,
1943
call_frame_t *frame = NULL;
1944
gfs3_fallocate_rsp rsp = {0,};
1945
struct iatt prestat = {0,};
1946
struct iatt poststat = {0,};
1948
xlator_t *this = NULL;
1949
dict_t *xdata = NULL;
1956
if (-1 == req->rpc_status) {
1958
rsp.op_errno = ENOTCONN;
1961
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fallocate_rsp);
1963
gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
1965
rsp.op_errno = EINVAL;
1969
if (-1 != rsp.op_ret) {
1970
gf_stat_to_iatt (&rsp.statpre, &prestat);
1971
gf_stat_to_iatt (&rsp.statpost, &poststat);
1974
GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
1975
(rsp.xdata.xdata_len), ret,
1979
if (rsp.op_ret == -1) {
1980
gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
1981
strerror (gf_error_to_errno (rsp.op_errno)));
1983
CLIENT_STACK_UNWIND (fallocate, frame, rsp.op_ret,
1984
gf_error_to_errno (rsp.op_errno), &prestat,
1987
free (rsp.xdata.xdata_val);
1996
client3_3_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
1999
call_frame_t *frame = NULL;
2000
gfs3_discard_rsp rsp = {0,};
2001
struct iatt prestat = {0,};
2002
struct iatt poststat = {0,};
2004
xlator_t *this = NULL;
2005
dict_t *xdata = NULL;
2011
if (-1 == req->rpc_status) {
2013
rsp.op_errno = ENOTCONN;
2016
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_discard_rsp);
2018
gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
2020
rsp.op_errno = EINVAL;
2024
if (-1 != rsp.op_ret) {
2025
gf_stat_to_iatt (&rsp.statpre, &prestat);
2026
gf_stat_to_iatt (&rsp.statpost, &poststat);
2029
GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
2030
(rsp.xdata.xdata_len), ret,
2034
if (rsp.op_ret == -1) {
2035
gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
2036
strerror (gf_error_to_errno (rsp.op_errno)));
2038
CLIENT_STACK_UNWIND (discard, frame, rsp.op_ret,
2039
gf_error_to_errno (rsp.op_errno), &prestat,
2042
free (rsp.xdata.xdata_val);
2051
client3_3_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
2054
call_frame_t *frame = NULL;
2055
gfs3_zerofill_rsp rsp = {0,};
2056
struct iatt prestat = {0,};
2057
struct iatt poststat = {0,};
2059
xlator_t *this = NULL;
2060
dict_t *xdata = NULL;
2066
if (-1 == req->rpc_status) {
2068
rsp.op_errno = ENOTCONN;
2071
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_zerofill_rsp);
2073
gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
2075
rsp.op_errno = EINVAL;
2079
if (-1 != rsp.op_ret) {
2080
gf_stat_to_iatt (&rsp.statpre, &prestat);
2081
gf_stat_to_iatt (&rsp.statpost, &poststat);
2084
GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
2085
(rsp.xdata.xdata_len), ret,
2089
if (rsp.op_ret == -1) {
2090
gf_log (this->name, GF_LOG_WARNING,
2091
"remote operation failed: %s",
2092
strerror (gf_error_to_errno (rsp.op_errno)));
2094
CLIENT_STACK_UNWIND (zerofill, frame, rsp.op_ret,
2095
gf_error_to_errno (rsp.op_errno), &prestat,
2098
free (rsp.xdata.xdata_val);
1952
2107
client3_3_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
5957
client3_3_fallocate(call_frame_t *frame, xlator_t *this, void *data)
5959
clnt_args_t *args = NULL;
5960
int64_t remote_fd = -1;
5961
clnt_conf_t *conf = NULL;
5962
gfs3_fallocate_req req = {{0},};
5963
int op_errno = ESTALE;
5966
if (!frame || !this || !data)
5970
conf = this->private;
5972
CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,
5973
remote_fd, op_errno, unwind);
5976
req.flags = args->flags;
5977
req.offset = args->offset;
5978
req.size = args->size;
5979
memcpy(req.gfid, args->fd->inode->gfid, 16);
5981
GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
5982
req.xdata.xdata_len, op_errno, unwind);
5984
ret = client_submit_request (this, &req, frame, conf->fops,
5986
client3_3_fallocate_cbk, NULL,
5988
NULL, (xdrproc_t)xdr_gfs3_fallocate_req);
5990
gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
5993
GF_FREE (req.xdata.xdata_val);
5997
CLIENT_STACK_UNWIND (fallocate, frame, -1, op_errno, NULL, NULL, NULL);
5998
GF_FREE (req.xdata.xdata_val);
6004
client3_3_discard(call_frame_t *frame, xlator_t *this, void *data)
6006
clnt_args_t *args = NULL;
6007
int64_t remote_fd = -1;
6008
clnt_conf_t *conf = NULL;
6009
gfs3_discard_req req = {{0},};
6010
int op_errno = ESTALE;
6013
if (!frame || !this || !data)
6017
conf = this->private;
6019
CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,
6020
remote_fd, op_errno, unwind);
6023
req.offset = args->offset;
6024
req.size = args->size;
6025
memcpy(req.gfid, args->fd->inode->gfid, 16);
6027
GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
6028
req.xdata.xdata_len, op_errno, unwind);
6030
ret = client_submit_request(this, &req, frame, conf->fops,
6031
GFS3_OP_DISCARD, client3_3_discard_cbk,
6032
NULL, NULL, 0, NULL, 0, NULL,
6033
(xdrproc_t) xdr_gfs3_discard_req);
6035
gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
6037
GF_FREE (req.xdata.xdata_val);
6041
CLIENT_STACK_UNWIND(discard, frame, -1, op_errno, NULL, NULL, NULL);
6042
GF_FREE (req.xdata.xdata_val);
6048
client3_3_zerofill(call_frame_t *frame, xlator_t *this, void *data)
6050
clnt_args_t *args = NULL;
6051
int64_t remote_fd = -1;
6052
clnt_conf_t *conf = NULL;
6053
gfs3_zerofill_req req = {{0},};
6054
int op_errno = ESTALE;
6063
conf = this->private;
6065
CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,
6066
remote_fd, op_errno, unwind);
6069
req.offset = args->offset;
6070
req.size = args->size;
6071
memcpy(req.gfid, args->fd->inode->gfid, 16);
6073
GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
6074
req.xdata.xdata_len, op_errno, unwind);
6076
ret = client_submit_request(this, &req, frame, conf->fops,
6077
GFS3_OP_ZEROFILL, client3_3_zerofill_cbk,
6078
NULL, NULL, 0, NULL, 0, NULL,
6079
(xdrproc_t) xdr_gfs3_zerofill_req);
6081
gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
6083
GF_FREE (req.xdata.xdata_val);
6087
CLIENT_STACK_UNWIND(zerofill, frame, -1, op_errno, NULL, NULL, NULL);
6088
GF_FREE (req.xdata.xdata_val);
5799
6093
/* Table Specific to FOPS */
5841
6135
[GF_FOP_SETATTR] = { "SETATTR", client3_3_setattr },
5842
6136
[GF_FOP_FSETATTR] = { "FSETATTR", client3_3_fsetattr },
5843
6137
[GF_FOP_READDIRP] = { "READDIRP", client3_3_readdirp },
6138
[GF_FOP_FALLOCATE] = { "FALLOCATE", client3_3_fallocate },
6139
[GF_FOP_DISCARD] = { "DISCARD", client3_3_discard },
6140
[GF_FOP_ZEROFILL] = { "ZEROFILL", client3_3_zerofill},
5844
6141
[GF_FOP_RELEASE] = { "RELEASE", client3_3_release },
5845
6142
[GF_FOP_RELEASEDIR] = { "RELEASEDIR", client3_3_releasedir },
5846
6143
[GF_FOP_GETSPEC] = { "GETSPEC", client3_getspec },