cro->cmm_obj.cmo_obj.mo_dir_ops = &cmr_dir_ops;
lo->lo_ops = &cmr_obj_ops;
cro->cmo_num = mdsnum;
+ lo->lo_header->loh_attr |= LOHA_REMOTE;
}
}
RETURN(lo);
RETURN(rc);
}
-static int cml_object_exists(const struct lu_context *ctx,
- const struct lu_object *lo)
-{
- return lu_object_exists(ctx, lu_object_next(lo));
-}
-
static int cml_object_print(const struct lu_context *ctx, void *cookie,
lu_printer_t p, const struct lu_object *lo)
{
static struct lu_object_operations cml_obj_ops = {
.loo_object_init = cml_object_init,
.loo_object_free = cml_object_free,
- .loo_object_print = cml_object_print,
- .loo_object_exists = cml_object_exists
+ .loo_object_print = cml_object_print
};
/* CMM local md_object operations */
int rc;
ENTRY;
- if (mo_t && lu_object_exists(ctx, &mo_t->mo_lu) < 0) {
+ if (mo_t && lu_object_exists(&mo_t->mo_lu) < 0) {
/* mo_t is remote object and there is RPC to unlink it */
rc = mo_ref_del(ctx, md_object_next(mo_t), NULL);
if (rc)
RETURN(rc);
}
-/* -1 is returned for remote object */
-static int cmr_object_exists(const struct lu_context *ctx,
- const struct lu_object *lo)
-{
- return -1;
-}
-
static int cmr_object_print(const struct lu_context *ctx, void *cookie,
lu_printer_t p, const struct lu_object *lo)
{
static struct lu_object_operations cmr_obj_ops = {
.loo_object_init = cmr_object_init,
.loo_object_free = cmr_object_free,
- .loo_object_print = cmr_object_print,
- .loo_object_exists = cmr_object_exists
+ .loo_object_print = cmr_object_print
};
/* CMM remote md_object operations. All are invalid */
/*
* Return standard attributes.
*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: lu_object_exists(&dt->do_lu);
*/
int (*do_attr_get)(const struct lu_context *ctxt,
struct dt_object *dt, struct lu_attr *attr);
/*
* Set standard attributes.
*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
int (*do_attr_set)(const struct lu_context *ctxt,
struct dt_object *dt,
/*
* Return a value of an extended attribute.
*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
int (*do_xattr_get)(const struct lu_context *ctxt,
struct dt_object *dt,
*
* @fl - flags from enum lu_xattr_flags
*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
int (*do_xattr_set)(const struct lu_context *ctxt,
struct dt_object *dt,
/*
* Delete existing extended attribute.
*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
int (*do_xattr_del)(const struct lu_context *ctxt,
struct dt_object *dt,
* Place list of existing extended attributes into @buf (which has
* length len).
*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
int (*do_xattr_list)(const struct lu_context *ctxt,
struct dt_object *dt, void *buf, int buf_len);
/*
* Create new object on this device.
*
- * precondition: !lu_object_exists(ctxt, &dt->do_lu);
- * postcondition: ergo(result == 0, lu_object_exists(ctxt, &dt->do_lu));
+ * precondition: !dt_object_exists(dt);
+ * postcondition: ergo(result == 0, dt_object_exists(dt));
*/
int (*do_create)(const struct lu_context *ctxt, struct dt_object *dt,
struct lu_attr *attr, struct thandle *th);
const struct dt_index_features *feat);
/*
* Add nlink of the object
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
void (*do_ref_add)(const struct lu_context *ctxt,
struct dt_object *dt, struct thandle *th);
/*
* Del nlink of the object
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
void (*do_ref_del)(const struct lu_context *ctxt,
struct dt_object *dt, struct thandle *th);
*/
struct dt_body_operations {
/*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
ssize_t (*dbo_read)(const struct lu_context *ctxt, struct dt_object *dt,
void *buf, size_t count, loff_t *pos);
/*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
ssize_t (*dbo_write)(const struct lu_context *ctxt,
struct dt_object *dt, const void *buf,
*/
struct dt_index_operations {
/*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
int (*dio_lookup)(const struct lu_context *ctxt, struct dt_object *dt,
struct dt_rec *rec, const struct dt_key *key);
/*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
int (*dio_insert)(const struct lu_context *ctxt, struct dt_object *dt,
const struct dt_rec *rec, const struct dt_key *key,
struct thandle *handle);
/*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
int (*dio_delete)(const struct lu_context *ctxt, struct dt_object *dt,
const struct dt_key *key, struct thandle *handle);
/*
* Allocate and initialize new iterator.
*
- * precondition: lu_object_exists(ctxt, &dt->do_lu);
+ * precondition: dt_object_exists(dt);
*/
struct dt_it *(*init)(const struct lu_context *ctxt,
struct dt_object *dt);
void dt_object_fini(struct dt_object *obj);
+static inline int dt_object_exists(const struct dt_object *dt)
+{
+ return lu_object_exists(&dt->do_lu);
+}
+
struct txn_param {
unsigned int tp_credits;
};
*/
void (*loo_object_release)(const struct lu_context *ctx,
struct lu_object *o);
-
- /*
- * Return true off object @o exists on a storage.
- */
- int (*loo_object_exists)(const struct lu_context *ctx,
- const struct lu_object *o);
/*
* Debugging helper. Print given object.
*/
};
enum lu_object_header_attr {
+ LOHA_EXISTS = 1 << 0,
+ LOHA_REMOTE = 1 << 1,
/*
* UNIX file type is stored in S_IFMT bits.
*/
- LU_OBJECT_FT_START = (1 << 12), /* S_IFIFO */
- LU_OBJECT_FT_END = (1 << 15), /* S_IFREG */
+ LOHA_FT_START = 1 << 12, /* S_IFIFO */
+ LOHA_FT_END = 1 << 15, /* S_IFREG */
};
/*
* Returns 1 iff object @o exists on the stable storage,
* returns -1 iff object @o is on remote server.
*/
-static inline int lu_object_exists(const struct lu_context *ctx,
- const struct lu_object *o)
+static inline int lu_object_exists(const struct lu_object *o)
{
- return o->lo_ops->loo_object_exists(ctx, o);
+ __u32 attr;
+
+ attr = o->lo_header->loh_attr;
+ if (attr & LOHA_REMOTE)
+ return -1;
+ else if (attr & LOHA_EXISTS)
+ return +1;
+ else
+ return 0;
}
-static inline int lu_object_assert_exists(const struct lu_context *ctx,
- const struct lu_object *o)
+static inline int lu_object_assert_exists(const struct lu_object *o)
{
- return lu_object_exists(ctx, o) != 0;
+ return lu_object_exists(o) != 0;
}
-static inline int lu_object_assert_not_exists(const struct lu_context *ctx,
- const struct lu_object *o)
+static inline int lu_object_assert_not_exists(const struct lu_object *o)
{
- return lu_object_exists(ctx, o) <= 0;
+ return lu_object_exists(o) <= 0;
}
/*
* Attr of this object.
*/
-static inline const __u32 lu_object_attr(const struct lu_context *ctx,
- const struct lu_object *o)
+static inline const __u32 lu_object_attr(const struct lu_object *o)
{
- LASSERT(lu_object_exists(ctx, o) > 0);
+ LASSERT(lu_object_exists(o) > 0);
return o->lo_header->loh_attr;
}
};
struct md_attr {
- __u64 ma_valid;
- __u64 ma_need;
+ __u64 ma_valid;
+ __u64 ma_need;
__u64 ma_attr_flags;
struct lu_attr ma_attr;
struct lov_mds_md *ma_lmm;
int (*mdo_rename)(const struct lu_context *ctxt,
struct md_object *spobj, struct md_object *tpobj,
const struct lu_fid *lf, const char *sname,
- struct md_object *tobj, const char *tname,
+ struct md_object *tobj, const char *tname,
struct md_attr *);
int (*mdo_link)(const struct lu_context *ctxt, struct md_object *tobj,
Index: iam/fs/ext3/Makefile
===================================================================
--- iam.orig/fs/ext3/Makefile 2006-05-31 20:24:32.000000000 +0400
-+++ iam/fs/ext3/Makefile 2006-08-14 23:16:52.000000000 +0400
++++ iam/fs/ext3/Makefile 2006-08-16 20:48:12.000000000 +0400
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
Index: iam/include/linux/lustre_iam.h
===================================================================
--- iam.orig/include/linux/lustre_iam.h 2006-05-31 20:24:32.000000000 +0400
-+++ iam/include/linux/lustre_iam.h 2006-08-14 23:16:52.000000000 +0400
++++ iam/include/linux/lustre_iam.h 2006-08-16 20:48:12.000000000 +0400
@@ -1,9 +1,68 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
Index: iam/fs/ext3/Makefile
===================================================================
---- iam.orig/fs/ext3/Makefile 2006-08-14 23:16:52.000000000 +0400
-+++ iam/fs/ext3/Makefile 2006-08-14 23:16:52.000000000 +0400
+--- iam.orig/fs/ext3/Makefile 2006-08-16 20:48:12.000000000 +0400
++++ iam/fs/ext3/Makefile 2006-08-16 20:48:13.000000000 +0400
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
Index: iam/fs/ext3/dir.c
===================================================================
---- iam.orig/fs/ext3/dir.c 2006-08-14 23:16:52.000000000 +0400
-+++ iam/fs/ext3/dir.c 2006-08-14 23:16:52.000000000 +0400
+--- iam.orig/fs/ext3/dir.c 2006-08-16 20:48:12.000000000 +0400
++++ iam/fs/ext3/dir.c 2006-08-16 20:48:13.000000000 +0400
@@ -28,6 +28,7 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
(filp->f_version != inode->i_version)) {
Index: iam/fs/ext3/file.c
===================================================================
---- iam.orig/fs/ext3/file.c 2006-08-14 23:16:52.000000000 +0400
-+++ iam/fs/ext3/file.c 2006-08-14 23:16:52.000000000 +0400
+--- iam.orig/fs/ext3/file.c 2006-08-16 20:48:12.000000000 +0400
++++ iam/fs/ext3/file.c 2006-08-16 20:48:13.000000000 +0400
@@ -23,6 +23,7 @@
#include <linux/jbd.h>
#include <linux/ext3_fs.h>
Index: iam/fs/ext3/iam-uapi.c
===================================================================
--- iam.orig/fs/ext3/iam-uapi.c 2004-04-06 17:27:52.000000000 +0400
-+++ iam/fs/ext3/iam-uapi.c 2006-08-14 23:16:52.000000000 +0400
++++ iam/fs/ext3/iam-uapi.c 2006-08-16 20:48:13.000000000 +0400
@@ -0,0 +1,361 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+}
Index: iam/fs/ext3/ioctl.c
===================================================================
---- iam.orig/fs/ext3/ioctl.c 2006-08-14 23:16:52.000000000 +0400
-+++ iam/fs/ext3/ioctl.c 2006-08-14 23:16:52.000000000 +0400
+--- iam.orig/fs/ext3/ioctl.c 2006-08-16 20:48:12.000000000 +0400
++++ iam/fs/ext3/ioctl.c 2006-08-16 20:48:13.000000000 +0400
@@ -250,6 +250,6 @@ flags_err:
}
Index: iam/include/linux/lustre_iam.h
===================================================================
---- iam.orig/include/linux/lustre_iam.h 2006-08-14 23:16:52.000000000 +0400
-+++ iam/include/linux/lustre_iam.h 2006-08-14 23:16:53.000000000 +0400
+--- iam.orig/include/linux/lustre_iam.h 2006-08-16 20:48:12.000000000 +0400
++++ iam/include/linux/lustre_iam.h 2006-08-16 20:48:13.000000000 +0400
@@ -30,9 +30,6 @@
#ifndef __LINUX_LUSTRE_IAM_H__
#define __LINUX_LUSTRE_IAM_H__
static int mdd_object_start(const struct lu_context *ctxt, struct lu_object *o)
{
- if (lu_object_exists(ctxt, o))
+ if (lu_object_exists(o))
return mdd_get_flags(ctxt, lu2mdd_obj(o));
else
return 0;
struct mdd_object *pobj, struct mdd_object *cobj)
{
ENTRY;
- if (cobj && lu_object_exists(ctxt, &cobj->mod_obj.mo_lu))
+ if (cobj && lu_object_exists(&cobj->mod_obj.mo_lu))
RETURN(-EEXIST);
if (mdd_is_dead_obj(pobj))
struct mdd_object *obj, struct lu_attr *la)
{
struct dt_object *next = mdd_object_child(obj);
- LASSERT(lu_object_exists(ctxt, mdd2lu_obj(obj)));
+ LASSERT(lu_object_exists(mdd2lu_obj(obj)));
return next->do_ops->do_attr_get(ctxt, next, la);
}
LASSERT(cobj && pobj);
- if (!lu_object_exists(ctxt, &cobj->mod_obj.mo_lu))
+ if (!lu_object_exists(&cobj->mod_obj.mo_lu))
RETURN(-ENOENT);
if (mdd_is_immutable(cobj) || mdd_is_append(cobj))
rc = __mdd_iattr_get(ctxt, mdd_obj, ma);
if (rc == 0 && ma->ma_need & MA_LOV) {
- if (S_ISREG(lu_object_attr(ctxt, mdd2lu_obj(mdd_obj))) ||
- S_ISDIR(lu_object_attr(ctxt, mdd2lu_obj(mdd_obj)))) {
+ __u32 mode;
+
+ mode = lu_object_attr(mdd2lu_obj(mdd_obj));
+ if (S_ISREG(mode) || S_ISDIR(mode))
rc = __mdd_lmm_get(ctxt, mdd_obj, ma);
- }
}
CDEBUG(D_INODE, "after getattr rc = %d, ma_valid = "LPX64"\n",
ENTRY;
- LASSERT(lu_object_exists(ctxt, &obj->mo_lu));
+ LASSERT(lu_object_exists(&obj->mo_lu));
next = mdd_object_child(mdd_obj);
rc = next->do_ops->do_xattr_get(ctxt, next, buf, buf_len, name);
int rc;
ENTRY;
- LASSERT(lu_object_exists(ctxt, &obj->mo_lu));
+ LASSERT(lu_object_exists(&obj->mo_lu));
next = mdd_object_child(mdd_obj);
rc = next->do_body_ops->dbo_read(ctxt, next, buf, buf_len, &pos);
ENTRY;
- LASSERT(lu_object_exists(ctxt, &obj->mo_lu));
+ LASSERT(lu_object_exists(&obj->mo_lu));
next = mdd_object_child(mdd_obj);
rc = next->do_ops->do_xattr_list(ctxt, next, buf, buf_len);
return (*p)(ctxt, cookie, LUSTRE_MDD0_NAME"-object@%p", o);
}
-static int mdd_object_exists(const struct lu_context *ctx,
- const struct lu_object *o)
-{
- return lu_object_exists(ctx, lu_object_next(o));
-}
-
static int mdd_mount(const struct lu_context *ctx, struct mdd_device *mdd)
{
int rc;
.loo_object_init = mdd_object_init,
.loo_object_start = mdd_object_start,
.loo_object_free = mdd_object_free,
- .loo_object_print = mdd_object_print,
- .loo_object_exists = mdd_object_exists,
+ .loo_object_print = mdd_object_print
};
void mdd_lock(const struct lu_context *ctxt, struct mdd_object *obj,
int rc;
ENTRY;
- if (!lu_object_exists(ctxt, mdd2lu_obj(obj))) {
+ if (!lu_object_exists(mdd2lu_obj(obj))) {
next = mdd_object_child(obj);
rc = next->do_ops->do_create(ctxt, next, attr, handle);
} else
rc = -EEXIST;
- LASSERT(ergo(rc == 0, lu_object_exists(ctxt, mdd2lu_obj(obj))));
+ LASSERT(ergo(rc == 0, lu_object_exists(mdd2lu_obj(obj))));
RETURN(rc);
}
{
struct dt_object *next;
- LASSERT(lu_object_exists(ctxt, mdd2lu_obj(o)));
+ LASSERT(lu_object_exists(mdd2lu_obj(o)));
next = mdd_object_child(o);
return next->do_ops->do_attr_set(ctxt, next, attr, handle);
}
int rc = 0;
ENTRY;
- LASSERT(lu_object_exists(ctxt, mdd2lu_obj(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(ctxt, next, buf, buf_len, name,
{
struct dt_object *next;
- LASSERT(lu_object_exists(ctxt, mdd2lu_obj(obj)));
+ LASSERT(lu_object_exists(mdd2lu_obj(obj)));
next = mdd_object_child(obj);
return next->do_ops->do_xattr_del(ctxt, next, name, handle);
}
GOTO(cleanup, rc);
__mdd_ref_del(ctxt, mdd_cobj, handle);
- if (S_ISDIR(lu_object_attr(ctxt, &cobj->mo_lu))) {
+ if (S_ISDIR(lu_object_attr(&cobj->mo_lu))) {
/* unlink dot */
__mdd_ref_del(ctxt, mdd_cobj, handle);
/* unlink dotdot */
if (rc)
GOTO(cleanup, rc);
- if (tobj && lu_object_exists(ctxt, &tobj->mo_lu)) {
+ if (tobj && lu_object_exists(&tobj->mo_lu)) {
__mdd_ref_del(ctxt, mdd_tobj, handle);
/* remove dot reference */
if (S_ISDIR(mdd_object_type(ctxt, mdd_tobj)))
if (rc)
GOTO(cleanup, rc);
- if (tobj && lu_object_exists(ctxt, &tobj->mo_lu))
+ if (tobj && lu_object_exists(&tobj->mo_lu))
__mdd_ref_del(ctxt, mdd_tobj, handle);
cleanup:
mdd_unlock2(ctxt, mdd_tpobj, mdd_tobj);
{
struct dt_object *next;
- LASSERT(lu_object_exists(ctxt, mdd2lu_obj(obj)));
+ LASSERT(lu_object_exists(mdd2lu_obj(obj)));
next = mdd_object_child(obj);
next->do_ops->do_ref_add(ctxt, next, handle);
}
{
struct dt_object *next = mdd_object_child(obj);
- LASSERT(lu_object_exists(ctxt, mdd2lu_obj(obj)));
+ LASSERT(lu_object_exists(mdd2lu_obj(obj)));
next->do_ops->do_ref_del(ctxt, next, handle);
}
struct mdd_object *mdd_obj = md2mdd_obj(obj);
struct mdd_device *mdd = mdo2mdd(obj);
struct thandle *handle;
+ int isdir;
int rc;
ENTRY;
mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
+ isdir = S_ISDIR(lu_object_attr(&obj->mo_lu));
/* rmdir checks */
- if (S_ISDIR(lu_object_attr(ctxt, &obj->mo_lu)) &&
- dt_try_as_dir(ctxt, mdd_object_child(mdd_obj))) {
+ if (isdir && dt_try_as_dir(ctxt, mdd_object_child(mdd_obj))) {
rc = mdd_dir_is_empty(ctxt, mdd_obj);
if (rc != 0)
GOTO(cleanup, rc);
__mdd_ref_del(ctxt, mdd_obj, handle);
- if (S_ISDIR(lu_object_attr(ctxt, &obj->mo_lu))) {
+ if (isdir) {
/* unlink dot */
__mdd_ref_del(ctxt, mdd_obj, handle);
}
struct mdd_object *mdd_obj = md2mdd_obj(obj);
int rc;
- LASSERT(lu_object_exists(ctxt, mdd2lu_obj(mdd_obj)));
+ LASSERT(lu_object_exists(mdd2lu_obj(mdd_obj)));
next = mdd_object_child(mdd_obj);
mdd_lock(ctxt, mdd_obj, DT_READ_LOCK);
static inline umode_t mdd_object_type(const struct lu_context *ctxt,
const struct mdd_object *obj)
{
- return lu_object_attr(ctxt, &obj->mod_obj.mo_lu);
+ return lu_object_attr(&obj->mod_obj.mo_lu);
}
static inline int mdd_lov_mdsize(const struct lu_context *ctxt,
static int mdt_getattr(struct mdt_thread_info *info)
{
int result;
+ struct mdt_object *obj;
- LASSERT(info->mti_object != NULL);
- LASSERT(lu_object_assert_exists(info->mti_ctxt,
- &info->mti_object->mot_obj.mo_lu));
+ obj = info->mti_object;
+ LASSERT(obj != NULL);
+ LASSERT(lu_object_assert_exists(&obj->mot_obj.mo_lu));
ENTRY;
if (MDT_FAIL_CHECK(OBD_FAIL_MDS_GETATTR_PACK)) {
result = -ENOMEM;
} else {
- result = mdt_getattr_internal(info, info->mti_object);
+ result = mdt_getattr_internal(info, obj);
}
mdt_shrink_reply(info, 1);
RETURN(result);
obj = mdt_object_find(ctx, info->mti_mdt, &body->fid1);
if (!IS_ERR(obj)) {
if ((flags & HABEO_CORPUS) &&
- !lu_object_exists(ctx,
- &obj->mot_obj.mo_lu)) {
+ !lu_object_exists(&obj->mot_obj.mo_lu)) {
mdt_object_put(ctx, obj);
result = -ENOENT;
} else {
return -EFAULT;
if (info->mti_trans_flags & MDT_NONEED_TANSNO)
return 0;
-
+
last_committed = mdt->mdt_last_committed;
if (rc == 0) {
struct lu_device *d = top, *n;
struct lustre_cfg_bufs bufs;
struct lustre_cfg *lcfg;
-
+
/* process cleanup */
lustre_cfg_bufs_reset(&bufs, NULL);
lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs);
return;
}
top->ld_ops->ldo_process_config(ctx, top, lcfg);
-
+
lu_site_purge(ctx, top->ld_site, ~0);
while (d != NULL) {
struct obd_type *type;
return (*p)(ctxt, cookie, LUSTRE_MDT0_NAME"-object@%p", o);
}
-int mdt_object_exists(const struct lu_context *ctx,
- const struct lu_object *o)
-{
- return lu_object_exists(ctx, lu_object_next(o));
-}
-
static struct lu_device_operations mdt_lu_ops = {
.ldo_object_alloc = mdt_object_alloc,
.ldo_process_config = mdt_process_config
static struct lu_object_operations mdt_obj_ops = {
.loo_object_init = mdt_object_init,
.loo_object_free = mdt_object_free,
- .loo_object_print = mdt_object_print,
- .loo_object_exists = mdt_object_exists
+ .loo_object_print = mdt_object_print
};
/* mds_connect_internal */
void mdt_lock_handle_fini(struct mdt_lock_handle *lh);
-int mdt_object_exists(const struct lu_context *ctx,
- const struct lu_object *o);
-
int mdt_fs_setup(const struct lu_context *ctxt,
struct mdt_device *mdt);
if (ma->ma_valid & MA_LOV) {
__u32 mode;
- mode = lu_object_attr(info->mti_ctxt, &mo->mot_obj.mo_lu);
+ mode = lu_object_attr(&mo->mot_obj.mo_lu);
LASSERT(ma->ma_lmm_size);
mdt_dump_lmm(D_INFO, ma->ma_lmm);
repbody->eadatasize = ma->ma_lmm_size;
if (in & ATTR_ATTR_FLAG)
out |= LA_FLAGS;
-
+
/*XXX need ATTR_RAW?*/
in &= ~(ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|
ATTR_ATIME|ATTR_MTIME|ATTR_CTIME|ATTR_FROM_OPEN|
o = mdt_object_find(info->mti_ctxt, info->mti_mdt, fid);
if (!IS_ERR(o)) {
- if (mdt_object_exists(info->mti_ctxt, &o->mot_obj.mo_lu) > 0) {
+ if (lu_object_exists(&o->mot_obj.mo_lu) > 0) {
if (flags & MDS_OPEN_EXCL &&
flags & MDS_OPEN_CREAT)
rc = -EEXIST;
RETURN(rc = PTR_ERR(mo));
next = mdt_object_child(mo);
- if (lu_object_exists(info->mti_ctxt, &mo->mot_obj.mo_lu) <= 0)
+ if (lu_object_assert_not_exists(&mo->mot_obj.mo_lu))
GOTO(out_unlock, rc = -ENOENT);
/* all attrs are packed into mti_attr in unpack_setattr */
if (rc)
GOTO(out_unlock_child, rc);
-
+
rc = mdt_handle_last_unlink(info, mc, ma);
GOTO(out_unlock_child, rc);
rc = min_t(int, info->mti_body->eadatasize, rc);
}
req_capsule_set_size(pill, &RMF_EADATA, RCL_SERVER, rc);
-
+
rc1 = req_capsule_pack(pill);
-
+
return rc = !rc1? rc1 : rc;
}
ENTRY;
LASSERT(info->mti_object != NULL);
- LASSERT(lu_object_assert_exists(info->mti_ctxt,
- &info->mti_object->mot_obj.mo_lu));
+ LASSERT(lu_object_assert_exists(&info->mti_object->mot_obj.mo_lu));
CDEBUG(D_INODE, "getxattr "DFID"\n",
PFID(&info->mti_body->fid1));
next = mdt_object_child(info->mti_object);
rc = mdt_getxattr_pack_reply(info);
- if (rc < 0)
+ if (rc < 0)
RETURN(rc);
-
+
rep_body = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
/*No EA, just go back*/
if (rc == 0)
GOTO(no_xattr, rc);
buf = req_capsule_server_get(&info->mti_pill, &RMF_EADATA);
- buflen = rc;
+ buflen = rc;
if (info->mti_body->valid & OBD_MD_FLXATTR) {
char *xattr_name = req_capsule_client_get(&info->mti_pill,
struct lu_object *l);
static void osd_object_release(const struct lu_context *ctxt,
struct lu_object *l);
-static int osd_object_exists (const struct lu_context *ctx,
- const struct lu_object *o);
static int osd_object_print (const struct lu_context *ctx, void *cookie,
lu_printer_t p, const struct lu_object *o);
static void osd_device_free (const struct lu_context *ctx,
{
LASSERT(obj->oo_inode != NULL);
obj->oo_dt.do_body_ops = &osd_body_ops;
- obj->oo_dt.do_lu.lo_header->loh_attr |= obj->oo_inode->i_mode & S_IFMT;
+ obj->oo_dt.do_lu.lo_header->loh_attr |=
+ (LOHA_EXISTS | (obj->oo_inode->i_mode & S_IFMT));
}
static int osd_object_init(const struct lu_context *ctxt, struct lu_object *l)
set_bit(LU_OBJECT_HEARD_BANSHEE, &l->lo_header->loh_flags);
}
-static int osd_object_exists(const struct lu_context *ctx,
- const struct lu_object *o)
-{
- LASSERT(osd_invariant(osd_obj(o)));
- return !!(osd_obj(o)->oo_inode != NULL);
-}
-
static int osd_object_print(const struct lu_context *ctx, void *cookie,
lu_printer_t p, const struct lu_object *l)
{
struct lu_attr *attr)
{
struct osd_object *obj = osd_dt_obj(dt);
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(osd_invariant(obj));
return osd_inode_getattr(ctxt, obj->oo_inode, attr);
}
struct thandle *handle)
{
struct osd_object *obj = osd_dt_obj(dt);
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(osd_invariant(obj));
return osd_inode_setattr(ctxt, obj->oo_inode, attr);
}
ENTRY;
LASSERT(osd_invariant(obj));
- LASSERT(!lu_object_exists(ctx, &dt->do_lu));
+ LASSERT(!dt_object_exists(dt));
/*
* XXX missing: permission checks.
osd_oi_write_unlock(&osd->od_oi);
}
- LASSERT(ergo(result == 0, lu_object_exists(ctx, &dt->do_lu)));
+ LASSERT(ergo(result == 0, dt_object_exists(dt)));
LASSERT(osd_invariant(obj));
return result;
}
struct inode *inode = obj->oo_inode;
LASSERT(osd_invariant(obj));
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
if (inode->i_nlink < LDISKFS_LINK_MAX) {
inode->i_nlink ++;
mark_inode_dirty(inode);
struct inode *inode = obj->oo_inode;
LASSERT(osd_invariant(obj));
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
if (inode->i_nlink > 0) {
inode->i_nlink --;
mark_inode_dirty(inode);
struct osd_thread_info *info = lu_context_key_get(ctxt, &osd_key);
struct dentry *dentry = &info->oti_dentry;
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(inode->i_op != NULL && inode->i_op->getxattr != NULL);
dentry->d_inode = inode;
return inode->i_op->getxattr(dentry, name, buf, size);
struct osd_thread_info *info = lu_context_key_get(ctxt, &osd_key);
struct dentry *dentry = &info->oti_dentry;
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(inode->i_op != NULL && inode->i_op->setxattr != NULL);
dentry->d_inode = inode;
struct osd_thread_info *info = lu_context_key_get(ctxt, &osd_key);
struct dentry *dentry = &info->oti_dentry;
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(inode->i_op != NULL && inode->i_op->listxattr != NULL);
dentry->d_inode = inode;
return inode->i_op->listxattr(dentry, buf, size);
struct osd_thread_info *info = lu_context_key_get(ctxt, &osd_key);
struct dentry *dentry = &info->oti_dentry;
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(inode->i_op != NULL && inode->i_op->removexattr != NULL);
dentry->d_inode = inode;
return inode->i_op->removexattr(dentry, name);
int rc;
int nob;
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(osd_invariant(obj));
LASSERT(osd_has_index(obj));
struct osd_object *obj = osd_dt_obj(dt);
LASSERT(osd_invariant(obj));
- LASSERT(lu_object_exists(ctx, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
if (osd_sb(osd_obj2dev(obj))->s_root->d_inode == obj->oo_inode) {
dt->do_index_ops = &osd_index_compat_ops;
ENTRY;
LASSERT(osd_invariant(obj));
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(obj->oo_container.ic_object == obj->oo_inode);
LASSERT(obj->oo_ipd != NULL);
ENTRY;
LASSERT(osd_invariant(obj));
- LASSERT(lu_object_exists(ctxt, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(obj->oo_container.ic_object == obj->oo_inode);
LASSERT(obj->oo_ipd != NULL);
ENTRY;
LASSERT(osd_invariant(obj));
- LASSERT(lu_object_exists(ctx, &dt->do_lu));
+ LASSERT(dt_object_exists(dt));
LASSERT(obj->oo_container.ic_object == obj->oo_inode);
LASSERT(obj->oo_ipd != NULL);
struct osd_object *obj = osd_dt_obj(dt);
struct lu_object *lo = &dt->do_lu;
- LASSERT(lu_object_exists(ctx, lo));
+ LASSERT(lu_object_exists(lo));
LASSERT(obj->oo_ipd != NULL);
OBD_ALLOC_PTR(it);
luch = lu_object_find(ctx, ludev->ld_site, fid);
if (!IS_ERR(luch)) {
- if (lu_object_exists(ctx, luch)) {
+ if (lu_object_exists(luch)) {
struct osd_object *child;
child = osd_obj(lu_object_locate(luch->lo_header,
.loo_object_release = osd_object_release,
.loo_object_free = osd_object_free,
.loo_object_print = osd_object_print,
- .loo_object_invariant = osd_object_invariant,
- .loo_object_exists = osd_object_exists
+ .loo_object_invariant = osd_object_invariant
};
static struct lu_device_operations osd_lu_ops = {