From 33b89e85b76c8d33d8d4fd039f8a96e0a6509c8c Mon Sep 17 00:00:00 2001 From: nikita Date: Thu, 28 Sep 2006 21:21:15 +0000 Subject: [PATCH] introduce struct lu_buf used instead of (buf, len) pairs. --- lustre/cmm/cmm_object.c | 24 +++---- lustre/fid/fid_internal.h | 1 + lustre/fid/fid_store.c | 16 +++-- lustre/include/dt_object.h | 18 +++-- lustre/include/lu_object.h | 11 +++ lustre/include/md_object.h | 51 +++++-------- .../patches/ext3-orphans-delay.patch | 4 +- lustre/mdd/mdd_handler.c | 83 ++++++++++++++-------- lustre/mdd/mdd_internal.h | 7 +- lustre/mdd/mdd_lov.c | 44 ++++++------ lustre/mdt/mdt_capa.c | 7 +- lustre/mdt/mdt_handler.c | 22 +++--- lustre/mdt/mdt_internal.h | 14 ++-- lustre/mdt/mdt_recovery.c | 50 +++++++++---- lustre/mdt/mdt_rmtacl.c | 8 +-- lustre/mdt/mdt_xattr.c | 50 +++++++------ lustre/obdclass/lu_object.c | 6 ++ lustre/osd/osd_handler.c | 21 +++--- 18 files changed, 257 insertions(+), 180 deletions(-) diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 0cb9b61..4ba4444 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -246,40 +246,40 @@ static int cml_attr_set(const struct lu_env *env, struct md_object *mo, } static int cml_xattr_get(const struct lu_env *env, struct md_object *mo, - void *buf, int buflen, const char *name, + struct lu_buf *buf, const char *name, struct md_ucred *uc) { int rc; ENTRY; - rc = mo_xattr_get(env, md_object_next(mo), buf, buflen, name, uc); + rc = mo_xattr_get(env, md_object_next(mo), buf, name, uc); RETURN(rc); } static int cml_readlink(const struct lu_env *env, struct md_object *mo, - void *buf, int buflen, struct md_ucred *uc) + struct lu_buf *buf, struct md_ucred *uc) { int rc; ENTRY; - rc = mo_readlink(env, md_object_next(mo), buf, buflen, uc); + rc = mo_readlink(env, md_object_next(mo), buf, uc); RETURN(rc); } static int cml_xattr_list(const struct lu_env *env, struct md_object *mo, - void *buf, int buflen, struct md_ucred *uc) + struct lu_buf *buf, struct md_ucred *uc) { int rc; ENTRY; - rc = mo_xattr_list(env, md_object_next(mo), buf, buflen, uc); + rc = mo_xattr_list(env, md_object_next(mo), buf, uc); RETURN(rc); } static int cml_xattr_set(const struct lu_env *env, struct md_object *mo, - const void *buf, int buflen, + const struct lu_buf *buf, const char *name, int fl, struct md_ucred *uc) { int rc; ENTRY; - rc = mo_xattr_set(env, md_object_next(mo), buf, buflen, name, fl, uc); + rc = mo_xattr_set(env, md_object_next(mo), buf, name, fl, uc); RETURN(rc); } @@ -673,26 +673,26 @@ static int cmr_attr_set(const struct lu_env *env, struct md_object *mo, } static int cmr_xattr_get(const struct lu_env *env, struct md_object *mo, - void *buf, int buflen, const char *name, + struct lu_buf *buf, const char *name, struct md_ucred *uc) { RETURN(-EFAULT); } static int cmr_readlink(const struct lu_env *env, struct md_object *mo, - void *buf, int buflen, struct md_ucred *uc) + struct lu_buf *buf, struct md_ucred *uc) { RETURN(-EFAULT); } static int cmr_xattr_list(const struct lu_env *env, struct md_object *mo, - void *buf, int buflen, struct md_ucred *uc) + struct lu_buf *buf, struct md_ucred *uc) { RETURN(-EFAULT); } static int cmr_xattr_set(const struct lu_env *env, struct md_object *mo, - const void *buf, int buflen, const char *name, int fl, + const struct lu_buf *buf, const char *name, int fl, struct md_ucred *uc) { RETURN(-EFAULT); diff --git a/lustre/fid/fid_internal.h b/lustre/fid/fid_internal.h index 5009a9e..a740d4d 100644 --- a/lustre/fid/fid_internal.h +++ b/lustre/fid/fid_internal.h @@ -46,6 +46,7 @@ struct seq_thread_info { struct req_capsule sti_pill; struct seq_store_record sti_record; int sti_rep_buf_size[REQ_MAX_FIELD_NR]; + struct lu_buf sti_buf; }; extern struct lu_context_key seq_thread_key; diff --git a/lustre/fid/fid_store.c b/lustre/fid/fid_store.c index b4d1db1..3d72f1f 100644 --- a/lustre/fid/fid_store.c +++ b/lustre/fid/fid_store.c @@ -52,6 +52,16 @@ enum { SEQ_TXN_STORE_CREDITS = 20 }; +static struct lu_buf *seq_record_buf(struct seq_thread_info *info) +{ + struct lu_buf *buf; + + buf = &info->sti_buf; + buf->lb_buf = &info->sti_record; + buf->lb_len = sizeof(info->sti_record); + return buf; +} + /* this function implies that caller takes care about locking */ int seq_store_write(struct lu_server_seq *seq, const struct lu_env *env) @@ -78,8 +88,7 @@ int seq_store_write(struct lu_server_seq *seq, range_cpu_to_le(&info->sti_record.ssr_super, &seq->lss_super); rc = dt_obj->do_body_ops->dbo_write(env, dt_obj, - (char *)&info->sti_record, - sizeof(info->sti_record), + seq_record_buf(info), &pos, th); if (rc == sizeof(info->sti_record)) { CDEBUG(D_INFO|D_WARNING, "%s: Store ranges: Space - " @@ -113,8 +122,7 @@ int seq_store_read(struct lu_server_seq *seq, LASSERT(info != NULL); rc = dt_obj->do_body_ops->dbo_read(env, dt_obj, - (char *)&info->sti_record, - sizeof(info->sti_record), &pos); + seq_record_buf(info), &pos); if (rc == sizeof(info->sti_record)) { range_le_to_cpu(&seq->lss_space, &info->sti_record.ssr_space); diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 5cf2e37..d3d6855 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -171,9 +171,8 @@ struct dt_object_operations { * * precondition: dt_object_exists(dt); */ - int (*do_xattr_get)(const struct lu_env *env, - struct dt_object *dt, - void *buf, int buf_len, const char *name); + int (*do_xattr_get)(const struct lu_env *env, struct dt_object *dt, + struct lu_buf *buf, const char *name); /* * Set value of an extended attribute. * @@ -182,8 +181,7 @@ struct dt_object_operations { * precondition: dt_object_exists(dt); */ int (*do_xattr_set)(const struct lu_env *env, - struct dt_object *dt, - const void *buf, int buf_len, + struct dt_object *dt, const struct lu_buf *buf, const char *name, int fl, struct thandle *handle); /* * Delete existing extended attribute. @@ -200,7 +198,7 @@ struct dt_object_operations { * precondition: dt_object_exists(dt); */ int (*do_xattr_list)(const struct lu_env *env, - struct dt_object *dt, void *buf, int buf_len); + struct dt_object *dt, struct lu_buf *buf); /* * Create new object on this device. * @@ -245,13 +243,13 @@ struct dt_body_operations { * precondition: dt_object_exists(dt); */ ssize_t (*dbo_read)(const struct lu_env *env, struct dt_object *dt, - void *buf, size_t count, loff_t *pos); + struct lu_buf *buf, loff_t *pos); /* * precondition: dt_object_exists(dt); */ - ssize_t (*dbo_write)(const struct lu_env *env, - struct dt_object *dt, const void *buf, - size_t count, loff_t *pos, struct thandle *handle); + ssize_t (*dbo_write)(const struct lu_env *env, struct dt_object *dt, + const struct lu_buf *buf, loff_t *pos, + struct thandle *handle); }; /* diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 01541ca..f74f93f 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1027,6 +1027,17 @@ int lu_env_init(struct lu_env *env, struct lu_context *ses, __u32 tags); void lu_env_fini(struct lu_env *env); /* + * Common buffer structure to be passed around for various xattr_{s,g}et() + * methods. + */ +struct lu_buf { + void *lb_buf; + ssize_t lb_len; +}; + +extern struct lu_buf LU_BUF_NULL; /* null buffer */ + +/* * One-time initializers, called at obdclass module initialization, not * exported. */ diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index 288d370..ad6318b 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -132,26 +132,16 @@ struct md_object_operations { const struct md_attr *attr, struct md_ucred *uc); - int (*moo_xattr_get)(const struct lu_env *env, - struct md_object *obj, - void *buf, - int buf_len, - const char *name, + int (*moo_xattr_get)(const struct lu_env *env, struct md_object *obj, + struct lu_buf *buf, const char *name, struct md_ucred *uc); - int (*moo_xattr_list)(const struct lu_env *env, - struct md_object *obj, - void *buf, - int buf_len, - struct md_ucred *uc); + int (*moo_xattr_list)(const struct lu_env *env, struct md_object *obj, + struct lu_buf *buf, struct md_ucred *uc); - int (*moo_xattr_set)(const struct lu_env *env, - struct md_object *obj, - const void *buf, - int buf_len, - const char *name, - int fl, - struct md_ucred *uc); + int (*moo_xattr_set)(const struct lu_env *env, struct md_object *obj, + const struct lu_buf *buf, const char *name, + int fl, struct md_ucred *uc); int (*moo_xattr_del)(const struct lu_env *env, struct md_object *obj, @@ -163,11 +153,8 @@ struct md_object_operations { const struct lu_rdpg *rdpg, struct md_ucred *uc); - int (*moo_readlink)(const struct lu_env *env, - struct md_object *obj, - void *buf, - int buf_len, - struct md_ucred *uc); + int (*moo_readlink)(const struct lu_env *env, struct md_object *obj, + struct lu_buf *buf, struct md_ucred *uc); /* part of cross-ref operation */ int (*moo_object_create)(const struct lu_env *env, @@ -389,12 +376,11 @@ static inline int mo_attr_get(const struct lu_env *env, static inline int mo_readlink(const struct lu_env *env, struct md_object *m, - void *buf, - int buf_len, + struct lu_buf *buf, struct md_ucred *uc) { LASSERT(m->mo_ops->moo_readlink); - return m->mo_ops->moo_readlink(env, m, buf, buf_len, uc); + return m->mo_ops->moo_readlink(env, m, buf, uc); } static inline int mo_attr_set(const struct lu_env *env, @@ -408,13 +394,12 @@ static inline int mo_attr_set(const struct lu_env *env, static inline int mo_xattr_get(const struct lu_env *env, struct md_object *m, - void *buf, - int buf_len, + struct lu_buf *buf, const char *name, struct md_ucred *uc) { LASSERT(m->mo_ops->moo_xattr_get); - return m->mo_ops->moo_xattr_get(env, m, buf, buf_len, name, uc); + return m->mo_ops->moo_xattr_get(env, m, buf, name, uc); } static inline int mo_xattr_del(const struct lu_env *env, @@ -428,24 +413,22 @@ static inline int mo_xattr_del(const struct lu_env *env, static inline int mo_xattr_set(const struct lu_env *env, struct md_object *m, - const void *buf, - int buf_len, + const struct lu_buf *buf, const char *name, int flags, struct md_ucred *uc) { LASSERT(m->mo_ops->moo_xattr_set); - return m->mo_ops->moo_xattr_set(env, m, buf, buf_len, name, flags, uc); + return m->mo_ops->moo_xattr_set(env, m, buf, name, flags, uc); } static inline int mo_xattr_list(const struct lu_env *env, struct md_object *m, - void *buf, - int buf_len, + struct lu_buf *buf, struct md_ucred *uc) { LASSERT(m->mo_ops->moo_xattr_list); - return m->mo_ops->moo_xattr_list(env, m, buf, buf_len, uc); + return m->mo_ops->moo_xattr_list(env, m, buf, uc); } static inline int mo_open(const struct lu_env *env, diff --git a/lustre/kernel_patches/patches/ext3-orphans-delay.patch b/lustre/kernel_patches/patches/ext3-orphans-delay.patch index df3e8dd..fad98e7 100644 --- a/lustre/kernel_patches/patches/ext3-orphans-delay.patch +++ b/lustre/kernel_patches/patches/ext3-orphans-delay.patch @@ -1,7 +1,7 @@ Index: iam/fs/ext3/super.c =================================================================== ---- iam.orig/fs/ext3/super.c 2006-09-28 22:41:30.000000000 +0400 -+++ iam/fs/ext3/super.c 2006-09-28 22:41:31.000000000 +0400 +--- iam.orig/fs/ext3/super.c 2006-09-29 01:08:34.000000000 +0400 ++++ iam/fs/ext3/super.c 2006-09-29 01:08:34.000000000 +0400 @@ -1168,8 +1168,8 @@ static int ext3_check_descriptors (struc * e2fsck was run on this filesystem, and it must have already done the orphan * inode cleanup for us, so we can safely abort without any further action. diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index e922c70..3a2ce3a 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -203,6 +203,27 @@ static void mdd_txn_param_build(const struct lu_env *env, mdd_env_info(env)->mti_param.tp_credits = opd->mod_credits; } +struct lu_buf *mdd_buf_get(const struct lu_env *env, void *area, ssize_t len) +{ + struct lu_buf *buf; + + buf = &mdd_env_info(env)->mti_buf; + buf->lb_buf = area; + buf->lb_len = len; + return buf; +} + +const struct lu_buf *mdd_buf_get_const(const struct lu_env *env, + const void *area, ssize_t len) +{ + struct lu_buf *buf; + + buf = &mdd_env_info(env)->mti_buf; + buf->lb_buf = (void *)area; + buf->lb_len = len; + return buf; +} + #define mdd_get_group_info(group_info) do { \ atomic_inc(&(group_info)->usage); \ } while (0) @@ -664,7 +685,7 @@ static int mdd_attr_get(const struct lu_env *env, struct md_object *obj, * No permission check is needed. */ static int mdd_xattr_get(const struct lu_env *env, - struct md_object *obj, void *buf, int buf_len, + struct md_object *obj, struct lu_buf *buf, const char *name, struct md_ucred *uc) { struct mdd_object *mdd_obj = md2mdd_obj(obj); @@ -677,7 +698,7 @@ static int mdd_xattr_get(const struct lu_env *env, next = mdd_object_child(mdd_obj); mdd_read_lock(env, mdd_obj); - rc = next->do_ops->do_xattr_get(env, next, buf, buf_len, name); + rc = next->do_ops->do_xattr_get(env, next, buf, name); mdd_read_unlock(env, mdd_obj); RETURN(rc); @@ -688,7 +709,7 @@ static int mdd_xattr_get(const struct lu_env *env, * no need check again. */ static int mdd_readlink(const struct lu_env *env, struct md_object *obj, - void *buf, int buf_len, struct md_ucred *uc) + struct lu_buf *buf, struct md_ucred *uc) { struct mdd_object *mdd_obj = md2mdd_obj(obj); struct dt_object *next; @@ -700,13 +721,13 @@ static int mdd_readlink(const struct lu_env *env, struct md_object *obj, next = mdd_object_child(mdd_obj); mdd_read_lock(env, mdd_obj); - rc = next->do_body_ops->dbo_read(env, next, buf, buf_len, &pos); + rc = next->do_body_ops->dbo_read(env, next, buf, &pos); mdd_read_unlock(env, mdd_obj); RETURN(rc); } static int mdd_xattr_list(const struct lu_env *env, struct md_object *obj, - void *buf, int buf_len, struct md_ucred *uc) + struct lu_buf *buf, struct md_ucred *uc) { struct mdd_object *mdd_obj = md2mdd_obj(obj); struct dt_object *next; @@ -718,7 +739,7 @@ static int mdd_xattr_list(const struct lu_env *env, struct md_object *obj, next = mdd_object_child(mdd_obj); mdd_read_lock(env, mdd_obj); - rc = next->do_ops->do_xattr_list(env, next, buf, buf_len); + rc = next->do_ops->do_xattr_list(env, next, buf); mdd_read_unlock(env, mdd_obj); RETURN(rc); @@ -978,7 +999,7 @@ int mdd_attr_set_internal_locked(const struct lu_env *env, } static int __mdd_xattr_set(const struct lu_env *env, struct mdd_object *o, - const void *buf, int buf_len, const char *name, + const struct lu_buf *buf, const char *name, int fl, struct thandle *handle) { struct dt_object *next; @@ -987,10 +1008,10 @@ static int __mdd_xattr_set(const struct lu_env *env, struct mdd_object *o, LASSERT(lu_object_exists(mdd2lu_obj(o))); next = mdd_object_child(o); - if (buf && buf_len > 0) { - rc = next->do_ops->do_xattr_set(env, next, buf, buf_len, name, + if (buf->lb_buf && buf->lb_len > 0) { + rc = next->do_ops->do_xattr_set(env, next, buf, name, 0, handle); - }else if (buf == NULL && buf_len == 0) { + } else if (buf->lb_buf == NULL && buf->lb_len == 0) { rc = next->do_ops->do_xattr_del(env, next, name, handle); } RETURN(rc); @@ -1255,14 +1276,14 @@ cleanup: } int mdd_xattr_set_txn(const struct lu_env *env, struct mdd_object *obj, - const void *buf, int buf_len, const char *name, int fl, + const struct lu_buf *buf, const char *name, int fl, struct thandle *handle) { int rc; ENTRY; mdd_write_lock(env, obj); - rc = __mdd_xattr_set(env, obj, buf, buf_len, name, fl, handle); + rc = __mdd_xattr_set(env, obj, buf, name, fl, handle); mdd_write_unlock(env, obj); RETURN(rc); @@ -1292,7 +1313,7 @@ static int mdd_xattr_sanity_check(const struct lu_env *env, } static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj, - const void *buf, int buf_len, const char *name, int fl, + const struct lu_buf *buf, const char *name, int fl, struct md_ucred *uc) { struct mdd_object *mdd_obj = md2mdd_obj(obj); @@ -1310,7 +1331,7 @@ static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj, if (IS_ERR(handle)) RETURN(PTR_ERR(handle)); - rc = mdd_xattr_set_txn(env, md2mdd_obj(obj), buf, buf_len, name, + rc = mdd_xattr_set_txn(env, md2mdd_obj(obj), buf, name, fl, handle); #ifdef HAVE_SPLIT_SUPPORT if (rc == 0) { @@ -2345,8 +2366,11 @@ static int mdd_create(const struct lu_env *env, int sym_len = strlen(target_name); loff_t pos = 0; - rc = dt->do_body_ops->dbo_write(env, dt, target_name, - sym_len, &pos, handle); + rc = dt->do_body_ops->dbo_write(env, dt, + mdd_buf_get_const(env, + target_name, + sym_len), + &pos, handle); if (rc == sym_len) rc = 0; else @@ -2440,9 +2464,11 @@ static int mdd_object_create(const struct lu_env *env, rc = __mdd_object_create(env, mdd_obj, ma, handle); if (rc == 0 && spec->sp_cr_flags & MDS_CREATE_SLAVE_OBJ) { /* if creating the slave object, set slave EA here */ - rc = __mdd_xattr_set(env, mdd_obj, spec->u.sp_ea.eadata, - spec->u.sp_ea.eadatalen, MDS_LMV_MD_NAME, - 0, handle); + rc = __mdd_xattr_set(env, mdd_obj, + mdd_buf_get_const(env, + spec->u.sp_ea.eadata, + spec->u.sp_ea.eadatalen), + MDS_LMV_MD_NAME, 0, handle); pfid = spec->u.sp_ea.fid; CWARN("set slave ea "DFID" eadatalen %d rc %d \n", PFID(mdo2fid(mdd_obj)), spec->u.sp_ea.eadatalen, rc); @@ -2999,24 +3025,23 @@ static int mdd_check_acl(const struct lu_env *env, struct mdd_object *obj, struct lu_attr* la, int mask, struct md_ucred *uc) { #ifdef CONFIG_FS_POSIX_ACL - struct dt_object *next; - void *buf; - int buf_len; + struct dt_object *next; + struct lu_buf *buf = &mdd_env_info(env)->mti_buf; posix_acl_xattr_entry *entry; int entry_count; int rc; ENTRY; next = mdd_object_child(obj); - buf_len = next->do_ops->do_xattr_get(env, next, NULL, 0, ""); - if (buf_len <= 0) - RETURN(buf_len ? : -EACCES); + buf->lb_len = next->do_ops->do_xattr_get(env, next, &LU_BUF_NULL, ""); + if (buf->lb_len <= 0) + RETURN(buf->lb_len ? : -EACCES); - OBD_ALLOC(buf, buf_len); - if (buf == NULL) + OBD_ALLOC(buf->lb_buf, buf->lb_len); + if (buf->lb_buf == NULL) RETURN(-ENOMEM); - rc = next->do_ops->do_xattr_get(env, next, buf, buf_len, ""); + rc = next->do_ops->do_xattr_get(env, next, buf, ""); if (rc <= 0) GOTO(out, rc = rc ? : -EACCES); @@ -3026,7 +3051,7 @@ static int mdd_check_acl(const struct lu_env *env, struct mdd_object *obj, rc = mdd_posix_acl_permission(uc, la, mask, entry, entry_count); out: - OBD_FREE(buf, buf_len); + OBD_FREE(buf->lb_buf, buf->lb_len); RETURN(rc); #else ENTRY; diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index 93574ce..4b8b832 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -81,13 +81,14 @@ struct mdd_thread_info { struct obd_info mti_oi; struct orph_key mti_orph_key; struct obd_trans_info mti_oti; + struct lu_buf mti_buf; }; int mdd_init_obd(const struct lu_env *env, struct mdd_device *mdd, struct lustre_cfg *cfg); int mdd_fini_obd(const struct lu_env *, struct mdd_device *); int mdd_xattr_set_txn(const struct lu_env *env, struct mdd_object *obj, - const void *buf, int buf_len, const char *name, int fl, + const struct lu_buf *buf, const char *name, int fl, struct thandle *txn); int mdd_lov_set_md(const struct lu_env *env, struct mdd_object *pobj, struct mdd_object *child, struct lov_mds_md *lmm, @@ -116,6 +117,10 @@ int mdd_lov_setattr_async(const struct lu_env *env, struct mdd_object *obj, struct mdd_thread_info *mdd_env_info(const struct lu_env *env); +struct lu_buf *mdd_buf_get(const struct lu_env *env, void *area, ssize_t len); +const struct lu_buf *mdd_buf_get_const(const struct lu_env *env, + const void *area, ssize_t len); + void mdd_read_lock(const struct lu_env *env, struct mdd_object *obj); void mdd_read_unlock(const struct lu_env *env, struct mdd_object *obj); void mdd_write_lock(const struct lu_env *env, struct mdd_object *obj); diff --git a/lustre/mdd/mdd_lov.c b/lustre/mdd/mdd_lov.c index 9f1847e..48a28ab 100644 --- a/lustre/mdd/mdd_lov.c +++ b/lustre/mdd/mdd_lov.c @@ -184,11 +184,12 @@ int mdd_get_md(const struct lu_env *env, struct mdd_object *obj, void *md, int *md_size, const char *name) { struct dt_object *next; - int rc = 0; + int rc; ENTRY; next = mdd_object_child(obj); - rc = next->do_ops->do_xattr_get(env, next, md, *md_size, name); + rc = next->do_ops->do_xattr_get(env, next, + mdd_buf_get(env, md, *md_size), name); /* * XXX: handling of -ENODATA, the right way is to have ->do_md_get() * exported by dt layer. @@ -198,7 +199,7 @@ int mdd_get_md(const struct lu_env *env, struct mdd_object *obj, rc = 0; } else if (rc < 0) { CERROR("Error %d reading eadata \n", rc); - } else if (rc > 0) { + } else { /* FIXME convert lov EA but fixed after verification test */ *md_size = rc; } @@ -217,8 +218,8 @@ int mdd_get_md_locked(const struct lu_env *env, struct mdd_object *obj, } static int mdd_lov_set_stripe_md(const struct lu_env *env, - struct mdd_object *obj, struct lov_mds_md *lmmp, - int lmm_size, struct thandle *handle) + struct mdd_object *obj, struct lu_buf *buf, + struct thandle *handle) { struct mdd_device *mdd = mdo2mdd(&obj->mod_obj); struct obd_device *obd = mdd2obd_dev(mdd); @@ -228,21 +229,21 @@ static int mdd_lov_set_stripe_md(const struct lu_env *env, ENTRY; LASSERT(S_ISDIR(mdd_object_type(obj)) || S_ISREG(mdd_object_type(obj))); - rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE, lov_exp, 0, &lsm, lmmp); + rc = obd_iocontrol(OBD_IOC_LOV_SETSTRIPE, lov_exp, 0, + &lsm, buf->lb_buf); if (rc) RETURN(rc); obd_free_memmd(lov_exp, &lsm); - rc = mdd_xattr_set_txn(env, obj, lmmp, lmm_size, MDS_LOV_MD_NAME, 0, - handle); + rc = mdd_xattr_set_txn(env, obj, buf, MDS_LOV_MD_NAME, 0, handle); CDEBUG(D_INFO, "set lov ea of "DFID" rc %d \n", PFID(mdo2fid(obj)), rc); RETURN(rc); } static int mdd_lov_set_dir_md(const struct lu_env *env, - struct mdd_object *obj, struct lov_mds_md *lmmp, - int lmm_size, struct thandle *handle) + struct mdd_object *obj, struct lu_buf *buf, + struct thandle *handle) { struct lov_user_md *lum = NULL; int rc = 0; @@ -250,7 +251,7 @@ static int mdd_lov_set_dir_md(const struct lu_env *env, /*TODO check permission*/ LASSERT(S_ISDIR(mdd_object_type(obj))); - lum = (struct lov_user_md*)lmmp; + lum = (struct lov_user_md*)buf->lb_buf; /* if { size, offset, count } = { 0, -1, 0 } (i.e. all default * values specified) then delete default striping from dir. */ @@ -258,14 +259,14 @@ static int mdd_lov_set_dir_md(const struct lu_env *env, lum->lmm_stripe_offset == (typeof(lum->lmm_stripe_offset))(-1)) || /* lmm_stripe_size == -1 is deprecated in 1.4.6 */ lum->lmm_stripe_size == (typeof(lum->lmm_stripe_size))(-1)){ - rc = mdd_xattr_set_txn(env, obj, NULL, 0, MDS_LOV_MD_NAME, 0, - handle); + rc = mdd_xattr_set_txn(env, obj, &LU_BUF_NULL, + MDS_LOV_MD_NAME, 0, handle); if (rc == -ENODATA) rc = 0; CDEBUG(D_INFO, "delete lov ea of "DFID" rc %d \n", PFID(mdo2fid(obj)), rc); } else { - rc = mdd_lov_set_stripe_md(env, obj, lmmp, lmm_size, handle); + rc = mdd_lov_set_stripe_md(env, obj, buf, handle); } RETURN(rc); } @@ -276,15 +277,16 @@ int mdd_lov_set_md(const struct lu_env *env, struct mdd_object *pobj, { int rc = 0; umode_t mode; + struct lu_buf *buf; ENTRY; + buf = mdd_buf_get(env, lmmp, lmm_size); mode = mdd_object_type(child); if (S_ISREG(mode) && lmm_size > 0) { if (set_stripe) { - rc = mdd_lov_set_stripe_md(env, child, lmmp, lmm_size, - handle); + rc = mdd_lov_set_stripe_md(env, child, buf, handle); } else { - rc = mdd_xattr_set_txn(env, child, lmmp, lmm_size, + rc = mdd_xattr_set_txn(env, child, buf, MDS_LOV_MD_NAME, 0, handle); } } else if (S_ISDIR(mode)) { @@ -297,16 +299,16 @@ int mdd_lov_set_md(const struct lu_env *env, struct mdd_object *pobj, rc = mdd_get_md(env, pobj, &lmm, &size, MDS_LOV_MD_NAME); if (rc > 0) { - rc = mdd_xattr_set_txn(env, child, lmm, size, + buf = mdd_buf_get(env, lmm, size); + rc = mdd_xattr_set_txn(env, child, buf, MDS_LOV_MD_NAME, 0, handle); if (rc) CERROR("error on copy stripe info: rc " "= %d\n", rc); } } else { - LASSERT(lmmp != NULL && lmm_size > 0); - rc = mdd_lov_set_dir_md(env, child, lmmp, - lmm_size, handle); + LASSERT(lmmp != NULL && lmm_size > 0); + rc = mdd_lov_set_dir_md(env, child, buf, handle); } } CDEBUG(D_INFO, "Set lov md %p size %d for fid "DFID" rc %d\n", diff --git a/lustre/mdt/mdt_capa.c b/lustre/mdt/mdt_capa.c index 35837ca..89f169b 100644 --- a/lustre/mdt/mdt_capa.c +++ b/lustre/mdt/mdt_capa.c @@ -89,7 +89,8 @@ static int write_capa_keys(const struct lu_env *env, for (i = 0; i < 2; i++) { lck_cpu_to_le(tmp, &keys[i]); - rc = mdt_record_write(env, mdt->mdt_ck_obj, tmp, sizeof(*tmp), + rc = mdt_record_write(env, mdt->mdt_ck_obj, + mdt_buf_const(env, tmp, sizeof(*tmp)), &off, th); if (rc) break; @@ -114,8 +115,8 @@ static int read_capa_keys(const struct lu_env *env, tmp = &mti->mti_capa_key; for (i = 0; i < 2; i++) { - rc = mdt_record_read(env, mdt->mdt_ck_obj, tmp, sizeof(*tmp), - &off); + rc = mdt_record_read(env, mdt->mdt_ck_obj, + mdt_buf(env, tmp, sizeof(*tmp)), &off); if (rc) return rc; diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 5d4dcc4..5390d52 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -262,10 +262,9 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, struct md_attr *ma = &info->mti_attr; struct lu_attr *la = &ma->ma_attr; struct req_capsule *pill = &info->mti_pill; - const struct lu_env *env = info->mti_env; + const struct lu_env *env = info->mti_env; struct mdt_body *repbody; - void *buffer; - int length; + struct lu_buf *buffer = &info->mti_buf; int rc; ENTRY; @@ -325,7 +324,9 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, } } else if (S_ISLNK(la->la_mode) && reqbody->valid & OBD_MD_LINKNAME) { - rc = mo_readlink(env, next, ma->ma_lmm, ma->ma_lmm_size, NULL); + buffer->lb_buf = ma->ma_lmm; + buffer->lb_len = ma->ma_lmm_size; + rc = mo_readlink(env, next, buffer, NULL); if (rc <= 0) { CERROR("readlink failed: %d\n", rc); rc = -EFAULT; @@ -350,7 +351,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, } if (reqbody->valid & OBD_MD_FLRMTPERM) { - buffer = req_capsule_server_get(pill, &RMF_ACL); + buffer->lb_buf = req_capsule_server_get(pill, &RMF_ACL); /* mdt_getattr_lock only */ rc = mdt_pack_remote_perm(info, o, buffer); if (rc) @@ -361,10 +362,11 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, #ifdef CONFIG_FS_POSIX_ACL else if ((req->rq_export->exp_connect_flags & OBD_CONNECT_ACL) && (reqbody->valid & OBD_MD_FLACL)) { - buffer = req_capsule_server_get(pill, &RMF_ACL); - length = req_capsule_get_size(pill, &RMF_ACL, RCL_SERVER); - if (length > 0) { - rc = mo_xattr_get(env, next, buffer, length, + buffer->lb_buf = req_capsule_server_get(pill, &RMF_ACL); + buffer->lb_len = req_capsule_get_size(pill, + &RMF_ACL, RCL_SERVER); + if (buffer->lb_len > 0) { + rc = mo_xattr_get(env, next, buffer, XATTR_NAME_ACL_ACCESS, NULL); if (rc < 0) { if (rc == -ENODATA || rc == -EOPNOTSUPP) @@ -1664,7 +1666,7 @@ static void mdt_thread_info_init(struct ptlrpc_request *req, info->mti_fail_id = OBD_FAIL_MDS_ALL_REPLY_NET; info->mti_env = req->rq_svc_thread->t_env; info->mti_transno = lustre_msg_get_transno(req->rq_reqmsg); - + /* it can be NULL while CONNECT */ if (req->rq_export) info->mti_mdt = mdt_dev(req->rq_export->exp_obd->obd_lu_dev); diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index db45bac..d04fc64 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -331,6 +331,7 @@ struct mdt_thread_info { loff_t mti_off; struct txn_param mti_txn_param; struct lustre_capa_key mti_capa_key; + struct lu_buf mti_buf; }; /* * Info allocated per-transaction. @@ -470,11 +471,14 @@ struct thandle* mdt_trans_start(const struct lu_env *env, void mdt_trans_stop(const struct lu_env *env, struct mdt_device *mdt, struct thandle *th); int mdt_record_write(const struct lu_env *env, - struct dt_object *dt, const void *buf, - size_t count, loff_t *pos, struct thandle *th); + struct dt_object *dt, const struct lu_buf *buf, + loff_t *pos, struct thandle *th); int mdt_record_read(const struct lu_env *env, - struct dt_object *dt, void *buf, - size_t count, loff_t *pos); + struct dt_object *dt, struct lu_buf *buf, loff_t *pos); + +struct lu_buf *mdt_buf(const struct lu_env *env, void *area, ssize_t len); +const struct lu_buf *mdt_buf_const(const struct lu_env *env, + const void *area, ssize_t len); void mdt_dump_lmm(int level, const struct lov_mds_md *lmm); @@ -527,7 +531,7 @@ int mdt_pack_remote_perm(struct mdt_thread_info *, struct mdt_object *, void *); extern struct upcall_cache_ops mdt_rmtacl_upcall_cache_ops; int mdt_rmtacl_upcall(struct mdt_thread_info *, unsigned long, - char *, char *, int); + char *, struct lu_buf *); extern struct lu_context_key mdt_thread_key; /* debug issues helper starts here*/ diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index dc1c784..e7d5f4b 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -36,18 +36,43 @@ static int mdt_server_data_update(const struct lu_env *env, struct mdt_device *mdt); +struct lu_buf *mdt_buf(const struct lu_env *env, void *area, ssize_t len) +{ + struct lu_buf *buf; + struct mdt_thread_info *mti; + + mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); + buf = &mti->mti_buf; + buf->lb_buf = area; + buf->lb_len = len; + return buf; +} + +const struct lu_buf *mdt_buf_const(const struct lu_env *env, + const void *area, ssize_t len) +{ + struct lu_buf *buf; + struct mdt_thread_info *mti; + + mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); + buf = &mti->mti_buf; + + buf->lb_buf = (void *)area; + buf->lb_len = len; + return buf; +} + /* TODO: maybe this pair should be defined in dt_object.c */ int mdt_record_read(const struct lu_env *env, - struct dt_object *dt, void *buf, - size_t count, loff_t *pos) + struct dt_object *dt, struct lu_buf *buf, loff_t *pos) { int rc; LASSERTF(dt != NULL, "dt is NULL when we want to read record\n"); - rc = dt->do_body_ops->dbo_read(env, dt, buf, count, pos); + rc = dt->do_body_ops->dbo_read(env, dt, buf, pos); - if (rc == count) + if (rc == buf->lb_len) rc = 0; else if (rc >= 0) rc = -EFAULT; @@ -55,15 +80,15 @@ int mdt_record_read(const struct lu_env *env, } int mdt_record_write(const struct lu_env *env, - struct dt_object *dt, const void *buf, - size_t count, loff_t *pos, struct thandle *th) + struct dt_object *dt, const struct lu_buf *buf, + loff_t *pos, struct thandle *th) { int rc; LASSERTF(dt != NULL, "dt is NULL when we want to write record\n"); LASSERT(th != NULL); - rc = dt->do_body_ops->dbo_write(env, dt, buf, count, pos, th); - if (rc == count) + rc = dt->do_body_ops->dbo_write(env, dt, buf, pos, th); + if (rc == buf->lb_len) rc = 0; else if (rc >= 0) rc = -EFAULT; @@ -163,7 +188,7 @@ static int mdt_last_rcvd_header_read(const struct lu_env *env, off = &mti->mti_off; *off = 0; rc = mdt_record_read(env, mdt->mdt_last_rcvd, - tmp, sizeof(*tmp), off); + mdt_buf(env, tmp, sizeof(*tmp)), off); if (rc == 0) msd_le_to_cpu(tmp, msd); @@ -200,7 +225,7 @@ static int mdt_last_rcvd_header_write(const struct lu_env *env, msd_cpu_to_le(msd, tmp); rc = mdt_record_write(env, mdt->mdt_last_rcvd, - tmp, sizeof(*tmp), off, th); + mdt_buf_const(env, tmp, sizeof(*tmp)), off, th); mdt_trans_stop(env, mdt, th); @@ -223,7 +248,8 @@ static int mdt_last_rcvd_read(const struct lu_env *env, mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); tmp = &mti->mti_mcd; - rc = mdt_record_read(env, mdt->mdt_last_rcvd, tmp, sizeof(*tmp), off); + rc = mdt_record_read(env, mdt->mdt_last_rcvd, + mdt_buf(env, tmp, sizeof(*tmp)), off); if (rc == 0) mcd_le_to_cpu(tmp, mcd); @@ -266,7 +292,7 @@ static int mdt_last_rcvd_write(const struct lu_env *env, mcd_cpu_to_le(mcd, tmp); rc = mdt_record_write(env, mdt->mdt_last_rcvd, - tmp, sizeof(*tmp), off, th); + mdt_buf_const(env, tmp, sizeof(*tmp)), off, th); CDEBUG(D_INFO, "write mcd @%d rc = %d:\n" "uuid = %s\n" diff --git a/lustre/mdt/mdt_rmtacl.c b/lustre/mdt/mdt_rmtacl.c index 9e9f082..c0b136d 100644 --- a/lustre/mdt/mdt_rmtacl.c +++ b/lustre/mdt/mdt_rmtacl.c @@ -196,7 +196,7 @@ struct upcall_cache_ops mdt_rmtacl_upcall_cache_ops = { }; int mdt_rmtacl_upcall(struct mdt_thread_info *info, unsigned long key, - char *cmd, char *buf, int buflen) + char *cmd, struct lu_buf *buf) { struct ptlrpc_request *req = mdt_info_req(info); struct obd_device *obd = req->rq_export->exp_obd; @@ -232,17 +232,17 @@ int mdt_rmtacl_upcall(struct mdt_thread_info *info, unsigned long key, if (IS_ERR(entry)) GOTO(out, rc = PTR_ERR(entry)); - if (buflen <= strlen(entry->u.acl.ra_buf)) + if (buf->lb_len <= strlen(entry->u.acl.ra_buf)) GOTO(out, rc = -EFAULT); - memcpy(buf, entry->u.acl.ra_buf, strlen(entry->u.acl.ra_buf)); + memcpy(buf->lb_buf, entry->u.acl.ra_buf, strlen(entry->u.acl.ra_buf)); /* remote acl operation expire at once! */ UC_CACHE_SET_EXPIRED(entry); upcall_cache_put_entry(mdt->mdt_rmtacl_cache, entry); out: if (rc) - sprintf(buf, "server processing error: %d\n", rc); + sprintf(buf->lb_buf, "server processing error: %d\n", rc); OBD_FREE(tmp, PAGE_SIZE); RETURN(0); } diff --git a/lustre/mdt/mdt_xattr.c b/lustre/mdt/mdt_xattr.c index c6bc677..9001e147 100644 --- a/lustre/mdt/mdt_xattr.c +++ b/lustre/mdt/mdt_xattr.c @@ -73,11 +73,11 @@ static int mdt_getxattr_pack_reply(struct mdt_thread_info * info) else rc = mo_xattr_get(info->mti_env, mdt_object_child(info->mti_object), - NULL, 0, xattr_name, NULL); + &LU_BUF_NULL, xattr_name, NULL); } else if ((valid & OBD_MD_FLXATTRLS) == OBD_MD_FLXATTRLS) { rc = mo_xattr_list(info->mti_env, mdt_object_child(info->mti_object), - NULL, 0, NULL); + &LU_BUF_NULL, NULL); } else { CERROR("valid bits: "LPX64"\n", info->mti_body->valid); return -EINVAL; @@ -100,14 +100,14 @@ static int mdt_getxattr_pack_reply(struct mdt_thread_info * info) } static int do_remote_getfacl(struct mdt_thread_info *info, - struct lu_fid *fid, void *buf, int buflen) + struct lu_fid *fid, struct lu_buf *buf) { struct ptlrpc_request *req = mdt_info_req(info); char *cmd; int rc; ENTRY; - if (!buf || (buflen != RMTACL_SIZE_MAX)) + if (!buf->lb_buf || (buf->lb_len != RMTACL_SIZE_MAX)) RETURN(-EINVAL); cmd = req_capsule_client_get(&info->mti_pill, &RMF_EADATA); @@ -116,12 +116,12 @@ static int do_remote_getfacl(struct mdt_thread_info *info, RETURN(-EFAULT); } - rc = mdt_rmtacl_upcall(info, fid_oid(fid), cmd, buf, buflen); + rc = mdt_rmtacl_upcall(info, fid_oid(fid), cmd, buf); if (rc) CERROR("remote acl upcall failed: %d\n", rc); - lustre_shrink_reply(req, REPLY_REC_OFF + 1, strlen(buf) + 1, 0); - RETURN(rc ?: strlen(buf) + 1); + lustre_shrink_reply(req, REPLY_REC_OFF + 1, strlen(buf->lb_buf) + 1, 0); + RETURN(rc ?: strlen(buf->lb_buf) + 1); } int mdt_getxattr(struct mdt_thread_info *info) @@ -129,8 +129,7 @@ int mdt_getxattr(struct mdt_thread_info *info) struct mdt_body *reqbody; struct mdt_body *repbody; struct md_object *next; - char *buf; - int buflen; + struct lu_buf *buf; int rc, rc1; ENTRY; @@ -160,8 +159,9 @@ int mdt_getxattr(struct mdt_thread_info *info) if (rc == 0) GOTO(no_xattr, rc); - buf = req_capsule_server_get(&info->mti_pill, &RMF_EADATA); - buflen = rc; + buf = &info->mti_buf; + buf->lb_buf = req_capsule_server_get(&info->mti_pill, &RMF_EADATA); + buf->lb_len = rc; if (info->mti_body->valid & OBD_MD_FLXATTR) { char *xattr_name = req_capsule_client_get(&info->mti_pill, @@ -172,10 +172,9 @@ int mdt_getxattr(struct mdt_thread_info *info) struct mdt_body *body = (struct mdt_body *)info->mti_body; - rc = do_remote_getfacl(info, &body->fid1, - buf, buflen); + rc = do_remote_getfacl(info, &body->fid1, buf); } else { - rc = mo_xattr_get(info->mti_env, next, buf, buflen, + rc = mo_xattr_get(info->mti_env, next, buf, xattr_name, NULL); } @@ -185,7 +184,7 @@ int mdt_getxattr(struct mdt_thread_info *info) } else if (info->mti_body->valid & OBD_MD_FLXATTRLS) { CDEBUG(D_INODE, "listxattr\n"); - rc = mo_xattr_list(info->mti_env, next, buf, buflen, NULL); + rc = mo_xattr_list(info->mti_env, next, buf, NULL); if (rc < 0) CDEBUG(D_OTHER, "listxattr failed: %d\n", rc); } else @@ -227,8 +226,9 @@ static int mdt_setxattr_pack_reply(struct mdt_thread_info * info) static int do_remote_setfacl(struct mdt_thread_info *info, struct lu_fid *fid) { - struct ptlrpc_request *req = mdt_info_req(info); - char *cmd, *buf; + struct ptlrpc_request *req = mdt_info_req(info); + struct lu_buf *buf = &info->mti_buf; + char *cmd; int rc; ENTRY; @@ -238,14 +238,15 @@ static int do_remote_setfacl(struct mdt_thread_info *info, struct lu_fid *fid) RETURN(-EFAULT); } - buf = req_capsule_server_get(&info->mti_pill, &RMF_EADATA); - LASSERT(buf); + buf->lb_buf = req_capsule_server_get(&info->mti_pill, &RMF_EADATA); + LASSERT(buf->lb_buf); + buf->lb_len = RMTACL_SIZE_MAX; - rc = mdt_rmtacl_upcall(info, fid_oid(fid), cmd, buf, RMTACL_SIZE_MAX); + rc = mdt_rmtacl_upcall(info, fid_oid(fid), cmd, buf); if (rc) CERROR("remote acl upcall failed: %d\n", rc); - lustre_shrink_reply(req, REPLY_REC_OFF, strlen(buf) + 1, 0); + lustre_shrink_reply(req, REPLY_REC_OFF, strlen(buf->lb_buf) + 1, 0); RETURN(rc); } @@ -259,8 +260,9 @@ int mdt_setxattr(struct mdt_thread_info *info) struct req_capsule *pill = &info->mti_pill; struct mdt_object *obj = info->mti_object; struct mdt_body *body = (struct mdt_body *)info->mti_body; - const struct lu_env *env = info->mti_env; + const struct lu_env *env = info->mti_env; struct md_object *child = mdt_object_child(obj); + struct lu_buf *buf = &info->mti_buf; __u64 valid = body->valid; char *xattr_name; int xattr_len; @@ -340,7 +342,9 @@ int mdt_setxattr(struct mdt_thread_info *info) mdt_fail_write(env, info->mti_mdt->mdt_bottom, OBD_FAIL_MDS_SETXATTR_WRITE); - rc = mo_xattr_set(env, child, xattr, xattr_len, + buf->lb_buf = xattr; + buf->lb_len = xattr_len; + rc = mo_xattr_set(env, child, buf, xattr_name, flags, &info->mti_uc); } } else if ((valid & OBD_MD_FLXATTRRM) == OBD_MD_FLXATTRRM) { diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index b040f5d..e3a81c9 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -947,3 +947,9 @@ void lu_global_fini(void) { lu_context_key_degister(&lu_cdebug_key); } + +struct lu_buf LU_BUF_NULL = { + .lb_buf = NULL, + .lb_len = 0 +}; +EXPORT_SYMBOL(LU_BUF_NULL); diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 5f34454..7aad5d2 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -1109,7 +1109,7 @@ static void osd_object_ref_del(const struct lu_env *env, } static int osd_xattr_get(const struct lu_env *env, struct dt_object *dt, - void *buf, int size, const char *name) + struct lu_buf *buf, const char *name) { struct osd_object *obj = osd_dt_obj(dt); struct inode *inode = obj->oo_inode; @@ -1124,11 +1124,11 @@ static int osd_xattr_get(const struct lu_env *env, struct dt_object *dt, return -EACCES; dentry->d_inode = inode; - return inode->i_op->getxattr(dentry, name, buf, size); + return inode->i_op->getxattr(dentry, name, buf->lb_buf, buf->lb_len); } static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt, - const void *buf, int size, const char *name, int fl, + const struct lu_buf *buf, const char *name, int fl, struct thandle *handle) { int fs_flags; @@ -1155,11 +1155,12 @@ static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt, if (fl & LU_XATTR_CREATE) fs_flags |= XATTR_CREATE; - return inode->i_op->setxattr(dentry, name, buf, size, fs_flags); + return inode->i_op->setxattr(dentry, name, + buf->lb_buf, buf->lb_len, fs_flags); } static int osd_xattr_list(const struct lu_env *env, struct dt_object *dt, - void *buf, int size) + struct lu_buf *buf) { struct osd_object *obj = osd_dt_obj(dt); struct inode *inode = obj->oo_inode; @@ -1174,7 +1175,7 @@ static int osd_xattr_list(const struct lu_env *env, struct dt_object *dt, return -EACCES; dentry->d_inode = inode; - return inode->i_op->listxattr(dentry, buf, size); + return inode->i_op->listxattr(dentry, buf->lb_buf, buf->lb_len); } static int osd_xattr_del(const struct lu_env *env, struct dt_object *dt, @@ -1368,7 +1369,7 @@ static struct dt_object_operations osd_obj_ops = { */ static ssize_t osd_read(const struct lu_env *env, struct dt_object *dt, - void *buf, size_t count, loff_t *pos) + struct lu_buf *buf, loff_t *pos) { struct inode *inode = osd_dt_obj(dt)->oo_inode; struct file *file; @@ -1381,7 +1382,7 @@ static ssize_t osd_read(const struct lu_env *env, struct dt_object *dt, * dnotify_parent() and locks. */ if (file->f_op->read) - result = file->f_op->read(file, buf, count, pos); + result = file->f_op->read(file, buf->lb_buf, buf->lb_len, pos); else { /* TODO: how to serve symlink readlink()? */ CERROR("read not implemented currently\n"); @@ -1392,7 +1393,7 @@ static ssize_t osd_read(const struct lu_env *env, struct dt_object *dt, } static ssize_t osd_write(const struct lu_env *env, struct dt_object *dt, - const void *buf, size_t count, loff_t *pos, + const struct lu_buf *buf, loff_t *pos, struct thandle *handle) { struct inode *inode = osd_dt_obj(dt)->oo_inode; @@ -1404,7 +1405,7 @@ static ssize_t osd_write(const struct lu_env *env, struct dt_object *dt, file = osd_rw_init(env, inode, &seg); if (file->f_op->write) - result = file->f_op->write(file, buf, count, pos); + result = file->f_op->write(file, buf->lb_buf, buf->lb_len, pos); else { CERROR("write not implemented currently\n"); result = -ENOSYS; -- 1.8.3.1