From fa4e997970fb0e1d0abaae742a35701bcb576150 Mon Sep 17 00:00:00 2001 From: Mohammed Junaid Ahmed Date: Mon, 14 Mar 2011 22:22:04 +0000 Subject: storage/posix: Added GF_XATTROP_ADD_LONG_ARRAY flag to perform 64bit xattrop operations. Signed-off-by: Junaid Signed-off-by: Vijay Bellur BUG: 2473 (Support for volume and directory level quota) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2473 --- xlators/storage/posix/src/posix.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'xlators/storage/posix') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index f95c9f8ff..6ede55ffa 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3513,6 +3513,14 @@ __add_array (int32_t *dest, int32_t *src, int count) } } +static void +__add_long_array (int64_t *dest, int64_t *src, int count) +{ + int i = 0; + for (i = 0; i < count; i++) { + dest[i] = hton64 (ntoh64 (dest[i]) + ntoh64 (src[i])); + } +} /** * xattrop - xattr operations - for internal use by GlusterFS @@ -3526,7 +3534,7 @@ do_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, gf_xattrop_flags_t optype, dict_t *xattr) { char *real_path = NULL; - int32_t *array = NULL; + char *array = NULL; int size = 0; int count = 0; @@ -3574,8 +3582,8 @@ do_xattrop (call_frame_t *frame, xlator_t *this, } while (trav && inode) { - count = trav->value->len / sizeof (int32_t); - array = GF_CALLOC (count, sizeof (int32_t), + count = trav->value->len; + array = GF_CALLOC (count, sizeof (char), gf_posix_mt_int32_t); LOCK (&inode->lock); @@ -3616,10 +3624,15 @@ do_xattrop (call_frame_t *frame, xlator_t *this, switch (optype) { case GF_XATTROP_ADD_ARRAY: - __add_array (array, (int32_t *) trav->value->data, + __add_array ((int32_t *) array, (int32_t *) trav->value->data, trav->value->len / 4); break; + case GF_XATTROP_ADD_ARRAY64: + __add_long_array ((int64_t *) array, (int64_t *) trav->value->data, + trav->value->len / 8); + break; + default: gf_log (this->name, GF_LOG_ERROR, "Unknown xattrop type (%d) on %s. Please send " -- cgit