diff options
Diffstat (limited to 'xlators/storage/posix/src/posix-aio.c')
| -rw-r--r-- | xlators/storage/posix/src/posix-aio.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/xlators/storage/posix/src/posix-aio.c b/xlators/storage/posix/src/posix-aio.c index cf570d5be41..d0cb0002bbf 100644 --- a/xlators/storage/posix/src/posix-aio.c +++ b/xlators/storage/posix/src/posix-aio.c @@ -7,8 +7,6 @@ later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ -#include "xlator.h" -#include "glusterfs.h" #include "posix.h" #include <sys/uio.h> #include "posix-messages.h" @@ -133,11 +131,7 @@ posix_aio_readv_complete(struct posix_aio_cb *paiocb, int res, int res2) if (!postbuf.ia_size || (offset + iov.iov_len) >= postbuf.ia_size) op_errno = ENOENT; - LOCK(&priv->lock); - { - priv->read_value += op_ret; - } - UNLOCK(&priv->lock); + GF_ATOMIC_ADD(priv->read_value, op_ret); out: STACK_UNWIND_STRICT(readv, frame, op_ret, op_errno, &iov, 1, &postbuf, @@ -266,6 +260,12 @@ posix_aio_writev_complete(struct posix_aio_cb *paiocb, int res, int res2) struct posix_private *priv = NULL; fd_t *fd = NULL; + if (!paiocb) { + op_ret = -1; + op_errno = EINVAL; + goto out; + } + frame = paiocb->frame; this = frame->this; priv = this->private; @@ -295,11 +295,7 @@ posix_aio_writev_complete(struct posix_aio_cb *paiocb, int res, int res2) op_ret = res; op_errno = 0; - LOCK(&priv->lock); - { - priv->write_value += op_ret; - } - UNLOCK(&priv->lock); + GF_ATOMIC_ADD(priv->write_value, op_ret); out: STACK_UNWIND_STRICT(writev, frame, op_ret, op_errno, &prebuf, &postbuf, |
