diff options
Diffstat (limited to 'xlators/storage')
-rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 52 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix-inode-fd-ops.c | 12 |
2 files changed, 32 insertions, 32 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 377389d22a3..816fb3587d2 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -392,27 +392,6 @@ _get_filler_inode (posix_xattr_filler_t *filler) } static int -_posix_filler_get_openfd_count (posix_xattr_filler_t *filler, char *key) -{ - inode_t *inode = NULL; - int ret = -1; - - inode = _get_filler_inode (filler); - if (!inode || gf_uuid_is_null (inode->gfid)) - goto out; - - ret = dict_set_uint32 (filler->xattr, key, inode->fd_count); - if (ret < 0) { - gf_msg (filler->this->name, GF_LOG_WARNING, 0, - P_MSG_DICT_SET_FAILED, - "Failed to set dictionary value for %s", key); - goto out; - } -out: - return ret; -} - -static int _posix_xattr_get_set (dict_t *xattr_req, char *key, data_t *data, void *xattrargs) { @@ -420,11 +399,11 @@ _posix_xattr_get_set (dict_t *xattr_req, char *key, data_t *data, int ret = -1; char *databuf = NULL; int _fd = -1; - loc_t *loc = NULL; ssize_t req_size = 0; int32_t list_offset = 0; ssize_t remaining_size = 0; char *xattr = NULL; + inode_t *inode = NULL; if (posix_xattr_ignorable (key)) goto out; @@ -500,16 +479,25 @@ _posix_xattr_get_set (dict_t *xattr_req, char *key, data_t *data, GF_FREE (databuf); } } else if (!strcmp (key, GLUSTERFS_OPEN_FD_COUNT)) { - ret = _posix_filler_get_openfd_count (filler, key); - loc = filler->loc; - if (loc) { - ret = dict_set_uint32 (filler->xattr, key, - loc->inode->fd_count); - if (ret < 0) - gf_msg (filler->this->name, GF_LOG_WARNING, 0, - P_MSG_XDATA_GETXATTR, - "Failed to set dictionary value for %s", - key); + inode = _get_filler_inode (filler); + if (!inode || gf_uuid_is_null (inode->gfid)) + goto out; + ret = dict_set_uint32 (filler->xattr, key, inode->fd_count); + if (ret < 0) { + gf_msg (filler->this->name, GF_LOG_WARNING, 0, + P_MSG_DICT_SET_FAILED, + "Failed to set dictionary value for %s", key); + } + } else if (!strcmp (key, GLUSTERFS_ACTIVE_FD_COUNT)) { + inode = _get_filler_inode (filler); + if (!inode || gf_uuid_is_null (inode->gfid)) + goto out; + ret = dict_set_uint32 (filler->xattr, key, + inode->active_fd_count); + if (ret < 0) { + gf_msg (filler->this->name, GF_LOG_WARNING, 0, + P_MSG_DICT_SET_FAILED, + "Failed to set dictionary value for %s", key); } } else if (!strcmp (key, GET_ANCESTRY_PATH_KEY)) { /* As of now, the only consumers of POSIX_ANCESTRY_PATH attempt diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c index bca7419eee0..dafac59fe5b 100644 --- a/xlators/storage/posix/src/posix-inode-fd-ops.c +++ b/xlators/storage/posix/src/posix-inode-fd-ops.c @@ -1526,6 +1526,18 @@ _fill_writev_xdata (fd_t *fd, dict_t *xdata, xlator_t *this, int is_append) } } + if (dict_get (xdata, GLUSTERFS_ACTIVE_FD_COUNT)) { + ret = dict_set_uint32 (rsp_xdata, GLUSTERFS_ACTIVE_FD_COUNT, + fd->inode->active_fd_count); + if (ret < 0) { + gf_msg (this->name, GF_LOG_WARNING, 0, + P_MSG_DICT_SET_FAILED, "%s: Failed to set " + "dictionary value for %s", + uuid_utoa (fd->inode->gfid), + GLUSTERFS_ACTIVE_FD_COUNT); + } + } + if (dict_get (xdata, GLUSTERFS_WRITE_IS_APPEND)) { ret = dict_set_uint32 (rsp_xdata, GLUSTERFS_WRITE_IS_APPEND, is_append); |