#define OBT(dev) (dev)->obd_type
#define OBP(dev, op) (dev)->obd_type->typ_ops->o_ ## op
-#define OBD_CHECK_SETUP(conn, export) \
+#define OBD_CHECK_SETUP(conn, exp) \
do { \
if (!(conn)) { \
CERROR("NULL connection\n"); \
RETURN(-EINVAL); \
} \
\
- export = class_conn2export(conn); \
- if (!(export)) { \
+ exp = class_conn2export(conn); \
+ if (!(exp)) { \
CERROR("No export\n"); \
RETURN(-EINVAL); \
} \
\
- if (!((export)->exp_obd->obd_flags & OBD_SET_UP)) { \
+ if (!((exp)->exp_obd->obd_flags & OBD_SET_UP)) { \
CERROR("Device %d not setup\n", \
- (export)->exp_obd->obd_minor); \
+ (exp)->exp_obd->obd_minor); \
RETURN(-EINVAL); \
} \
} while (0)
RETURN(-EINVAL); \
} \
\
- if ( !((obd)->obd_flags & OBD_SET_UP) ) { \
+ if (!((obd)->obd_flags & OBD_SET_UP)) { \
CERROR("Device %d not setup\n", \
(obd)->obd_minor); \
RETURN(-EINVAL); \
#define OBD_CHECK_OP(obd, op) \
do { \
- if (!OBP((obd),op)) { \
+ if (!OBP((obd), op)) { \
CERROR("obd_" #op ": dev %d no operation\n", \
obd->obd_minor); \
RETURN(-EOPNOTSUPP); \
static inline int obd_get_info(struct lustre_handle *conn, obd_count keylen,
void *key, obd_count *vallen, void **val)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, get_info);
- rc = OBP(export->exp_obd, get_info)(conn, keylen, key, vallen, val);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, get_info);
+
+ rc = OBP(exp->exp_obd, get_info)(conn, keylen, key, vallen, val);
RETURN(rc);
}
static inline int obd_set_info(struct lustre_handle *conn, obd_count keylen,
void *key, obd_count vallen, void *val)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, set_info);
- rc = OBP(export->exp_obd, set_info)(conn, keylen, key, vallen, val);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, set_info);
+
+ rc = OBP(exp->exp_obd, set_info)(conn, keylen, key, vallen, val);
RETURN(rc);
}
static inline int obd_create(struct lustre_handle *conn, struct obdo *obdo,
struct lov_stripe_md **ea)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, create);
-
-#define OBD_MD_FLNEEDED (OBD_MD_FLID | OBD_MD_FLMODE)
- //if (obdo->o_valid & OBD_MD_FLNEEDED != OBD_MD_FLNEEDED)
- // RETURN(-EINVAL);
-#undef OBD_MD_FLNEEDED
- rc = OBP(export->exp_obd, create)(conn, obdo, ea);
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, create);
+
+ rc = OBP(exp->exp_obd, create)(conn, obdo, ea);
RETURN(rc);
}
static inline int obd_destroy(struct lustre_handle *conn, struct obdo *obdo,
struct lov_stripe_md *ea)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, destroy);
- rc = OBP(export->exp_obd, destroy)(conn, obdo, ea);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, destroy);
+
+ rc = OBP(exp->exp_obd, destroy)(conn, obdo, ea);
RETURN(rc);
}
static inline int obd_getattr(struct lustre_handle *conn, struct obdo *obdo,
struct lov_stripe_md *ea)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, getattr);
- rc = OBP(export->exp_obd, getattr)(conn, obdo, ea);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, getattr);
+
+ rc = OBP(exp->exp_obd, getattr)(conn, obdo, ea);
RETURN(rc);
}
static inline int obd_close(struct lustre_handle *conn, struct obdo *obdo,
struct lov_stripe_md *ea)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, close);
- rc = OBP(export->exp_obd, close)(conn, obdo, ea);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, close);
+
+ rc = OBP(exp->exp_obd, close)(conn, obdo, ea);
RETURN(rc);
}
static inline int obd_open(struct lustre_handle *conn, struct obdo *obdo,
struct lov_stripe_md *ea)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, open);
- rc = OBP(export->exp_obd, open)(conn, obdo, ea);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, open);
+
+ rc = OBP(exp->exp_obd, open)(conn, obdo, ea);
RETURN(rc);
}
static inline int obd_setattr(struct lustre_handle *conn, struct obdo *obdo,
struct lov_stripe_md *ea)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd,setattr);
- rc = OBP(export->exp_obd, setattr)(conn, obdo, ea);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, setattr);
+
+ rc = OBP(exp->exp_obd, setattr)(conn, obdo, ea);
RETURN(rc);
}
struct obd_device *obd, obd_uuid_t cluuid)
{
int rc;
+
OBD_CHECK_DEVSETUP(obd);
OBD_CHECK_OP(obd, connect);
static inline int obd_disconnect(struct lustre_handle *conn)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, disconnect);
- rc = OBP(export->exp_obd, disconnect)(conn);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, disconnect);
+
+ rc = OBP(exp->exp_obd, disconnect)(conn);
RETURN(rc);
}
static inline int obd_statfs(struct lustre_handle *conn,struct obd_statfs *osfs)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, statfs);
- rc = OBP(export->exp_obd, statfs)(conn, osfs);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, statfs);
+
+ rc = OBP(exp->exp_obd, statfs)(conn, osfs);
RETURN(rc);
}
-static inline int obd_punch(struct lustre_handle *conn, struct obdo *tgt,
+static inline int obd_punch(struct lustre_handle *conn, struct obdo *oa,
struct lov_stripe_md *ea,
obd_size count, obd_off offset)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd,punch);
- rc = OBP(export->exp_obd, punch)(conn, tgt, ea, count, offset);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, punch);
+
+ rc = OBP(exp->exp_obd, punch)(conn, oa, ea, count, offset);
RETURN(rc);
}
struct brw_page *pg,
brw_callback_t callback, void *data)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd,brw);
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, brw);
if (!(cmd & OBD_BRW_RWMASK)) {
CERROR("obd_brw: cmd must be OBD_BRW_READ or OBD_BRW_WRITE\n");
LBUG();
}
- rc = OBP(export->exp_obd, brw)(cmd, conn, ea, oa_bufs, pg, callback,
- data);
+ rc = OBP(exp->exp_obd, brw)(cmd, conn, ea, oa_bufs, pg, callback, data);
RETURN(rc);
}
int niocount, struct niobuf_remote *remote,
struct niobuf_local *local, void **desc_private)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, preprw);
- rc = OBP(export->exp_obd, preprw)(cmd, conn, objcount, obj, niocount,
- remote, local, desc_private);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, preprw);
+
+ rc = OBP(exp->exp_obd, preprw)(cmd, conn, objcount, obj, niocount,
+ remote, local, desc_private);
RETURN(rc);
}
int niocount, struct niobuf_local *local,
void *desc_private)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, commitrw);
- rc = OBP(export->exp_obd, commitrw)(cmd, conn, objcount, obj, niocount,
- local, desc_private);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, commitrw);
+
+ rc = OBP(exp->exp_obd, commitrw)(cmd, conn, objcount, obj, niocount,
+ local, desc_private);
RETURN(rc);
}
static inline int obd_iocontrol(int cmd, struct lustre_handle *conn,
int len, void *karg, void *uarg)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, iocontrol);
- rc = OBP(export->exp_obd, iocontrol)(cmd, conn, len, karg, uarg);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, iocontrol);
+
+ rc = OBP(exp->exp_obd, iocontrol)(cmd, conn, len, karg, uarg);
RETURN(rc);
}
__u32 mode, int *flags, void *cb, void *data,
int datalen, struct lustre_handle *lockh)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd,enqueue);
- rc = OBP(export->exp_obd, enqueue)(conn, ea, parent_lock, type,
- cookie, cookielen, mode, flags, cb,
- data, datalen, lockh);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, enqueue);
+
+ rc = OBP(exp->exp_obd, enqueue)(conn, ea, parent_lock, type,
+ cookie, cookielen, mode, flags, cb,
+ data, datalen, lockh);
RETURN(rc);
}
struct lov_stripe_md *ea, __u32 mode,
struct lustre_handle *lockh)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd,cancel);
- rc = OBP(export->exp_obd, cancel)(conn, ea, mode, lockh);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, cancel);
+
+ rc = OBP(exp->exp_obd, cancel)(conn, ea, mode, lockh);
RETURN(rc);
}
static inline int obd_cancel_unused(struct lustre_handle *conn,
- struct lov_stripe_md *lsm, int local)
+ struct lov_stripe_md *ea, int local)
{
+ struct obd_export *exp;
int rc;
- struct obd_export *export;
- OBD_CHECK_SETUP(conn, export);
- OBD_CHECK_OP(export->exp_obd, cancel_unused);
- rc = OBP(export->exp_obd, cancel_unused)(conn, lsm, local);
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, cancel_unused);
+
+ rc = OBP(exp->exp_obd, cancel_unused)(conn, ea, local);
RETURN(rc);
}
}
if (ia_valid & ATTR_MODE) {
oa->o_mode = attr->ia_mode;
- oa->o_valid |= OBD_MD_FLMODE;
+ oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
if (!in_group_p(oa->o_gid) && !capable(CAP_FSETID))
oa->o_mode &= ~S_ISGID;
}
- if (ia_valid & ATTR_UID)
- {
+ if (ia_valid & ATTR_UID) {
oa->o_uid = attr->ia_uid;
oa->o_valid |= OBD_MD_FLUID;
}
attr->ia_size = oa->o_size;
attr->ia_valid |= ATTR_SIZE;
}
+ if (valid & OBD_MD_FLTYPE) {
+ attr->ia_mode = (attr->ia_mode & ~S_IFMT)|(oa->o_mode & S_IFMT);
+ attr->ia_valid |= ATTR_MODE;
+ }
if (valid & OBD_MD_FLMODE) {
- attr->ia_mode = oa->o_mode;
+ attr->ia_mode = (attr->ia_mode & S_IFMT)|(oa->o_mode & ~S_IFMT);
attr->ia_valid |= ATTR_MODE;
if (!in_group_p(oa->o_gid) && !capable(CAP_FSETID))
attr->ia_mode &= ~S_ISGID;
dst->o_blocks = src->i_blocks;
if (valid & OBD_MD_FLBLKSZ)
dst->o_blksize = src->i_blksize;
+ if (valid & OBD_MD_FLTYPE)
+ dst->o_mode = (dst->o_mode & ~S_IFMT) | (src->i_mode & S_IFMT);
if (valid & OBD_MD_FLMODE)
- dst->o_mode = src->i_mode;
+ dst->o_mode = (dst->o_mode & S_IFMT) | (src->i_mode & ~S_IFMT);
if (valid & OBD_MD_FLUID)
dst->o_uid = src->i_uid;
if (valid & OBD_MD_FLGID)
dst->i_blocks = src->o_blocks;
if (valid & OBD_MD_FLBLKSZ)
dst->i_blksize = src->o_blksize;
+ if (valid & OBD_MD_FLTYPE)
+ dst->i_mode = (dst->i_mode & ~S_IFMT) | (src->o_mode & S_IFMT);
if (valid & OBD_MD_FLMODE)
- dst->i_mode = src->o_mode;
+ dst->i_mode = (dst->i_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
if (valid & OBD_MD_FLUID)
dst->i_uid = src->o_uid;
if (valid & OBD_MD_FLGID)
dst->o_blocks = src->o_blocks;
if (valid & OBD_MD_FLBLKSZ)
dst->o_blksize = src->o_blksize;
+ if (valid & OBD_MD_FLTYPE)
+ dst->o_mode = (dst->o_mode & ~S_IFMT) | (src->o_mode & S_IFMT);
if (valid & OBD_MD_FLMODE)
- dst->o_mode = src->o_mode;
+ dst->o_mode = (dst->o_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
if (valid & OBD_MD_FLUID)
dst->o_uid = src->o_uid;
if (valid & OBD_MD_FLGID)
res = (res || (dst->o_blocks != src->o_blocks));
if ( compare & OBD_MD_FLBLKSZ )
res = (res || (dst->o_blksize != src->o_blksize));
+ if ( compare & OBD_MD_FLTYPE )
+ res = (res || (((dst->o_mode ^ src->o_mode) & S_IFMT) != 0));
if ( compare & OBD_MD_FLMODE )
- res = (res || (dst->o_mode != src->o_mode));
+ res = (res || (((dst->o_mode ^ src->o_mode) & ~S_IFMT) != 0));
if ( compare & OBD_MD_FLUID )
res = (res || (dst->o_uid != src->o_uid));
if ( compare & OBD_MD_FLGID )
extern void (*class_signal_connection_failure)(struct ptlrpc_connection *);
-/* == mds_client_free if MDS running here */
-extern int (*mds_destroy_export)(struct obd_export *exp);
-/* == ldlm_client_free if(?) DLM running here */
-extern int (*ldlm_destroy_export)(struct obd_export *exp);
-
static inline struct ptlrpc_connection *class_rd2conn(struct recovd_data *rd)
{
/* reuse list_entry's member-pointer offset stuff */