summaryrefslogtreecommitdiffstats
path: root/xlators/storage/bd/src
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2016-08-22 12:15:18 -0400
committerKaleb KEITHLEY <kkeithle@redhat.com>2016-09-12 08:46:34 -0700
commit89236bdb61f99682b794278286ca6b319516c446 (patch)
tree290aac66611687dfdce6dbba22fe1b313b452064 /xlators/storage/bd/src
parent1afa0bd91fd23b5131ccc1cceb814a061ac99096 (diff)
bd: fix unused variable warnings/errors
http://review.gluster.org/14085 fixes a/the "leak" - via the generated rpc/xdr headers - of pragmas that mask these warnings. However 14085 won't pass the smoke test until all the warnings are fixed. Change-Id: Ia242a51ce153ee3a866a4c7f05a1389841b2bb54 BUG: 1369124 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/15256 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/storage/bd/src')
-rw-r--r--xlators/storage/bd/src/bd.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/xlators/storage/bd/src/bd.c b/xlators/storage/bd/src/bd.c
index 6c1d2a29308..07b7ecd52ad 100644
--- a/xlators/storage/bd/src/bd.c
+++ b/xlators/storage/bd/src/bd.c
@@ -752,7 +752,6 @@ bd_fsync (call_frame_t *frame, xlator_t *this,
int32_t op_ret = -1;
int32_t op_errno = 0;
bd_fd_t *bd_fd = NULL;
- bd_priv_t *priv = NULL;
bd_attr_t *bdatt = NULL;
bd_local_t *local = NULL;
int valid = GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME;
@@ -763,8 +762,6 @@ bd_fsync (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (fd, out);
VALIDATE_OR_GOTO (this->private, out);
- priv = this->private;
-
ret = bd_inode_ctx_get (fd->inode, this, &bdatt);
ret = bd_fd_ctx_get (this, fd, &bd_fd);
if (ret < 0 || !bd_fd || !bdatt) {
@@ -820,11 +817,9 @@ bd_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
{
int ret = -1;
bd_fd_t *bd_fd = NULL;
- bd_priv_t *priv = NULL;
bd_attr_t *bdatt = NULL;
int valid = GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME;
bd_local_t *local = NULL;
- int op_errno = EINVAL;
loc_t loc = {0, };
VALIDATE_OR_GOTO (frame, out);
@@ -832,8 +827,6 @@ bd_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
VALIDATE_OR_GOTO (fd, out);
VALIDATE_OR_GOTO (this->private, out);
- priv = this->private;
-
ret = bd_inode_ctx_get (fd->inode, this, &bdatt);
if (!bdatt)
goto out;
@@ -846,7 +839,10 @@ bd_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
}
local = bd_local_init (frame, this);
- BD_VALIDATE_MEM_ALLOC (local, op_errno, out);
+ if (!local) {
+ gf_log (this->name, GF_LOG_ERROR, "out of memory");
+ goto out;
+ }
local->fd = fd_ref (fd);
gf_uuid_copy (loc.gfid, bdatt->iatt.ia_gfid);
@@ -1183,8 +1179,8 @@ bd_offload_dest_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
bd_local_t *local = frame->local;
char *bd = NULL;
- int ret = -1;
char *linkto = NULL;
+ int ret = -1;
if (op_ret < 0 && op_errno != ENODATA) {
op_errno = EINVAL;
@@ -1226,7 +1222,7 @@ out:
else
BD_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL);
- return 0;
+ return (ret == 0) ? 0 : ret;
}
int
@@ -1782,7 +1778,6 @@ __bd_pwritev (int fd, struct iovec *vector, int count, off_t offset,
{
int index = 0;
int retval = 0;
- off_t internal_offset = 0;
if (!vector)
return -EFAULT;
@@ -1936,7 +1931,6 @@ bd_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf,
bd_local_t *local = NULL;
bd_attr_t *bdatt = NULL;
int *ck_valid = NULL;
- int op_errno = 0;
if (bd_inode_ctx_get (loc->inode, this, &bdatt)) {
STACK_WIND(frame, default_setattr_cbk, FIRST_CHILD(this),
@@ -1946,10 +1940,16 @@ bd_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf,
}
local = bd_local_init (frame, this);
- BD_VALIDATE_MEM_ALLOC (local, op_errno, out);
+ if (!local) {
+ gf_log (this->name, GF_LOG_ERROR, "out of memory");
+ goto out;
+ }
ck_valid = GF_CALLOC (1, sizeof (valid), gf_bd_int32_t);
- BD_VALIDATE_MEM_ALLOC (ck_valid, op_errno, out);
+ if (!ck_valid) {
+ gf_log (this->name, GF_LOG_ERROR, "out of memory");
+ goto out;
+ }
local->inode = inode_ref (loc->inode);
*ck_valid = valid;
@@ -2297,7 +2297,6 @@ out:
int
init (xlator_t *this)
{
- int ret = 0;
char *vg_data = NULL;
char *device = NULL;
bd_priv_t *_private = NULL;
@@ -2330,7 +2329,6 @@ init (xlator_t *this)
return -1;
}
- ret = 0;
_private = GF_CALLOC (1, sizeof (*_private), gf_bd_private);
if (!_private)
goto error;
@@ -2357,7 +2355,6 @@ init (xlator_t *this)
if (bd_aio_on (this)) {
gf_log (this->name, GF_LOG_ERROR,
"BD AIO init failed");
- ret = -1;
goto error;
}
}