Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions api/src/glfs-fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,9 +1172,9 @@ struct glfs_io {
};

static int
glfs_io_async_cbk(int op_ret, int op_errno, call_frame_t *frame, void *cookie,
struct iovec *iovec, int count, struct iatt *prebuf,
struct iatt *postbuf)
glfs_io_async_cbk(gf_return_t op_ret, int op_errno, call_frame_t *frame,
void *cookie, struct iovec *iovec, int count,
struct iatt *prebuf, struct iatt *postbuf)
{
struct glfs_io *gio = NULL;
xlator_t *subvol = NULL;
Expand All @@ -1192,29 +1192,30 @@ glfs_io_async_cbk(int op_ret, int op_errno, call_frame_t *frame, void *cookie,
subvol = cookie;
glfd = gio->glfd;
fs = glfd->fs;
ret = op_ret.op_ret;

if (!glfs_is_glfd_still_valid(glfd))
goto err;

if (op_ret <= 0) {
if (IS_ERROR(op_ret)) {
goto out;
} else if (gio->op == GF_FOP_READ) {
if (!iovec) {
op_ret = -1;
op_ret = gf_failure;
op_errno = EINVAL;
goto out;
}

op_ret = iov_copy(gio->iov, gio->count, iovec, count);
glfd->offset = gio->offset + op_ret;
ret = iov_copy(gio->iov, gio->count, iovec, count);
glfd->offset = gio->offset + ret;
} else if (gio->op == GF_FOP_WRITE) {
glfd->offset = gio->offset + gio->iov->iov_len;
}

out:
errno = op_errno;
if (gio->oldcb) {
gio->fn34(gio->glfd, op_ret, gio->data);
gio->fn34(gio->glfd, ret, gio->data);
} else {
if (prebuf) {
prestatp = &prestat;
Expand All @@ -1226,7 +1227,7 @@ glfs_io_async_cbk(int op_ret, int op_errno, call_frame_t *frame, void *cookie,
glfs_iatt_to_statx(fs, postbuf, poststatp);
}

gio->fn(gio->glfd, op_ret, prestatp, poststatp, gio->data);
gio->fn(gio->glfd, ret, prestatp, poststatp, gio->data);
}
err:
fd_unref(glfd->fd);
Expand All @@ -1248,8 +1249,9 @@ glfs_io_async_cbk(int op_ret, int op_errno, call_frame_t *frame, void *cookie,

static int
glfs_preadv_async_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct iovec *iovec, int count,
struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
gf_return_t op_ret, int op_errno, struct iovec *iovec,
int count, struct iatt *stbuf, struct iobref *iobref,
dict_t *xdata)
{
glfs_io_async_cbk(op_ret, op_errno, frame, cookie, iovec, count, NULL,
stbuf);
Expand Down Expand Up @@ -1795,7 +1797,7 @@ pub_glfs_from_glfd(glfs_fd_t *);

static int
glfs_pwritev_async_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct iatt *prebuf,
gf_return_t op_ret, int op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
glfs_io_async_cbk(op_ret, op_errno, frame, cookie, NULL, 0, prebuf,
Expand Down Expand Up @@ -2109,7 +2111,7 @@ pub_glfs_fsync(struct glfs_fd *glfd, struct glfs_stat *prestat,

static int
glfs_fsync_async_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
gf_return_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
glfs_io_async_cbk(op_ret, op_errno, frame, cookie, NULL, 0, prebuf,
Expand Down Expand Up @@ -2462,8 +2464,9 @@ pub_glfs_truncate(struct glfs *fs, const char *path, off_t length)

static int
glfs_ftruncate_async_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
gf_return_t op_ret, int32_t op_errno,
struct iatt *prebuf, struct iatt *postbuf,
dict_t *xdata)
{
glfs_io_async_cbk(op_ret, op_errno, frame, cookie, NULL, 0, prebuf,
postbuf);
Expand Down Expand Up @@ -3368,7 +3371,7 @@ pub_glfs_seekdir(struct glfs_fd *fd, long offset)

static int
glfs_discard_async_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
gf_return_t op_ret, int32_t op_errno,
struct iatt *preop_stbuf, struct iatt *postop_stbuf,
dict_t *xdata)
{
Expand Down Expand Up @@ -3475,7 +3478,7 @@ pub_glfs_discard_async(struct glfs_fd *glfd, off_t offset, size_t len,

static int
glfs_zerofill_async_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,
gf_return_t op_ret, int32_t op_errno,
struct iatt *preop_stbuf, struct iatt *postop_stbuf,
dict_t *xdata)
{
Expand Down
5 changes: 3 additions & 2 deletions cli/src/cli-rpc-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -3024,7 +3024,8 @@ gluster_remove_auxiliary_mount(char *volname)
static int
gf_cli_print_limit_list_from_dict(cli_local_t *local, char *volname,
dict_t *dict, char *default_sl, int count,
int op_ret, int op_errno, char *op_errstr)
gf_return_t op_ret, int op_errno,
char *op_errstr)
{
int ret = -1;
int i = 0;
Expand Down Expand Up @@ -3400,7 +3401,7 @@ cli_quotad_getlimit(call_frame_t *frame, xlator_t *this, void *data)

static void
gf_cli_quota_list(cli_local_t *local, char *volname, dict_t *dict,
char *default_sl, int count, int op_ret, int op_errno,
char *default_sl, int count, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
if (!cli_cmd_connected())
Expand Down
61 changes: 32 additions & 29 deletions cli/src/cli-xml-output.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ cli_end_xml_output(xmlTextWriterPtr writer, xmlDocPtr doc)
}

int
cli_xml_output_common(xmlTextWriterPtr writer, int op_ret, int op_errno,
cli_xml_output_common(xmlTextWriterPtr writer, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
int ret = -1;
Expand Down Expand Up @@ -134,7 +134,7 @@ cli_xml_output_common(xmlTextWriterPtr writer, int op_ret, int op_errno,
#endif

int
cli_xml_output_str(char *op, char *str, int op_ret, int op_errno,
cli_xml_output_str(char *op, char *str, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
Expand Down Expand Up @@ -191,7 +191,7 @@ cli_xml_output_data_pair(dict_t *this, char *key, data_t *value, void *data)
#endif

int
cli_xml_output_dict(char *op, dict_t *dict, int op_ret, int op_errno,
cli_xml_output_dict(char *op, dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
Expand Down Expand Up @@ -1307,8 +1307,8 @@ cli_xml_output_vol_status_callpool(xmlTextWriterPtr writer, dict_t *dict,
#endif

int
cli_xml_output_vol_status_begin(cli_local_t *local, int op_ret, int op_errno,
char *op_errstr)
cli_xml_output_vol_status_begin(cli_local_t *local, gf_return_t op_ret,
int op_errno, char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -1757,7 +1757,8 @@ cli_xml_output_vol_top_other(xmlTextWriterPtr writer, dict_t *dict,
#endif

int
cli_xml_output_vol_top(dict_t *dict, int op_ret, int op_errno, char *op_errstr)
cli_xml_output_vol_top(dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -2123,7 +2124,7 @@ cli_xml_output_vol_profile_stats(xmlTextWriterPtr writer, dict_t *dict,
#endif

int
cli_xml_output_vol_profile(dict_t *dict, int op_ret, int op_errno,
cli_xml_output_vol_profile(dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
Expand Down Expand Up @@ -2247,7 +2248,8 @@ cli_xml_output_vol_profile(dict_t *dict, int op_ret, int op_errno,
}

int
cli_xml_output_vol_list(dict_t *dict, int op_ret, int op_errno, char *op_errstr)
cli_xml_output_vol_list(dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -2651,8 +2653,8 @@ cli_xml_output_vol_info(cli_local_t *local, dict_t *dict)
}

int
cli_xml_output_vol_info_begin(cli_local_t *local, int op_ret, int op_errno,
char *op_errstr)
cli_xml_output_vol_info_begin(cli_local_t *local, gf_return_t op_ret,
int op_errno, char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -2734,8 +2736,9 @@ cli_xml_output_vol_quota_limit_list_end(cli_local_t *local)
}

int
cli_xml_output_vol_quota_limit_list_begin(cli_local_t *local, int op_ret,
int op_errno, char *op_errstr)
cli_xml_output_vol_quota_limit_list_begin(cli_local_t *local,
gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -2799,7 +2802,7 @@ cli_xml_output_peer_hostnames(xmlTextWriterPtr writer, dict_t *dict,
#endif

int
cli_xml_output_peer_status(dict_t *dict, int op_ret, int op_errno,
cli_xml_output_peer_status(dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
Expand Down Expand Up @@ -3152,8 +3155,8 @@ cli_xml_output_vol_rebalance_status(xmlTextWriterPtr writer, dict_t *dict,
#endif

int
cli_xml_output_vol_rebalance(gf_cli_defrag_type op, dict_t *dict, int op_ret,
int op_errno, char *op_errstr)
cli_xml_output_vol_rebalance(gf_cli_defrag_type op, dict_t *dict,
gf_return_t op_ret, int op_errno, char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -3206,8 +3209,8 @@ cli_xml_output_vol_rebalance(gf_cli_defrag_type op, dict_t *dict, int op_ret,

int
cli_xml_output_vol_remove_brick(gf_boolean_t status_op, dict_t *dict,
int op_ret, int op_errno, char *op_errstr,
const char *op)
gf_return_t op_ret, int op_errno,
char *op_errstr, const char *op)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -3254,7 +3257,7 @@ cli_xml_output_vol_remove_brick(gf_boolean_t status_op, dict_t *dict,
}

int
cli_xml_output_vol_replace_brick(dict_t *dict, int op_ret, int op_errno,
cli_xml_output_vol_replace_brick(dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
Expand All @@ -3281,7 +3284,7 @@ cli_xml_output_vol_replace_brick(dict_t *dict, int op_ret, int op_errno,
}

int
cli_xml_output_vol_create(dict_t *dict, int op_ret, int op_errno,
cli_xml_output_vol_create(dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
Expand Down Expand Up @@ -3342,8 +3345,8 @@ cli_xml_output_vol_create(dict_t *dict, int op_ret, int op_errno,
}

int
cli_xml_output_generic_volume(char *op, dict_t *dict, int op_ret, int op_errno,
char *op_errstr)
cli_xml_output_generic_volume(char *op, dict_t *dict, gf_return_t op_ret,
int op_errno, char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -3740,7 +3743,7 @@ cli_xml_output_vol_gsync_status(dict_t *dict, xmlTextWriterPtr writer)
#endif

int
cli_xml_output_vol_gsync(dict_t *dict, int op_ret, int op_errno,
cli_xml_output_vol_gsync(dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
Expand Down Expand Up @@ -5228,8 +5231,8 @@ cli_xml_snapshot_delete(cli_local_t *local, dict_t *dict, gf_cli_rsp *rsp)
}

int
cli_xml_output_snap_status_begin(cli_local_t *local, int op_ret, int op_errno,
char *op_errstr)
cli_xml_output_snap_status_begin(cli_local_t *local, gf_return_t op_ret,
int op_errno, char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -5284,8 +5287,8 @@ cli_xml_output_snap_status_end(cli_local_t *local)
}

int
cli_xml_output_snap_delete_begin(cli_local_t *local, int op_ret, int op_errno,
char *op_errstr)
cli_xml_output_snap_delete_begin(cli_local_t *local, gf_return_t op_ret,
int op_errno, char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -5356,8 +5359,8 @@ cli_xml_output_snap_delete_end(cli_local_t *local)
* @return 0 on success and -1 on failure
*/
int
cli_xml_output_snapshot(int cmd_type, dict_t *dict, int op_ret, int op_errno,
char *op_errstr)
cli_xml_output_snapshot(int cmd_type, dict_t *dict, gf_return_t op_ret,
int op_errno, char *op_errstr)
{
#if (HAVE_LIB_XML)
int ret = -1;
Expand Down Expand Up @@ -5597,7 +5600,7 @@ cli_xml_snapshot_status_single_snap(cli_local_t *local, dict_t *dict, char *key)
}

int
cli_xml_output_vol_getopts(dict_t *dict, int op_ret, int op_errno,
cli_xml_output_vol_getopts(dict_t *dict, gf_return_t op_ret, int op_errno,
char *op_errstr)
{
#if (HAVE_LIB_XML)
Expand Down
Loading