summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorMohammed Junaid Ahmed <junaid@gluster.com>2011-03-14 22:22:04 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-16 00:32:07 -0700
commitfa4e997970fb0e1d0abaae742a35701bcb576150 (patch)
tree7e886b693682d47fca1bda082198a5c534b8a986 /xlators/storage
parent031eee923d8fd79bc1cf78b7b24fe82e44186848 (diff)
storage/posix: Added GF_XATTROP_ADD_LONG_ARRAY flag to perform 64bit xattrop operations.
Signed-off-by: Junaid <junaid@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2473 (Support for volume and directory level quota) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2473
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix.c21
1 files changed, 17 insertions, 4 deletions
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 "