Mercurial > nomad
changeset 574:5bfa356ff3f8
objstore: make objstore_getattr use cached attributes
Calling the getattr object op would just generate unnecessary I/O.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Fri, 15 Feb 2019 10:00:21 -0500 |
parents | d9f6ee9f9103 |
children | 1642d345419c |
files | src/objstore/obj_ops.c |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/objstore/obj_ops.c Fri Feb 15 10:14:35 2019 -0500 +++ b/src/objstore/obj_ops.c Fri Feb 15 10:00:21 2019 -0500 @@ -143,21 +143,20 @@ int objstore_getattr(struct objstore_open_obj_info *open, struct nattr *attr) { struct obj *obj; - int ret; if (!open || !attr) return -EINVAL; obj = open->obj; - if (!obj->ops || !obj->ops->getattr) - return -ENOTSUP; - MXLOCK(&obj->lock); - ret = obj->ops->getattr(open->ver, attr); + *attr = open->ver->attrs; MXUNLOCK(&obj->lock); - return ret; + /* sanity check that the backend didn't try to give us an inode number */ + ASSERT0(attr->ino); + + return 0; } int objstore_setattr(struct objstore_open_obj_info *open, struct nattr *attr,