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 = GET_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_error;
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
2 changes: 1 addition & 1 deletion doc/developer-guide/coding-standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ int32_t
sample_fop (call_frame_t *frame, xlator_t *this, ...)
{
char * var1 = NULL;
int32_t op_ret = -1;
gf_return_t op_ret = -1;
int32_t op_errno = 0;
DIR * dir = NULL;
struct posix_fd * pfd = NULL;
Expand Down
4 changes: 2 additions & 2 deletions extras/create_new_xlator/new-xlator.c.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma fragment CBK_TEMPLATE
int32_t @FOP_PREFIX@_@NAME@_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t @FOP_PREFIX@_@NAME@_cbk(call_frame_t *frame, void *cookie, xlator_t *this, gf_return_t op_ret,
int32_t op_errno, @UNWIND_PARAMS@)
{
STACK_UNWIND_STRICT(@NAME@, frame, op_ret, op_errno, @UNWIND_ARGS@);
Expand All @@ -17,7 +17,7 @@ If you are generating the leaf xlators, remove the STACK_WIND and replace the
FIRST_CHILD(this)->fops->@NAME@, @WIND_ARGS@);
return 0;
err:
STACK_UNWIND_STRICT(@NAME@, frame, -1, errno, @ERROR_ARGS@);
STACK_UNWIND_STRICT(@NAME@, frame, gf_error, errno, @ERROR_ARGS@);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion glusterfsd/src/glusterfsd-mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ int
glusterfs_handle_translator_op(rpcsvc_request_t *req)
{
int32_t ret = -1;
int32_t op_ret = 0;
int op_ret = 0;
gd1_mgmt_brick_op_req xlator_req = {
0,
};
Expand Down
16 changes: 7 additions & 9 deletions heal/src/glfs-heal.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ typedef struct glfs_info {
int (*print_heal_op_summary)(int ret, num_entries_t *num_entries);
int (*print_heal_status)(char *path, uuid_t gfid, char *status);
int (*print_spb_status)(char *path, uuid_t gfid, char *status);
int (*end)(int op_ret, char *op_errstr);
int (*end)(int ret, char *op_errstr);
} glfsh_info_t;

glfsh_info_t *glfsh_output = NULL;
Expand All @@ -88,19 +88,18 @@ glfsh_init()
}

int
glfsh_end_op_granular_entry_heal(int op_ret, char *op_errstr)
glfsh_end_op_granular_entry_heal(int ret, char *op_errstr)
{
/* If error string is available, give it higher precedence.*/

if (op_errstr) {
printf("%s\n", op_errstr);
} else if (op_ret < 0) {
if (op_ret == -EAGAIN)
} else if (ret < 0) {
if (ret == -EAGAIN)
printf(
"One or more entries need heal. Please execute "
"the command again after there are no entries "
"to be healed\n");
else if (op_ret == -ENOTCONN)
else if (ret == -ENOTCONN)
printf(
"One or more bricks could be down. Please "
"execute the command again after bringing all "
Expand All @@ -110,13 +109,13 @@ glfsh_end_op_granular_entry_heal(int op_ret, char *op_errstr)
printf(
"Command failed - %s. Please check the logs for"
" more details\n",
strerror(-op_ret));
strerror(-ret));
}
return 0;
}

int
glfsh_end(int op_ret, char *op_errstr)
glfsh_end(int ret, char *op_errstr)
{
if (op_errstr)
printf("%s\n", op_errstr);
Expand Down Expand Up @@ -183,7 +182,6 @@ glfsh_xml_end(int op_ret, char *op_errstr)

if (op_ret < 0) {
op_errno = -op_ret;
op_ret = -1;
if (op_errstr == NULL) {
op_errstr = gf_strdup(strerror(op_errno));
alloc = _gf_true;
Expand Down
Loading