Lines Matching +full:total +full:- +full:timeout
1 // SPDX-License-Identifier: GPL-2.0
6 * See COPYING in top-level directory.
14 #include "orangefs-kernel.h"
15 #include "orangefs-bufmap.h"
69 h = &orangefs_inode->xattr_cache[xattr_key(key)]; in find_cached_xattr()
73 /* if (!time_before(jiffies, cx->timeout)) { in find_cached_xattr()
74 hlist_del(&cx->node); in find_cached_xattr()
78 if (!strcmp(cx->key, key)) in find_cached_xattr()
86 * file into a user-specified buffer. Note that the getxattr
99 ssize_t ret = -ENOMEM; in orangefs_inode_getxattr()
108 if (S_ISLNK(inode->i_mode)) in orangefs_inode_getxattr()
109 return -EOPNOTSUPP; in orangefs_inode_getxattr()
112 return -EINVAL; in orangefs_inode_getxattr()
125 down_read(&orangefs_inode->xattr_sem); in orangefs_inode_getxattr()
128 if (cx && time_before(jiffies, cx->timeout)) { in orangefs_inode_getxattr()
129 if (cx->length == -1) { in orangefs_inode_getxattr()
130 ret = -ENODATA; in orangefs_inode_getxattr()
134 ret = cx->length; in orangefs_inode_getxattr()
137 if (cx->length > size) { in orangefs_inode_getxattr()
138 ret = -ERANGE; in orangefs_inode_getxattr()
141 memcpy(buffer, cx->val, cx->length); in orangefs_inode_getxattr()
142 memset(buffer + cx->length, 0, size - cx->length); in orangefs_inode_getxattr()
143 ret = cx->length; in orangefs_inode_getxattr()
152 new_op->upcall.req.getxattr.refn = orangefs_inode->refn; in orangefs_inode_getxattr()
153 strcpy(new_op->upcall.req.getxattr.key, name); in orangefs_inode_getxattr()
160 new_op->upcall.req.getxattr.key_sz = strlen(name) + 1; in orangefs_inode_getxattr()
165 if (ret == -ENOENT) { in orangefs_inode_getxattr()
166 ret = -ENODATA; in orangefs_inode_getxattr()
171 (char *)new_op->upcall.req.getxattr.key); in orangefs_inode_getxattr()
174 strcpy(cx->key, name); in orangefs_inode_getxattr()
175 cx->length = -1; in orangefs_inode_getxattr()
176 cx->timeout = jiffies + in orangefs_inode_getxattr()
178 hash_add(orangefs_inode->xattr_cache, &cx->node, in orangefs_inode_getxattr()
179 xattr_key(cx->key)); in orangefs_inode_getxattr()
188 length = new_op->downcall.resp.getxattr.val_sz; in orangefs_inode_getxattr()
202 ret = -ERANGE; in orangefs_inode_getxattr()
206 memcpy(buffer, new_op->downcall.resp.getxattr.val, length); in orangefs_inode_getxattr()
207 memset(buffer + length, 0, size - length); in orangefs_inode_getxattr()
212 (char *)new_op-> in orangefs_inode_getxattr()
214 (int)new_op-> in orangefs_inode_getxattr()
221 strcpy(cx->key, name); in orangefs_inode_getxattr()
222 memcpy(cx->val, buffer, length); in orangefs_inode_getxattr()
223 cx->length = length; in orangefs_inode_getxattr()
224 cx->timeout = jiffies + HZ; in orangefs_inode_getxattr()
228 strcpy(cx->key, name); in orangefs_inode_getxattr()
229 memcpy(cx->val, buffer, length); in orangefs_inode_getxattr()
230 cx->length = length; in orangefs_inode_getxattr()
231 cx->timeout = jiffies + HZ; in orangefs_inode_getxattr()
232 hash_add(orangefs_inode->xattr_cache, &cx->node, in orangefs_inode_getxattr()
233 xattr_key(cx->key)); in orangefs_inode_getxattr()
240 up_read(&orangefs_inode->xattr_sem); in orangefs_inode_getxattr()
252 int ret = -ENOMEM; in orangefs_inode_removexattr()
255 return -EINVAL; in orangefs_inode_removexattr()
257 down_write(&orangefs_inode->xattr_sem); in orangefs_inode_removexattr()
262 new_op->upcall.req.removexattr.refn = orangefs_inode->refn; in orangefs_inode_removexattr()
268 strcpy(new_op->upcall.req.removexattr.key, name); in orangefs_inode_removexattr()
269 new_op->upcall.req.removexattr.key_sz = strlen(name) + 1; in orangefs_inode_removexattr()
273 (char *)new_op->upcall.req.removexattr.key, in orangefs_inode_removexattr()
274 (int)new_op->upcall.req.removexattr.key_sz); in orangefs_inode_removexattr()
279 if (ret == -ENOENT) { in orangefs_inode_removexattr()
281 * Request to replace a non-existent attribute is an error. in orangefs_inode_removexattr()
284 ret = -ENODATA; in orangefs_inode_removexattr()
294 h = &orangefs_inode->xattr_cache[xattr_key(name)]; in orangefs_inode_removexattr()
296 if (!strcmp(cx->key, name)) { in orangefs_inode_removexattr()
297 hlist_del(&cx->node); in orangefs_inode_removexattr()
304 up_write(&orangefs_inode->xattr_sem); in orangefs_inode_removexattr()
311 * Returns a -ve number on error and 0 on success. Key is text, but value
323 int ret = -ENOMEM; in orangefs_inode_setxattr()
330 return -EINVAL; in orangefs_inode_setxattr()
332 return -EINVAL; in orangefs_inode_setxattr()
349 down_write(&orangefs_inode->xattr_sem); in orangefs_inode_setxattr()
355 new_op->upcall.req.setxattr.refn = orangefs_inode->refn; in orangefs_inode_setxattr()
356 new_op->upcall.req.setxattr.flags = internal_flag; in orangefs_inode_setxattr()
362 strcpy(new_op->upcall.req.setxattr.keyval.key, name); in orangefs_inode_setxattr()
363 new_op->upcall.req.setxattr.keyval.key_sz = strlen(name) + 1; in orangefs_inode_setxattr()
364 memcpy(new_op->upcall.req.setxattr.keyval.val, value, size); in orangefs_inode_setxattr()
365 new_op->upcall.req.setxattr.keyval.val_sz = size; in orangefs_inode_setxattr()
370 (char *)new_op->upcall.req.setxattr.keyval.key, in orangefs_inode_setxattr()
371 (int)new_op->upcall.req.setxattr.keyval.key_sz, in orangefs_inode_setxattr()
385 h = &orangefs_inode->xattr_cache[xattr_key(name)]; in orangefs_inode_setxattr()
387 if (!strcmp(cx->key, name)) { in orangefs_inode_setxattr()
388 hlist_del(&cx->node); in orangefs_inode_setxattr()
395 up_write(&orangefs_inode->xattr_sem); in orangefs_inode_setxattr()
400 * Tries to get a specified object's keys into a user-specified buffer of a
408 struct inode *inode = dentry->d_inode; in orangefs_listxattr()
412 ssize_t ret = -ENOMEM; in orangefs_listxattr()
413 ssize_t total = 0; in orangefs_listxattr() local
421 return -EINVAL; in orangefs_listxattr()
424 down_read(&orangefs_inode->xattr_sem); in orangefs_listxattr()
434 new_op->upcall.req.listxattr.refn = orangefs_inode->refn; in orangefs_listxattr()
435 new_op->upcall.req.listxattr.token = token; in orangefs_listxattr()
436 new_op->upcall.req.listxattr.requested_count = in orangefs_listxattr()
449 total = new_op->downcall.resp.listxattr.returned_count * in orangefs_listxattr()
454 returned_count = new_op->downcall.resp.listxattr.returned_count; in orangefs_listxattr()
460 ret = -EIO; in orangefs_listxattr()
468 if (new_op->downcall.resp.listxattr.lengths[i] < 0 || in orangefs_listxattr()
469 new_op->downcall.resp.listxattr.lengths[i] > in orangefs_listxattr()
473 new_op->downcall.resp.listxattr.lengths[i]); in orangefs_listxattr()
474 ret = -EIO; in orangefs_listxattr()
477 if (total + new_op->downcall.resp.listxattr.lengths[i] > size) in orangefs_listxattr()
485 if (is_reserved_key(new_op->downcall.resp.listxattr.key + in orangefs_listxattr()
487 new_op->downcall.resp. in orangefs_listxattr()
489 gossip_debug(GOSSIP_XATTR_DEBUG, "Copying key %d -> %s\n", in orangefs_listxattr()
490 i, new_op->downcall.resp.listxattr.key + in orangefs_listxattr()
492 memcpy(buffer + total, in orangefs_listxattr()
493 new_op->downcall.resp.listxattr.key + key_size, in orangefs_listxattr()
494 new_op->downcall.resp.listxattr.lengths[i]); in orangefs_listxattr()
495 total += new_op->downcall.resp.listxattr.lengths[i]; in orangefs_listxattr()
498 gossip_debug(GOSSIP_XATTR_DEBUG, "[RESERVED] key %d -> %s\n", in orangefs_listxattr()
499 i, new_op->downcall.resp.listxattr.key + in orangefs_listxattr()
502 key_size += new_op->downcall.resp.listxattr.lengths[i]; in orangefs_listxattr()
509 token = new_op->downcall.resp.listxattr.token; in orangefs_listxattr()
517 ret ? (int)ret : (int)total, in orangefs_listxattr()
522 ret = total; in orangefs_listxattr()
524 up_read(&orangefs_inode->xattr_sem); in orangefs_listxattr()