X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Fosd-zfs%2Fosd_xattr.c;h=56d1352a5f84ab7629f54cd862ef946254681fb5;hb=1646e209a3dc62905053fd702d5f0578bbaec85d;hp=9ea4fd174093ed0a9d8b27ed4ab0981434a2f6b1;hpb=47accf4c7875c8f0fa89cd3ed2f38d8f7ed0586e;p=fs%2Flustre-release.git diff --git a/lustre/osd-zfs/osd_xattr.c b/lustre/osd-zfs/osd_xattr.c index 9ea4fd1..56d1352 100644 --- a/lustre/osd-zfs/osd_xattr.c +++ b/lustre/osd-zfs/osd_xattr.c @@ -28,7 +28,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2011, 2012 Whamcloud, Inc. + * Copyright (c) 2012, Intel Corporation. * Use is subject to license terms. */ /* @@ -234,9 +234,9 @@ int osd_xattr_get(const struct lu_env *env, struct dt_object *dt, LASSERT(osd_invariant(obj)); LASSERT(dt_object_exists(dt)); - cfs_down(&obj->oo_guard); + down(&obj->oo_guard); rc = __osd_xattr_get(env, obj, buf, name, &size); - cfs_up(&obj->oo_guard); + up(&obj->oo_guard); if (rc == -ENOENT) rc = -ENODATA; @@ -321,9 +321,9 @@ int osd_declare_xattr_set(const struct lu_env *env, struct dt_object *dt, LASSERT(handle != NULL); oh = container_of0(handle, struct osd_thandle, ot_super); - cfs_down(&obj->oo_guard); + down(&obj->oo_guard); __osd_xattr_declare_set(env, obj, buf->lb_len, name, oh); - cfs_up(&obj->oo_guard); + up(&obj->oo_guard); RETURN(0); } @@ -435,7 +435,7 @@ int __osd_sa_xattr_set(const struct lu_env *env, struct osd_object *obj, return rc; } -static int +int __osd_xattr_set(const struct lu_env *env, struct osd_object *obj, const struct lu_buf *buf, const char *name, int fl, struct osd_thandle *oh) @@ -457,7 +457,8 @@ __osd_xattr_set(const struct lu_env *env, struct osd_object *obj, la->la_valid = LA_MODE; la->la_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; - rc = __osd_zap_create(env, uos, &xa_zap_db, tx, la, FTAG, 0); + rc = __osd_zap_create(env, uos, &xa_zap_db, tx, la, + obj->oo_db->db_object, FTAG, 0); if (rc) return rc; @@ -512,7 +513,8 @@ __osd_xattr_set(const struct lu_env *env, struct osd_object *obj, la->la_valid = LA_MODE; la->la_mode = S_IFREG | S_IRUGO | S_IWUSR; - rc = __osd_object_create(env, uos, &xa_data_db, tx, la, FTAG); + rc = __osd_object_create(env, uos, &xa_data_db, tx, la, + obj->oo_xattr, FTAG); if (rc) goto out; xa_data_obj = xa_data_db->db_object; @@ -549,8 +551,8 @@ out: } int osd_xattr_set(const struct lu_env *env, struct dt_object *dt, - const struct lu_buf *buf, const char *name, int fl, - struct thandle *handle, struct lustre_capa *capa) + const struct lu_buf *buf, const char *name, int fl, + struct thandle *handle, struct lustre_capa *capa) { struct osd_object *obj = osd_dt_obj(dt); struct osd_thandle *oh; @@ -564,14 +566,11 @@ int osd_xattr_set(const struct lu_env *env, struct dt_object *dt, oh = container_of0(handle, struct osd_thandle, ot_super); - cfs_down(&obj->oo_guard); + down(&obj->oo_guard); CDEBUG(D_INODE, "Setting xattr %s with size %d\n", name, (int)buf->lb_len); - rc = __osd_sa_xattr_set(env, obj, buf, name, fl, oh); - /* place xattr in dnode if SA is full */ - if (rc == -EFBIG) - rc = __osd_xattr_set(env, obj, buf, name, fl, oh); - cfs_up(&obj->oo_guard); + rc = osd_xattr_set_internal(env, obj, buf, name, fl, oh, capa); + up(&obj->oo_guard); RETURN(rc); } @@ -628,9 +627,9 @@ int osd_declare_xattr_del(const struct lu_env *env, struct dt_object *dt, LASSERT(oh->ot_tx != NULL); LASSERT(obj->oo_db != NULL); - cfs_down(&obj->oo_guard); + down(&obj->oo_guard); __osd_xattr_declare_del(env, obj, name, oh); - cfs_up(&obj->oo_guard); + up(&obj->oo_guard); RETURN(0); } @@ -703,9 +702,9 @@ int osd_xattr_del(const struct lu_env *env, struct dt_object *dt, oh = container_of0(handle, struct osd_thandle, ot_super); LASSERT(oh->ot_tx != NULL); - cfs_down(&obj->oo_guard); + down(&obj->oo_guard); rc = __osd_xattr_del(env, obj, name, oh); - cfs_up(&obj->oo_guard); + up(&obj->oo_guard); RETURN(rc); } @@ -758,7 +757,7 @@ int osd_xattr_list(const struct lu_env *env, struct dt_object *dt, LASSERT(osd_invariant(obj)); LASSERT(dt_object_exists(dt)); - cfs_down(&obj->oo_guard); + down(&obj->oo_guard); rc = osd_sa_xattr_list(env, obj, lb); if (rc < 0) @@ -798,7 +797,7 @@ int osd_xattr_list(const struct lu_env *env, struct dt_object *dt, out_fini: udmu_zap_cursor_fini(zc); out: - cfs_up(&obj->oo_guard); + up(&obj->oo_guard); RETURN(rc); }