Whamcloud - gitweb
This commit contains probably 92% of the striping infrastructure
authorbraam <braam>
Sun, 14 Jul 2002 00:13:54 +0000 (00:13 +0000)
committerbraam <braam>
Sun, 14 Jul 2002 00:13:54 +0000 (00:13 +0000)
we need initially.  The most pervasive change is the introduction
of "lov_stripe_md" throughout the code.

In addtion several small little bugs were nailed in the locking --
more are outstanding.

The setup scripts are not yet capable of running this code.

Kernel patches were updated to include LOOKUP (to let runtests.sh
work).

33 files changed:
lustre/Makefile.am
lustre/include/linux/lustre_idl.h
lustre/include/linux/lustre_lib.h
lustre/include/linux/lustre_lite.h
lustre/include/linux/lustre_mds.h
lustre/include/linux/obd.h
lustre/include/linux/obd_class.h
lustre/include/linux/obd_lov.h
lustre/include/linux/obd_ost.h
lustre/include/linux/obdfs.h
lustre/ldlm/ldlm_lock.c
lustre/lib/obd_pack.c
lustre/llite/file.c
lustre/llite/namei.c
lustre/llite/rw.c
lustre/llite/super.c
lustre/lov/lov_obd.c
lustre/mdc/mdc_reint.c
lustre/mdc/mdc_request.c
lustre/mds/handler.c
lustre/mds/mds_extN.c
lustre/mds/mds_reint.c
lustre/obdclass/class_obd.c
lustre/obdclass/genops.c
lustre/obdfilter/filter.c
lustre/obdfs/namei.c
lustre/obdfs/rw.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/patches/patch-2.4.18
lustre/patches/patch-2.4.18-chaos4
lustre/tests/common.sh
lustre/utils/obdctl.c

index 51e3aaf..fee3eab 100644 (file)
@@ -7,7 +7,7 @@ AUTOMAKE_OPTIONS = foreign
 
 # NOTE: keep extN before mds
 SUBDIRS = lov utils obdclass ldlm ptlrpc llite lib obdecho mdc osc extN 
-SUBDIRS+=  mds ost tests obdfilter obdfs demos doc scripts 
+SUBDIRS+=  mds ost tests obdfilter demos doc scripts #obdfs
 EXTRA_DIST = BUGS FDL Rules include patches archdep.m4
 
 # We get the version from the spec file.
index 15a8c77..7b3628e 100644 (file)
@@ -157,7 +157,7 @@ typedef uint32_t        obd_blksize;
 typedef uint32_t        obd_mode;
 typedef uint32_t        obd_uid;
 typedef uint32_t        obd_gid;
-typedef uint32_t        obd_rdev;
+typedef uint64_t        obd_rdev;
 typedef uint32_t        obd_flag;
 typedef uint32_t        obd_count;
 
@@ -176,6 +176,7 @@ struct obdo {
         obd_time                o_ctime;
         obd_size                o_size;
         obd_blocks              o_blocks;
+        obd_rdev                o_rdev;
         obd_blksize             o_blksize;
         obd_mode                o_mode;
         obd_uid                 o_uid;
@@ -183,12 +184,26 @@ struct obdo {
         obd_flag                o_flags;
         obd_count               o_nlink;
         obd_count               o_generation;
-        obd_rdev                o_rdev;
         obd_flag                o_valid;        /* hot fields in this obdo */
         obd_flag                o_obdflags;
+        __u32                   o_easize; 
         char                    o_inline[OBD_INLINESZ];
 };
 
+struct lov_object_id { /* per-child structure */
+        __u64 l_object_id;
+};
+
+struct lov_stripe_md {
+        __u64 lmd_magic;
+        __u64 lmd_object_id;     /* lov object id */
+        __u64 lmd_stripe_count;
+        __u32 lmd_size;
+        __u32 lmd_stripe_size;
+        __u32 lmd_stripe_pattern;  /* per-lov object stripe pattern */
+        struct lov_object_id lmd_objects[0];
+};
+
 #define OBD_MD_FLALL    (0xffffffff)
 #define OBD_MD_FLID     (0x00000001)
 #define OBD_MD_FLATIME  (0x00000002)
@@ -206,11 +221,10 @@ struct obdo {
 #define OBD_MD_FLNLINK  (0x00002000)
 #define OBD_MD_FLGENER  (0x00004000)
 #define OBD_MD_FLINLINE (0x00008000)
-#define OBD_MD_FLOBDMD  (0x00010000)
+#define OBD_MD_FLRDEV   (0x00010000)
 #define OBD_MD_FLOBJID  (0x00020000)
 #define OBD_MD_LINKNAME (0x00040000)
-#define OBD_MD_FLNOTOBD (~(OBD_MD_FLOBDMD | OBD_MD_FLOBDFLG | OBD_MD_FLBLOCKS |\
-                           OBD_MD_LINKNAME))
+#define OBD_MD_FLNOTOBD (~(OBD_MD_FLOBDFLG | OBD_MD_FLBLOCKS | OBD_MD_LINKNAME))
 
 struct obd_statfs {
         __u64           os_type;
@@ -457,5 +471,4 @@ struct ldlm_reply {
         __u64  lock_policy_res1;
         __u64  lock_policy_res2;
 };
-
 #endif
index 251e5b2..08ce7f4 100644 (file)
@@ -391,6 +391,10 @@ static inline int obd_ioctl_getdata(char **buf, int *len, void *arg)
 
 #define OBD_IOC_DEC_FS_USE_COUNT       _IO  ('f', 133      )
 
+
+
+
+
 /* XXX this should be one mask-check */
 #define l_killable_pending(task)                                               \
 (sigismember(&(task->pending.signal), SIGKILL) ||                              \
index 07c37dc..41c9093 100644 (file)
@@ -30,7 +30,7 @@ struct ll_file_data {
 
 struct ll_inode_md {
         struct mds_body *body;
-        struct obdo *obdo;
+        struct lov_stripe_md *md;
 };
 
 #define LL_IOC_GETFLAGS                 _IOR ('f', 151, long)
@@ -42,7 +42,10 @@ struct ll_inode_md {
 #define LL_INLINESZ      60
 struct ll_inode_info {
         int              lli_flags;
-        struct obdo     *lli_obdo;
+        //        struct obdo     *lli_obdo;
+        struct  lov_stripe_md *lli_smd;
+        //        int              lli_obdo_mdsz;
+        //void            *lli_obdo_md;
         char            *lli_symlink_name;
         char             lli_inline[LL_INLINESZ];
         struct lustre_handle lli_intent_lock_handle;
index e5fbfca..ee8c12d 100644 (file)
@@ -53,11 +53,6 @@ struct mds_update_record {
         __u64 ur_time;
 };
 
-struct mds_objid {
-        __u64 mo_magic;
-        struct lov_md mo_lov_md;
-};
-
 #define MDS_LR_CLIENT  8192
 #define MDS_LR_SIZE     128
 
@@ -134,7 +129,8 @@ void mds_pack_inode2body(struct mds_body *body, struct inode *inode);
 struct dentry *mds_name2locked_dentry(struct mds_obd *mds, struct dentry *dir,
                                       struct vfsmount **mnt, char *name,
                                       int namelen, int lock_mode,
-                                      struct lustre_handle *lockh);
+                                      struct lustre_handle *lockh,
+                                      int dir_lock_mode);
 struct dentry *mds_fid2locked_dentry(struct mds_obd *mds, struct ll_fid *fid,
                                      struct vfsmount **mnt, int lock_mode,
                                      struct lustre_handle *lockh);
@@ -165,8 +161,7 @@ int mdc_statfs(struct lustre_handle *conn,
 int mdc_setattr(struct lustre_handle *conn,
                 struct inode *, struct iattr *iattr, struct ptlrpc_request **);
 int mdc_open(struct lustre_handle *conn,
-             obd_id ino, int type, int flags, struct obdo *obdo, __u64 cookie,
-             __u64 *fh, struct ptlrpc_request **request);
+             obd_id ino, int type, int flags, struct lov_stripe_md *md, __u64 cookie,  __u64 *fh, struct ptlrpc_request **request);
 int mdc_close(struct lustre_handle *conn,
               obd_id ino, int type, __u64 fh,  struct ptlrpc_request **req);
 int mdc_readpage(struct lustre_handle *conn, obd_id ino,
@@ -174,7 +169,7 @@ int mdc_readpage(struct lustre_handle *conn, obd_id ino,
 int mdc_create(struct lustre_handle *conn,
                struct inode *dir, const char *name, int namelen,
                const char *tgt, int tgtlen, int mode, __u32 uid, __u32 gid,
-               __u64 time, __u64 rdev, struct obdo *obdo,
+               __u64 time, __u64 rdev, struct lov_stripe_md *md, 
                struct ptlrpc_request **);
 int mdc_unlink(struct lustre_handle *conn,
                struct inode *dir, struct inode *child, const char *name,
@@ -197,9 +192,10 @@ struct mds_fs_operations {
         int     (* fs_commit)(struct inode *inode, void *handle);
         int     (* fs_setattr)(struct dentry *dentry, void *handle,
                                struct iattr *iattr);
-        int     (* fs_set_obdo)(struct inode *inode, void *handle,
-                                struct obdo *obdo);
-        int     (* fs_get_obdo)(struct inode *inode, struct obdo *obdo);
+        int     (* fs_set_md)(struct inode *inode, void *handle,
+                              struct lov_stripe_md *md);
+        int     (* fs_get_md)(struct inode *inode, 
+                              struct lov_stripe_md *md);
         ssize_t (* fs_readpage)(struct file *file, char *buf, size_t count,
                                 loff_t *offset);
         void    (* fs_delete_inode)(struct inode *inode);
@@ -239,16 +235,16 @@ static inline int mds_fs_setattr(struct mds_obd *mds, struct dentry *dentry,
         return mds->mds_fsops->fs_setattr(dentry, handle, iattr);
 }
 
-static inline int mds_fs_set_obdo(struct mds_obd *mds, struct inode *inode,
-                                  void *handle, struct obdo *obdo)
+static inline int mds_fs_set_md(struct mds_obd *mds, struct inode *inode,
+                                  void *handle, struct lov_stripe_md *md)
 {
-        return mds->mds_fsops->fs_set_obdo(inode, handle, obdo);
+        return mds->mds_fsops->fs_set_md(inode, handle, md);
 }
 
-static inline int mds_fs_get_obdo(struct mds_obd *mds, struct inode *inode,
-                                  struct obdo *obdo)
+static inline int mds_fs_get_md(struct mds_obd *mds, struct inode *inode,
+                                  struct lov_stripe_md *md)
 {
-        return mds->mds_fsops->fs_get_obdo(inode, obdo);
+        return mds->mds_fsops->fs_get_md(inode, md);
 }
 
 static inline ssize_t mds_fs_readpage(struct mds_obd *mds, struct file *file,
index f866d67..0e5e6fd 100644 (file)
@@ -63,6 +63,7 @@ struct mdc_obd {
         struct ptlrpc_client *mdc_client;
         struct ptlrpc_client *mdc_ldlm_client;
         struct ptlrpc_connection *mdc_conn;
+        int mdc_max_mdsize;
         __u8 mdc_target_uuid[37];
 };
 
@@ -90,6 +91,7 @@ struct mds_obd {
         struct inode_operations *mds_iop;
         struct address_space_operations *mds_aops;
         struct mds_fs_operations *mds_fsops;
+        int mds_max_mdsize;
         struct file *mds_rcvd_filp;
         __u64 mds_last_committed;
         __u64 mds_last_rcvd;
@@ -212,9 +214,11 @@ struct obd_device {
 struct obd_ops {
         int (*o_iocontrol)(long cmd, struct lustre_handle *, int len, void *karg,
                            void *uarg);
-        int (*o_get_info)(struct lustre_handle *, obd_count keylen, void *key,
+        int (*o_get_info)(struct lustre_handle *, 
+                          obd_count keylen, void *key,
                           obd_count *vallen, void **val);
-        int (*o_set_info)(struct lustre_handle *, obd_count keylen, void *key,
+        int (*o_set_info)(struct lustre_handle *, 
+                          obd_count keylen, void *key,
                           obd_count vallen, void *val);
         int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
         int (*o_detach)(struct obd_device *dev);
@@ -226,17 +230,24 @@ struct obd_ops {
 
         int (*o_statfs)(struct lustre_handle *conn, struct statfs *statfs);
         int (*o_preallocate)(struct lustre_handle *, obd_count *req, obd_id *ids);
-        int (*o_create)(struct lustre_handle *conn,  struct obdo *oa);
-        int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa);
+        int (*o_create)(struct lustre_handle *conn,  struct obdo *oa, 
+                        struct lov_stripe_md **ea);
+        int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa, 
+                         struct lov_stripe_md *ea);
         int (*o_setattr)(struct lustre_handle *conn, struct obdo *oa);
         int (*o_getattr)(struct lustre_handle *conn, struct obdo *oa);
-        int (*o_open)(struct lustre_handle *conn, struct obdo *oa);
-        int (*o_close)(struct lustre_handle *conn, struct obdo *oa);
-        int (*o_brw)(int rw, struct lustre_handle *conn, obd_count num_oa,
-                     struct obdo **oa, obd_count *oa_bufs, struct page **buf,
-                     obd_size *count, obd_off *offset, obd_flag *flags,
+        int (*o_open)(struct lustre_handle *conn, struct obdo *oa,
+                      struct lov_stripe_md *);
+        int (*o_close)(struct lustre_handle *conn, struct obdo *oa,
+                       struct lov_stripe_md *);
+        int (*o_brw)(int rw, struct lustre_handle *conn, 
+                     struct lov_stripe_md *md, obd_count oa_bufs, 
+                     struct page **buf,
+                     obd_size *count, 
+                     obd_off *offset, 
+                     obd_flag *flags,
                      void *);
-        int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt, obd_size count,
+        int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt, struct lov_stripe_md *md, obd_size count,
                        obd_off offset);
         int (*o_sync)(struct lustre_handle *conn, struct obdo *tgt, obd_size count,
                       obd_off offset);
index e1c658c..b9782dd 100644 (file)
@@ -213,25 +213,25 @@ static inline int obd_cleanup(struct obd_device *obd)
         RETURN(rc);
 }
 
-static inline int obd_create(struct lustre_handle *conn, struct obdo *obdo)
+static inline int obd_create(struct lustre_handle *conn, struct obdo *obdo, struct lov_stripe_md **ea)
 {
         int rc;
         struct obd_export *export;
         OBD_CHECK_SETUP(conn, export);
         OBD_CHECK_OP(export->export_obd,create);
 
-        rc = OBP(export->export_obd, create)(conn, obdo);
+        rc = OBP(export->export_obd, create)(conn, obdo, ea);
         RETURN(rc);
 }
 
-static inline int obd_destroy(struct lustre_handle *conn, struct obdo *obdo)
+static inline int obd_destroy(struct lustre_handle *conn, struct obdo *obdo, struct lov_stripe_md *ea)
 {
         int rc;
         struct obd_export *export;
         OBD_CHECK_SETUP(conn, export);
         OBD_CHECK_OP(export->export_obd,destroy);
 
-        rc = OBP(export->export_obd, destroy)(conn, obdo);
+        rc = OBP(export->export_obd, destroy)(conn, obdo, ea);
         RETURN(rc);
 }
 
@@ -246,24 +246,25 @@ static inline int obd_getattr(struct lustre_handle *conn, struct obdo *obdo)
         RETURN(rc);
 }
 
-static inline int obd_close(struct lustre_handle *conn, struct obdo *obdo)
+static inline int obd_close(struct lustre_handle *conn, struct obdo *obdo, struct lov_stripe_md *md)
 {
         int rc;
         struct obd_export *export;
         OBD_CHECK_SETUP(conn, export);
         OBD_CHECK_OP(export->export_obd,close);
 
-        rc = OBP(export->export_obd, close)(conn, obdo);
+        rc = OBP(export->export_obd, close)(conn, obdo, md);
         RETURN(rc);
 }
-static inline int obd_open(struct lustre_handle *conn, struct obdo *obdo)
+static inline int obd_open(struct lustre_handle *conn, struct obdo *obdo, 
+                           struct lov_stripe_md *md)
 {
         int rc;
         struct obd_export *export;
         OBD_CHECK_SETUP(conn, export);
         OBD_CHECK_OP(export->export_obd,open);
 
-        rc = OBP(export->export_obd, open) (conn, obdo);
+        rc = OBP(export->export_obd, open) (conn, obdo, md);
         RETURN(rc);
 }
 
@@ -311,6 +312,7 @@ static inline int obd_statfs(struct lustre_handle *conn, struct statfs *buf)
 }
 
 static inline int obd_punch(struct lustre_handle *conn, struct obdo *tgt,
+                            struct lov_stripe_md *md, 
                             obd_size count, obd_off offset)
 {
         int rc;
@@ -318,14 +320,18 @@ static inline int obd_punch(struct lustre_handle *conn, struct obdo *tgt,
         OBD_CHECK_SETUP(conn, export);
         OBD_CHECK_OP(export->export_obd,punch);
 
-        rc = OBP(export->export_obd, punch)(conn, tgt, count, offset);
+        rc = OBP(export->export_obd, punch)(conn, tgt, md, count, offset);
         RETURN(rc);
 }
 
-static inline int obd_brw(int cmd, struct lustre_handle *conn, obd_count num_oa,
-                          struct obdo **oa, obd_count *oa_bufs,
-                          struct page **buf, obd_size *count, obd_off *offset,
-                          obd_flag *flags, void *callback)
+static inline int obd_brw(int cmd, struct lustre_handle *conn, 
+                          struct lov_stripe_md *md, 
+                          obd_count oa_bufs,
+                          struct page **buf, 
+                          obd_size *count, 
+                          obd_off *offset,
+                          obd_flag *flags, 
+                          void *callback)
 {
         int rc;
         struct obd_export *export;
@@ -337,7 +343,7 @@ static inline int obd_brw(int cmd, struct lustre_handle *conn, obd_count num_oa,
                 LBUG();
         }
 
-        rc = OBP(export->export_obd, brw)(cmd, conn, num_oa, oa, oa_bufs, buf,
+        rc = OBP(export->export_obd, brw)(cmd, conn, md, oa_bufs, buf,
                                     count, offset, flags, callback);
         RETURN(rc);
 }
@@ -558,6 +564,8 @@ static inline void obdo_from_inode(struct obdo *dst, struct inode *src)
                 dst->o_nlink = src->i_nlink;
         if ( dst->o_valid & OBD_MD_FLGENER ) 
                 dst->o_generation = src->i_generation;
+        if ( dst->o_valid & OBD_MD_FLRDEV ) 
+                dst->o_rdev = src->i_rdev;
 }
 
 static inline void obdo_to_inode(struct inode *dst, struct obdo *src)
@@ -589,6 +597,8 @@ static inline void obdo_to_inode(struct inode *dst, struct obdo *src)
                 dst->i_nlink = src->o_nlink;
         if ( src->o_valid & OBD_MD_FLGENER )
                 dst->i_generation = src->o_generation;
+        if ( src->o_valid & OBD_MD_FLRDEV )
+                dst->i_rdev = src->o_rdev;
 }
 
 #endif 
@@ -628,6 +638,8 @@ static inline void obdo_cpy_md(struct obdo *dst, struct obdo *src)
                 dst->o_nlink = src->o_nlink;
         if ( src->o_valid & OBD_MD_FLGENER ) 
                 dst->o_generation = src->o_generation;
+        if ( src->o_valid & OBD_MD_FLRDEV ) 
+                dst->o_rdev = src->o_rdev;
         if ( src->o_valid & OBD_MD_FLINLINE &&
              src->o_obdflags & OBD_FL_INLINEDATA) {
                 memcpy(dst->o_inline, src->o_inline, sizeof(src->o_inline));
@@ -671,8 +683,6 @@ static inline int obdo_cmp_md(struct obdo *dst, struct obdo *src,
         /* XXX Don't know if thses should be included here - wasn't previously
         if ( compare & OBD_MD_FLINLINE )
                 res = (res || memcmp(dst->o_inline, src->o_inline));
-        if ( compare & OBD_MD_FLOBDMD )
-                res = (res || memcmp(dst->o_obdmd, src->o_obdmd));
         */
         return res;
 }
index ea6dded..4d50153 100644 (file)
 void lov_unpackdesc(struct lov_desc *ld);
 void lov_packdesc(struct lov_desc *ld);
 
-struct lov_object_id { /* per-child structure */
-        __u64 l_object_id;
-        __u32 l_device_id;
-};
-
-struct lov_md {
-        __u64 lmd_object_id;     /* lov object id */
-        __u64 lmd_stripe_count;
-        __u32 lmd_stripe_size;
-        __u32 lmd_stripe_pattern;  /* per-lov object stripe pattern */
-        struct lov_object_id lmd_objects[0];
-};
 
 #endif
 #endif
index 8ad6e6a..e999451 100644 (file)
@@ -36,7 +36,7 @@
 void ost_pack_niobuf(void **tmp, __u64 offset, __u32 len, __u32 flags,
                      __u32 xid);
 void ost_unpack_niobuf(void **tmp, struct niobuf_remote **nbp);
-void ost_pack_ioo(void **tmp, struct obdo *oa, int bufcnt);
+void ost_pack_ioo(void **tmp, struct lov_stripe_md *oa, int bufcnt);
 void ost_unpack_ioo(void **tmp, struct obd_ioobj **ioop);
 
 #endif
index eea6d97..4108798 100644 (file)
@@ -97,17 +97,14 @@ static void inline obdfs_to_inode(struct inode *inode, struct obdo *oa)
 
         obdo_to_inode(inode, oa);
 
+        if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
+            S_ISFIFO(inode->i_mode)) {
+                obd_rdev rdev = *((obd_rdev *)oa->o_inline);
+                init_special_inode(inode, inode->i_mode, rdev);
+        }
         if (obdo_has_inline(oa)) {
-               if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
-                   S_ISFIFO(inode->i_mode)) {
-                       obd_rdev rdev = *((obd_rdev *)oa->o_inline);
-                       CDEBUG(D_INODE,
-                              "copying device %x from obdo to inode\n", rdev);
-                       init_special_inode(inode, inode->i_mode, rdev);
-               } else {
-                       CDEBUG(D_INFO, "copying inline from obdo to inode\n");
-                       memcpy(oinfo->oi_inline, oa->o_inline, OBD_INLINESZ);
-               }
+                CDEBUG(D_INFO, "copying inline from obdo to inode\n");
+                memcpy(oinfo->oi_inline, oa->o_inline, OBD_INLINESZ);
                 oinfo->oi_flags |= OBD_FL_INLINEDATA;
         }
 } /* obdfs_to_inode */
index 9861e15..ab72796 100644 (file)
@@ -264,12 +264,13 @@ static int ldlm_intent_policy(struct ldlm_lock *lock, void *req_cookie,
         if (req->rq_reqmsg->bufcount > 1) {
                 /* an intent needs to be considered */
                 struct ldlm_intent *it = lustre_msg_buf(req->rq_reqmsg, 1);
+                struct mds_obd *mds= &req->rq_export->export_obd->u.mds;
                 struct mds_body *mds_rep;
                 struct ldlm_reply *rep;
                 __u64 new_resid[3] = {0, 0, 0}, old_res;
                 int bufcount = -1, rc, size[3] = {sizeof(struct ldlm_reply),
                                                   sizeof(struct mds_body),
-                                                  sizeof(struct obdo)};
+                                                  mds->mds_max_mdsize};
 
                 it->opc = NTOH__u64(it->opc);
 
@@ -290,13 +291,10 @@ static int ldlm_intent_policy(struct ldlm_lock *lock, void *req_cookie,
                 case IT_RENAME:
                 case IT_SETATTR:
                 case IT_LOOKUP:
-                        bufcount = 3;
-                        break;
                 case IT_UNLINK:
-                        bufcount = 2;
-                        size[1] = sizeof(struct obdo);
-                        break;
                 case IT_RMDIR:
+                        bufcount = 3;
+                        break;
                 case IT_RENAME2:
                         bufcount = 1;
                         break;
index ec4bbbe..b202791 100644 (file)
 #include <linux/obd_ost.h>
 #include <linux/lustre_net.h>
 
-void ost_pack_ioo(void **tmp, struct obdo *oa, int bufcnt)
+void ost_pack_ioo(void **tmp, struct lov_stripe_md *md, int bufcnt)
 {
         struct obd_ioobj *ioo = *tmp;
         char *c = *tmp;
 
-        ioo->ioo_id = HTON__u64(oa->o_id);
-        ioo->ioo_gr = HTON__u64(oa->o_gr);
-        ioo->ioo_type = HTON__u32(oa->o_mode);
+        ioo->ioo_id = HTON__u64(md->lmd_object_id);
+        ioo->ioo_gr = HTON__u64(0);
+        ioo->ioo_type = HTON__u32(S_IFREG);
         ioo->ioo_bufcnt = HTON__u32(bufcnt);
         *tmp = c + sizeof(*ioo);
 }
index 81f879d..eecff78 100644 (file)
@@ -37,6 +37,7 @@ static int ll_file_open(struct inode *inode, struct file *file)
         struct ptlrpc_request *req = NULL;
         struct ll_file_data *fd;
         struct obdo *oa = NULL;
+        struct lov_stripe_md *md = NULL; 
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct ll_inode_info *lli = ll_i2info(inode);
         ENTRY;
@@ -47,15 +48,22 @@ static int ll_file_open(struct inode *inode, struct file *file)
         /*  delayed create of object (intent created inode) */
         /*  XXX object needs to be cleaned up if mdc_open fails */
         /*  XXX error handling appropriate here? */
-        if (lli->lli_obdo == NULL) {
+        if (lli->lli_smd == NULL || lli->lli_smd->lmd_object_id == 0) {
+                struct mdc_obd *mdc = sbi2mdc(ll_s2sbi(inode->i_sb));
                 struct inode * inode = file->f_dentry->d_inode;
 
-                oa = lli->lli_obdo = obdo_alloc();
+                lli->lli_smd = NULL; 
+                oa =  obdo_alloc();
+                if (!oa) { 
+                        RETURN(-ENOMEM);
+                }
                 oa->o_valid = OBD_MD_FLMODE;
                 oa->o_mode = S_IFREG | 0600;
-                rc = obd_create(ll_i2obdconn(inode), oa);
+                oa->o_easize = mdc->mdc_max_mdsize;
+                rc = obd_create(ll_i2obdconn(inode), oa, &lli->lli_smd);
                 if (rc)
                         RETURN(rc);
+                md = lli->lli_smd;
                 lli->lli_flags &= ~OBD_FL_CREATEONOPEN;
         }
 
@@ -65,8 +73,8 @@ static int ll_file_open(struct inode *inode, struct file *file)
         memset(fd, 0, sizeof(*fd));
 
         rc = mdc_open(&sbi->ll_mdc_conn, inode->i_ino, S_IFREG | inode->i_mode,
-                      file->f_flags,
-                      oa, (__u64)(unsigned long)file, &fd->fd_mdshandle, &req);
+                      file->f_flags, md,
+                      (__u64)(unsigned long)file, &fd->fd_mdshandle, &req);
         fd->fd_req = req;
         ptlrpc_req_finished(req);
         if (rc)
@@ -78,13 +86,17 @@ static int ll_file_open(struct inode *inode, struct file *file)
         if (!fd->fd_mdshandle)
                 CERROR("mdc_open didn't assign fd_mdshandle\n");
 
-        oa = lli->lli_obdo;
         if (oa == NULL) {
-                LBUG();
-                GOTO(out_mdc, rc = -EINVAL);
+                oa =  obdo_alloc();
+                if (!oa)
+                        GOTO(out_mdc, rc = -EINVAL);
         }
+        oa->o_id = lli->lli_smd->lmd_object_id;
+        oa->o_mode = S_IFREG | inode->i_mode;
+        rc = obd_open(ll_i2obdconn(inode), oa, lli->lli_smd);
+        obdo_free(oa);
+        oa = NULL;
 
-        rc = obd_open(ll_i2obdconn(inode), oa);
         if (rc)
                 GOTO(out_mdc, rc = -abs(rc));
 
@@ -99,6 +111,8 @@ out_mdc:
 out_req:
         ptlrpc_free_req(req);
 //out_fd:
+        if (oa)
+                obdo_free(oa);
         kmem_cache_free(ll_file_data_slab, fd);
         file->private_data = NULL;
 out:
@@ -112,6 +126,7 @@ static int ll_file_release(struct inode *inode, struct file *file)
         struct ll_file_data *fd;
         struct obdo *oa;
         struct ll_sb_info *sbi = ll_i2sbi(inode);
+        struct ll_inode_info *lli = ll_i2info(inode);
 
         ENTRY;
 
@@ -121,12 +136,13 @@ static int ll_file_release(struct inode *inode, struct file *file)
                 GOTO(out, rc = -EINVAL);
         }
 
-        oa = ll_i2info(inode)->lli_obdo;
+        oa = obdo_alloc();
         if (oa == NULL) {
                 LBUG();
                 GOTO(out_fd, rc = -ENOENT);
         }
-        rc = obd_close(ll_i2obdconn(inode), oa);
+        rc = obd_close(ll_i2obdconn(inode), oa, lli->lli_smd);
+        obdo_free(oa); 
         if (rc)
                 GOTO(out_fd, abs(rc));
 
index e752e67..30dac44 100644 (file)
@@ -166,8 +166,8 @@ static struct dentry *ll_lookup2(struct inode * dir, struct dentry *dentry,
                 GOTO(negative, NULL);
 
         if ((it->it_op & (IT_RENAME | IT_GETATTR | IT_UNLINK | IT_RMDIR |
-                          IT_SETATTR | IT_LOOKUP)) && it->it_disposition &&
-            it->it_status)
+                          IT_SETATTR | IT_LOOKUP)) && 
+            it->it_disposition && it->it_status)
                 GOTO(negative, NULL);
 
         request = (struct ptlrpc_request *)it->it_data;
@@ -185,51 +185,20 @@ static struct dentry *ll_lookup2(struct inode * dir, struct dentry *dentry,
                         RETURN(ERR_PTR(-abs(err)));
                 }
                 offset = 0;
-        } else if (it->it_op == IT_UNLINK) {
-                struct obdo *obdo;
-                obdo = lustre_msg_buf(request->rq_repmsg, 1);
-                inode = new_inode(dir->i_sb);
-
-                ll_i2info(inode)->lli_obdo = obdo_alloc();
-                /* XXX fix mem allocation error */
-                memcpy(ll_i2info(inode)->lli_obdo, obdo, sizeof(*obdo));
-
-                if (!inode)
-                        GOTO(out_req, -ENOMEM);
-                inode->i_mode = S_IFREG;
-                inode->i_nlink = 1;
-                GOTO(out_req, 0);
-        } else if (it->it_op == IT_RMDIR) {
-                inode = new_inode(dir->i_sb);
-                if (!inode)
-                        GOTO(out_req, -ENOMEM);
-                ll_i2info(inode)->lli_obdo = NULL;
-                inode->i_mode = S_IFDIR;
-                inode->i_nlink = 1;
-                GOTO(out_req, 0);
         } else if (it->it_op == IT_RENAME2) {
-                LBUG();
+                inode = ((struct dentry *)(it->it_data))->d_inode;
+                GOTO(out_req, NULL); 
         } else {
-                struct mds_body *body;
-
                 offset = 1;
-                body = lustre_msg_buf(request->rq_repmsg, 1);
-                type = body->mode;
-                ino = body->fid1.id;
         }
 
-        if (S_ISREG(type)) {
-                if (request->rq_repmsg->bufcount < offset + 2 ||
-                    request->rq_repmsg->buflens[offset + 1] !=
-                    sizeof(struct obdo))
+        md.body = lustre_msg_buf(request->rq_repmsg, offset);
+        if (S_ISREG(md.body->mode)) {
+                if (request->rq_repmsg->bufcount < offset + 1)
                         LBUG();
-
-                md.obdo = lustre_msg_buf(request->rq_repmsg, offset + 1);
+                md.md = lustre_msg_buf(request->rq_repmsg, offset + 1);
         } else
-                md.obdo = NULL;
-
-        if (!(it->it_op & IT_RENAME2))
-                md.body = lustre_msg_buf(request->rq_repmsg, offset);
+                md.md = NULL;
 
         inode = iget4(dir->i_sb, ino, ll_find_inode, &md);
 
@@ -254,7 +223,8 @@ static struct dentry *ll_lookup2(struct inode * dir, struct dentry *dentry,
 static struct inode *ll_create_node(struct inode *dir, const char *name,
                                     int namelen, const char *tgt, int tgtlen,
                                     int mode, __u64 extra,
-                                    struct lookup_intent *it, struct obdo *obdo)
+                                    struct lookup_intent *it, 
+                                    struct lov_stripe_md *smd)
 {
         struct inode *inode;
         struct ptlrpc_request *request = NULL;
@@ -276,17 +246,17 @@ static struct inode *ll_create_node(struct inode *dir, const char *name,
         if (!it->it_disposition) {
                 rc = mdc_create(&sbi->ll_mdc_conn, dir, name, namelen, tgt,
                                  tgtlen, mode, current->fsuid,
-                                 gid, time, extra, obdo, &request);
+                                 gid, time, extra, smd, &request);
                 if (rc) {
                         inode = ERR_PTR(rc);
                         GOTO(out, rc);
                 }
                 body = lustre_msg_buf(request->rq_repmsg, 0);
-                md.obdo = obdo;
+                md.md = smd;
         } else {
                 request = it->it_data;
                 body = lustre_msg_buf(request->rq_repmsg, 1);
-                md.obdo = NULL;
+                md.md = NULL;
         }
 
         body->valid = OBD_MD_FLNOTOBD;
@@ -386,12 +356,14 @@ static int ll_create(struct inode * dir, struct dentry * dentry, int mode)
         int err, rc = 0;
         struct obdo oa;
         struct inode *inode;
+        struct lov_stripe_md *smd;
+        struct ll_inode_info *ii;
 
         if (dentry->d_it->it_disposition == 0) {
                 memset(&oa, 0, sizeof(oa));
                 oa.o_valid = OBD_MD_FLMODE;
                 oa.o_mode = S_IFREG | 0600;
-                rc = obd_create(ll_i2obdconn(dir), &oa);
+                rc = obd_create(ll_i2obdconn(dir), &oa, &smd);
                 if (rc)
                         RETURN(rc);
         }
@@ -400,7 +372,7 @@ static int ll_create(struct inode * dir, struct dentry * dentry, int mode)
         CDEBUG(D_DENTRY, "name %s mode %o o_id %lld\n",
                dentry->d_name.name, mode, (unsigned long long)oa.o_id);
         inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
-                               NULL, 0, mode, 0, dentry->d_it, &oa);
+                               NULL, 0, mode, 0, dentry->d_it, smd);
 
         if (IS_ERR(inode)) {
                 rc = PTR_ERR(inode);
@@ -425,7 +397,8 @@ static int ll_create(struct inode * dir, struct dentry * dentry, int mode)
         RETURN(rc);
 
 out_destroy:
-        err = obd_destroy(ll_i2obdconn(dir), &oa);
+        oa.o_easize = ii->lli_smd->lmd_size;
+        err = obd_destroy(ll_i2obdconn(dir), &oa, ii->lli_smd);
         if (err)
                 CERROR("error destroying object %Ld in error path: err = %d\n",
                        (unsigned long long)oa.o_id, err);
index 06625a1..46689a1 100644 (file)
 /* SYNCHRONOUS I/O to object storage for an inode */
 static int ll_brw(int rw, struct inode *inode, struct page *page, int create)
 {
-        obd_count        num_obdo = 1;
-        obd_count        bufs_per_obdo = 1;
-        struct obdo     *oa;
+        struct ll_inode_info *lii = ll_i2info(inode);
+        struct lov_stripe_md *md = lii->lli_smd;
         obd_size         count = PAGE_SIZE;
         obd_off          offset = ((obd_off)page->index) << PAGE_SHIFT;
         obd_flag         flags = create ? OBD_BRW_CREATE : 0;
         int              err;
         ENTRY;
 
-        oa = ll_i2info(inode)->lli_obdo;
-        err = obd_brw(rw, ll_i2obdconn(inode), num_obdo, &oa, &bufs_per_obdo,
+        err = obd_brw(rw, ll_i2obdconn(inode), md, 1,
                       &page, &count, &offset, &flags, NULL);
         RETURN(err);
 } /* ll_brw */
@@ -105,6 +103,10 @@ static int ll_prepare_write(struct file *file, struct page *page, unsigned from,
          * to date until commit_write */
         if (from == 0 && to == PAGE_SIZE)
                 RETURN(0);
+        
+        /* prepare write should not read what lies beyond the end of
+           the file */
+
 
         rc = ll_brw(OBD_BRW_READ, inode, page, 0);
 
@@ -144,9 +146,8 @@ static int ll_commit_write(struct file *file, struct page *page,
 {
         int create = 1;
         struct inode *inode = page->mapping->host;
-        obd_count        num_obdo = 1;
-        obd_count        bufs_per_obdo = 1;
-        struct obdo     *oa;
+        struct ll_inode_info *lii = ll_i2info(inode);
+        struct lov_stripe_md *md = lii->lli_smd;
         obd_size         count = to;
         obd_off          offset = (((obd_off)page->index) << PAGE_SHIFT);
         obd_flag         flags = create ? OBD_BRW_CREATE : 0;
@@ -154,7 +155,6 @@ static int ll_commit_write(struct file *file, struct page *page,
         struct iattr     iattr;
 
         ENTRY;
-        oa = ll_i2info(inode)->lli_obdo;
 
         SetPageUptodate(page);
 
@@ -164,8 +164,8 @@ static int ll_commit_write(struct file *file, struct page *page,
         CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n", 
                from, to, (unsigned long long)count);
 
-        err = obd_brw(OBD_BRW_WRITE, ll_i2obdconn(inode), num_obdo, &oa,
-                      &bufs_per_obdo, &page, &count, &offset, &flags, NULL);
+        err = obd_brw(OBD_BRW_WRITE, ll_i2obdconn(inode), md, 
+                      1, &page, &count, &offset, &flags, NULL);
         kunmap(page);
 
         iattr.ia_size = offset + to;
@@ -187,22 +187,24 @@ static int ll_commit_write(struct file *file, struct page *page,
 
 void ll_truncate(struct inode *inode)
 {
-        struct obdo *oa;
+        struct obdo oa = {0};
+        struct lov_stripe_md *md = ll_i2info(inode)->lli_smd;
         int err;
         ENTRY;
 
-        oa = ll_i2info(inode)->lli_obdo;
-        if (!oa) { 
+        if (!md) { 
                 /* object not yet allocated */
                 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
                 return;
         }
+
         CDEBUG(D_INFO, "calling punch for %ld (all bytes after %Ld)\n",
-               (long)oa->o_id, (unsigned long long)oa->o_size);
-        oa->o_size = inode->i_size;
-        oa->o_valid = OBD_MD_FLSIZE | OBD_MD_FLID;
+               (long)oa.o_id, (unsigned long long)oa.o_size);
+        oa.o_size = inode->i_size;
+        oa.o_id = md->lmd_object_id;
+        oa.o_valid = OBD_MD_FLSIZE | OBD_MD_FLID;
         /* truncate == punch from i_size onwards */
-        err = obd_punch(ll_i2obdconn(inode), oa, -1 - oa->o_size, oa->o_size);
+        err = obd_punch(ll_i2obdconn(inode), &oa, md, -1 - oa.o_size, oa.o_size);
         if (err)
                 CERROR("obd_truncate fails (%d)\n", err);
         else
@@ -219,9 +221,9 @@ void ll_truncate(struct inode *inode)
 int ll_direct_IO(int rw, struct inode *inode, struct kiobuf *iobuf,
                  unsigned long blocknr, int blocksize)
 {
-        obd_count        num_obdo = 1;
         obd_count        bufs_per_obdo = iobuf->nr_pages;
-        struct obdo      *oa = NULL;
+        struct ll_inode_info *lii = ll_i2info(inode);
+        struct lov_stripe_md *md = lii->lli_smd;
         obd_size         *count = NULL;
         obd_off          *offset = NULL;
         obd_flag         *flags = NULL;
@@ -250,12 +252,11 @@ int ll_direct_IO(int rw, struct inode *inode, struct kiobuf *iobuf,
                 flags[i] = OBD_BRW_CREATE;
         }
 
-        oa = ll_i2info(inode)->lli_obdo;
-        if (!oa)
+        if (!md || !md->lmd_object_id)
                 GOTO(out, rc = -ENOMEM);
 
         rc = obd_brw(rw == WRITE ? OBD_BRW_WRITE : OBD_BRW_READ,
-                     ll_i2obdconn(inode), num_obdo, &oa, &bufs_per_obdo,
+                     ll_i2obdconn(inode), md, bufs_per_obdo,
                      iobuf->maplist, count, offset, flags, NULL);
         if (rc == 0)
                 rc = bufs_per_obdo * PAGE_SIZE;
index 4db2384..bf3a8ba 100644 (file)
@@ -191,7 +191,7 @@ static struct super_block * ll_read_super(struct super_block *sb,
         }
 
         md.body = lustre_msg_buf(request->rq_repmsg, 0);
-        md.obdo = NULL;
+        md.md = NULL;
         root = iget4(sb, sbi->ll_rootino, NULL, &md);
                      
         if (root) {
@@ -242,10 +242,10 @@ static void ll_put_super(struct super_block *sb)
 static void ll_clear_inode(struct inode *inode)
 {
         if (atomic_read(&inode->i_count) == 0) {
-                struct obdo *oa = ll_i2info(inode)->lli_obdo;
-                if (oa) {
-                        obdo_free(oa);
-                        ll_i2info(inode)->lli_obdo = NULL;
+                struct lov_stripe_md *md = ll_i2info(inode)->lli_smd;
+                if (md) {
+                        OBD_FREE(md, md->lmd_size); 
+                        ll_i2info(inode)->lli_smd = NULL;
                 }
                 if (ll_i2info(inode)->lli_symlink_name) {
                         OBD_FREE(ll_i2info(inode)->lli_symlink_name,
@@ -259,19 +259,23 @@ static void ll_delete_inode(struct inode *inode)
 {
         if (S_ISREG(inode->i_mode)) { 
                 int err;
-                struct obdo *oa;
-                oa = ll_i2info(inode)->lli_obdo;
-
-                if (!oa)
+                struct obdo oa;
+                struct lov_stripe_md *md = ll_i2info(inode)->lli_smd;
+               if (!md)
                         GOTO(out, -EINVAL);
 
-                if (oa->o_id == 0)
+                oa.o_id = md->lmd_object_id;
+                oa.o_easize = md->lmd_size;
+                if (oa.o_id == 0) { 
+                        CERROR("This really happens\n"); 
                         /* No obdo was ever created */
                         GOTO(out, 0);
+                }
 
-                err = obd_destroy(ll_i2obdconn(inode), oa);
-                CDEBUG(D_INODE, "obd destroy of %Ld error %d\n",
-                       (unsigned long long)oa->o_id, err);
+                err = obd_destroy(ll_i2obdconn(inode), &oa, md);
+                CDEBUG(D_SUPER, "obd destroy of %Ld error %d\n",
+                       md->lmd_object_id, err);
         }
 out:
         clear_inode(inode);
@@ -380,6 +384,12 @@ out:
         RETURN(rc);
 }
 
+inline int ll_stripe_md_size(struct super_block *sb)
+{
+        struct mdc_obd *mdc = sbi2mdc(ll_s2sbi(sb));
+        return mdc->mdc_max_mdsize;
+}
+
 static void ll_to_inode(struct inode *dst, struct ll_inode_md *md)
 {
         struct mds_body *body = md->body;
@@ -408,28 +418,23 @@ static void ll_to_inode(struct inode *dst, struct ll_inode_md *md)
                 dst->i_nlink = body->nlink;
         if (body->valid & OBD_MD_FLGENER)
                 dst->i_generation = body->generation;
-
-        /* this will become more elaborate for striping etc */
-        if (md->obdo != NULL && md->obdo->o_valid != 0) {
-                ii->lli_obdo = obdo_alloc();
-                memcpy(ii->lli_obdo, md->obdo, sizeof(*md->obdo));
-        }
-#if 0
-
-        if (obdo_has_inline(oa)) {
-                if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
-                    S_ISFIFO(inode->i_mode)) {
-                        obd_rdev rdev = *((obd_rdev *)oa->o_inline);
-                        CDEBUG(D_INODE,
-                               "copying device %x from obdo to inode\n", rdev);
-                        init_special_inode(inode, inode->i_mode, rdev);
-                } else {
-                        CDEBUG(D_INFO, "copying inline from obdo to inode\n");
-                        memcpy(oinfo->lli_inline, oa->o_inline, OBD_INLINESZ);
+        if (body->valid & OBD_MD_FLRDEV)
+                dst->i_rdev = body->extra;
+        if (md && md->md && md->md->lmd_stripe_count) { 
+                struct lov_stripe_md *smd = md->md;
+                int size = ll_stripe_md_size(dst->i_sb);
+                if (md->md->lmd_size != size) { 
+                        CERROR("Striping metadata size error %ld\n",
+                               dst->i_ino); 
+                        LBUG();
                 }
-                oinfo->lli_flags |= OBD_FL_INLINEDATA;
+                OBD_ALLOC(ii->lli_smd, size);
+                if (!ii->lli_smd){ 
+                        CERROR("No memory for %d\n", size);
+                        LBUG();
+                }
+                memcpy(ii->lli_smd, smd, size);
         }
-#endif 
 } /* ll_to_inode */
 
 static void ll_read_inode2(struct inode *inode, void *opaque)
index 57836a0..4f7363f 100644 (file)
@@ -62,6 +62,9 @@ static int lov_getinfo(struct obd_device *obd,
                 *uuids = lustre_msg_buf(req->rq_repmsg, 1);
                 lov_unpackdesc(desc); 
         }
+        mdc->mdc_max_mdsize = sizeof(*desc) + 
+                desc->ld_tgt_count * sizeof(uuid_t);
+
         EXIT;
  out:
         return rc;
@@ -135,10 +138,11 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd)
  out_mem:
         if (rc) { 
                 for (i = 0 ; i < lov->desc.ld_tgt_count; i++) { 
-                        rc = obd_disconnect(&lov->tgts[i].conn);
-                        if (rc)
-                                CERROR("Target %s disconnect error %d\n", 
-                                       uuidarray[i], rc); 
+                        int rc2;
+                        rc2 = obd_disconnect(&lov->tgts[i].conn);
+                        if (rc2)
+                                CERROR("BAD: Target %s disconnect error %d\n", 
+                                       uuidarray[i], rc2); 
                 }
                 OBD_FREE(lov->tgts, lov->bufsize);
         }
@@ -164,9 +168,11 @@ static int lov_disconnect(struct lustre_handle *conn)
 
         for (i = 0 ; i < lov->desc.ld_tgt_count; i++) { 
                 rc = obd_disconnect(&lov->tgts[i].conn);
-                if (rc)
+                if (rc) { 
                         CERROR("Target %s disconnect error %d\n", 
                                lov->tgts[i].uuid, rc); 
+                        RETURN(rc);
+                }
         }
         OBD_FREE(lov->tgts, lov->bufsize);
         lov->bufsize = 0;
@@ -209,6 +215,111 @@ static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
         RETURN(rc); 
 } 
 
+
+static inline int lov_stripe_md_size(struct obd_device *obd)
+{
+        struct lov_obd *lov = &obd->u.lov;
+        int size;
+
+        size = sizeof(struct lov_stripe_md) + 
+                lov->desc.ld_tgt_count * sizeof(struct lov_object_id); 
+        return size;
+}
+
+static int lov_create(struct lustre_handle *conn, struct obdo *oa, struct lov_stripe_md **ea)
+{
+        int rc, i;
+        struct obdo tmp;
+        struct obd_export *export = class_conn2export(conn);
+        struct lov_obd *lov;
+        struct lov_stripe_md *md;
+        ENTRY;
+
+        if (!ea) { 
+                CERROR("lov_create needs EA for striping information\n"); 
+                RETURN(-EINVAL); 
+        }
+
+        if (!export)
+                RETURN(-EINVAL);
+        lov = &export->export_obd->u.lov;
+
+        oa->o_easize =  lov_stripe_md_size(export->export_obd); 
+        if (! *ea) { 
+                OBD_ALLOC(*ea, oa->o_easize); 
+                if (! *ea) 
+                        RETURN(-ENOMEM); 
+        }
+
+        md = *ea; 
+        md->lmd_size = oa->o_easize;
+        md->lmd_object_id = oa->o_id;
+        if (!md->lmd_stripe_count) { 
+                md->lmd_stripe_count = lov->desc.ld_default_stripecount;
+        }
+
+        for (i = 0; i < md->lmd_stripe_count; i++) {
+                struct lov_stripe_md obj_md; 
+                struct lov_stripe_md *obj_mdp = &obj_md; 
+                /* create data objects with "parent" OA */ 
+                memcpy(&tmp, oa, sizeof(tmp));
+                tmp.o_easize = sizeof(struct lov_stripe_md);
+                rc = obd_create(&lov->tgts[i].conn, &tmp, &obj_mdp);
+                if (rc) 
+                        GOTO(out_cleanup, rc); 
+                md->lmd_objects[i].l_object_id = tmp.o_id;
+        }
+
+ out_cleanup: 
+        if (rc) { 
+                int i2, rc2;
+                for (i2 = 0 ; i2 < i ; i2++) { 
+                        /* destroy already created objects here */ 
+                        tmp.o_id = md->lmd_objects[i].l_object_id;
+                        rc2 = obd_destroy(&lov->tgts[i].conn, &tmp, NULL);
+                        if (rc2) { 
+                                CERROR("Failed to remove object from target %d\n", 
+                                       i2); 
+                        }
+                }
+        }
+        return rc;
+}
+
+static int lov_destroy(struct lustre_handle *conn, struct obdo *oa, 
+struct lov_stripe_md *ea)
+{
+        int rc, i;
+        struct obdo tmp;
+        struct obd_export *export = class_conn2export(conn);
+        struct lov_obd *lov;
+        struct lov_stripe_md *md;
+        ENTRY;
+
+        if (!ea) { 
+                CERROR("LOV requires striping ea for desctruction\n"); 
+                RETURN(-EINVAL); 
+        }
+
+        if (!export || !export->export_obd) 
+                RETURN(-ENODEV); 
+
+        lov = &export->export_obd->u.lov;
+        md = ea;
+
+        for (i = 0; i < md->lmd_stripe_count; i++) {
+                /* create data objects with "parent" OA */ 
+                memcpy(&tmp, oa, sizeof(tmp));
+                oa->o_id = md->lmd_objects[i].l_object_id; 
+                rc = obd_destroy(&lov->tgts[i].conn, &tmp, NULL);
+                if (!rc) { 
+                        CERROR("Error destroying object %Ld on %d\n",
+                               oa->o_id, i); 
+                }
+        }
+        RETURN(rc);
+}
+
 #if 0
 static int lov_getattr(struct lustre_handle *conn, struct obdo *oa)
 {
@@ -279,73 +390,7 @@ static int lov_close(struct lustre_handle *conn, struct obdo *oa)
         RETURN(rc);
 }
 
-static int lov_create(struct lustre_handle *conn, struct obdo *oa)
-{
-        int rc, retval, i, offset;
-        struct obdo tmp;
-        struct lov_md md;
-        ENTRY;
-
-        if (!class_conn2export(conn))
-                RETURN(-EINVAL);
-
-        md.lmd_object_id = oa->o_id;
-        md.lmd_stripe_count = conn->oc_dev->obd_multi_count;
-
-        memset(oa->o_inline, 0, sizeof(oa->o_inline));
-        offset = sizeof(md);
-        for (i = 0; i < md.lmd_stripe_count; i++) {
-                struct lov_object_id lov_id;
-                rc = obd_create(&conn->oc_dev->obd_multi_conn[i], &tmp);
-                if (i == 0) {
-                        memcpy(oa, &tmp, sizeof(tmp));
-                        retval = rc;
-                } else if (retval != rc)
-                        CERROR("return codes didn't match (%d, %d)\n",
-                               retval, rc);
-                lov_id = (struct lov_object_id *)(oa->o_inline + offset);
-                lov_id->l_device_id = i;
-                lov_id->l_object_id = tmp.o_id;
-                offset += sizeof(*lov_id);
-        }
-        memcpy(oa->o_inline, &md, sizeof(md));
-
-        return rc;
-}
-
-static int lov_destroy(struct lustre_handle *conn, struct obdo *oa)
-{
-        int rc, retval, i, offset;
-        struct obdo tmp;
-        struct lov_md *md;
-        struct lov_object_id lov_id;
-        ENTRY;
-
-        if (!class_conn2export(conn))
-                RETURN(-EINVAL);
-
-        md = (struct lov_md *)oa->o_inline;
-
-        memcpy(&tmp, oa, sizeof(tmp));
-
-        offset = sizeof(md);
-        for (i = 0; i < md->lmd_stripe_count; i++) {
-                struct lov_object_id *lov_id;
-                lov_id = (struct lov_object_id *)(oa->o_inline + offset);
-
-                tmp.o_id = lov_id->l_object_id;
-
-                rc = obd_destroy(&conn->oc_dev->obd_multi_conn[i], &tmp);
-                if (i == 0)
-                        retval = rc;
-                else if (retval != rc)
-                        CERROR("return codes didn't match (%d, %d)\n",
-                               retval, rc);
-                offset += sizeof(*lov_id);
-        }
 
-        return rc;
-}
 
 /* FIXME: maybe we'll just make one node the authoritative attribute node, then
  * we can send this 'punch' to just the authoritative node and the nodes
@@ -556,13 +601,13 @@ struct obd_ops lov_obd_ops = {
         o_setup:       lov_setup,
         o_connect:     lov_connect,
         o_disconnect:  lov_disconnect,
-#if 0
         o_create:      lov_create,
+        o_destroy:     lov_destroy,
+#if 0
         o_getattr:     lov_getattr,
         o_setattr:     lov_setattr,
         o_open:        lov_open,
         o_close:       lov_close,
-        o_destroy:     lov_destroy,
         o_brw:         lov_pgcache_brw,
         o_punch:       lov_punch,
         o_enqueue:     lov_enqueue,
index 8cdd92c..6b7fd21 100644 (file)
@@ -76,7 +76,7 @@ int mdc_setattr(struct lustre_handle *conn,
 int mdc_create(struct lustre_handle *conn,
                struct inode *dir, const char *name, int namelen,
                const char *tgt, int tgtlen, int mode, __u32 uid,
-               __u32 gid, __u64 time, __u64 rdev, struct obdo *obdo,
+               __u32 gid, __u64 time, __u64 rdev, struct lov_stripe_md *md,
                struct ptlrpc_request **request)
 {
         struct mds_rec_create *rec;
@@ -88,8 +88,13 @@ int mdc_create(struct lustre_handle *conn,
         ENTRY;
 
         if (S_ISREG(mode)) {
-                size[2] = sizeof(*obdo);
-                bufs[2] = (char *)obdo;
+                if (!md) {
+                        CERROR("File create, but no md (%ld, %*s)\n",
+                               dir->i_ino, namelen, name); 
+                        LBUG();
+                }
+                size[2] = md->lmd_size;
+                bufs[2] = (char *)md;
                 bufcount = 3;
         } else if (S_ISLNK(mode)) {
                 size[2] = tgtlen + 1;
@@ -102,13 +107,14 @@ int mdc_create(struct lustre_handle *conn,
         if (!req)
                 RETURN(-ENOMEM);
 
+        /* mds_create_pack fills bufs[1] with name */
         rec = lustre_msg_buf(req->rq_reqmsg, 0);
         mds_create_pack(req, 0, dir, mode, rdev, uid, gid, time,
                         name, namelen, NULL, 0);
 
         if (S_ISREG(mode)) {
                 tmp = lustre_msg_buf(req->rq_reqmsg, 2);
-                memcpy(tmp, obdo, sizeof(*obdo));
+                memcpy(tmp, md, md->lmd_size);
         } else if (S_ISLNK(mode)) {
                 tmp = lustre_msg_buf(req->rq_reqmsg, 2);
                 LOGL0(tgt, tgtlen, tmp);
index 19f3ef8..8c8af77 100644 (file)
@@ -101,7 +101,7 @@ int mdc_getattr(struct lustre_handle *conn,
 
         if (S_ISREG(type)) {
                 bufcount = 2;
-                size[1] = sizeof(struct obdo);
+                size[1] = mdc->mdc_max_mdsize;
         } else if (valid & OBD_MD_LINKNAME) {
                 bufcount = 2;
                 size[1] = ea_size;
@@ -169,6 +169,9 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type,
         __u64 res_id[RES_NAME_SIZE] = {dir->i_ino};
         int size[5] = {sizeof(struct ldlm_request), sizeof(struct ldlm_intent)};
         int rc, flags;
+        int repsize[3] = {sizeof(struct ldlm_reply), 
+                          sizeof(struct mds_body),
+                          mdc->mdc_max_mdsize};
         struct ldlm_reply *dlm_rep;
         struct ldlm_intent *lit;
         ENTRY;
@@ -207,11 +210,7 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type,
                 mds_create_pack(req, 2, dir, it->it_mode, id, current->fsuid,
                                 current->fsgid, CURRENT_TIME, de->d_name.name,
                                 de->d_name.len, tgt, tgtlen);
-
-                size[0] = sizeof(struct ldlm_reply);
-                size[1] = sizeof(struct mds_body);
-                size[2] = sizeof(struct obdo);
-                req->rq_replen = lustre_msg_size(3, size);
+                req->rq_replen = lustre_msg_size(3, repsize);
         } else if (it->it_op == IT_RENAME2) {
                 struct dentry *old_de = it->it_data;
 
@@ -232,10 +231,8 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type,
                 mds_rename_pack(req, 2, old_de->d_parent->d_inode, dir,
                                 old_de->d_name.name, old_de->d_name.len,
                                 de->d_name.name, de->d_name.len);
-
-                size[0] = sizeof(struct ldlm_reply);
-                req->rq_replen = lustre_msg_size(1, size);
-        } else if (it->it_op == IT_UNLINK) {
+                req->rq_replen = lustre_msg_size(1, repsize);
+        } else if (it->it_op == IT_UNLINK || it->it_op == IT_RMDIR) {
                 size[2] = sizeof(struct mds_rec_unlink);
                 size[3] = de->d_name.len + 1;
                 req = ptlrpc_prep_req2(mdc->mdc_ldlm_client, mdc->mdc_conn,
@@ -250,27 +247,8 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type,
                 /* pack the intended request */
                 mds_unlink_pack(req, 2, dir, NULL, de->d_name.name, 
                                 de->d_name.len);
-                size[0] = sizeof(struct ldlm_reply);
-                size[1] = sizeof(struct obdo);
-                req->rq_replen = lustre_msg_size(2, size);
-        } else if (it->it_op == IT_RMDIR) {
-                size[2] = sizeof(struct mds_rec_unlink);
-                size[3] = de->d_name.len + 1;
-                req = ptlrpc_prep_req2(mdc->mdc_ldlm_client, mdc->mdc_conn,
-                                       &mdc->mdc_connh, LDLM_ENQUEUE, 4, size,
-                                       NULL);
-                if (!req)
-                        RETURN(-ENOMEM);
 
-                /* pack the intent */
-                lit = lustre_msg_buf(req->rq_reqmsg, 1);
-                lit->opc = NTOH__u64((__u64)it->it_op);
-
-                /* pack the intended request */
-                mds_unlink_pack(req, 2, dir, NULL, de->d_name.name, 
-                                de->d_name.len);
-                size[0] = sizeof(struct ldlm_reply);
-                req->rq_replen = lustre_msg_size(1, size);
+                req->rq_replen = lustre_msg_size(3, repsize);
         } else if (it->it_op == IT_GETATTR || it->it_op == IT_RENAME ||
                    it->it_op == IT_OPEN || it->it_op == IT_SETATTR ||
                    it->it_op == IT_LOOKUP) {
@@ -291,10 +269,7 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type,
                 mds_getattr_pack(req, 2, dir, de->d_name.name, de->d_name.len);
 
                 /* get ready for the reply */
-                size[0] = sizeof(struct ldlm_reply);
-                size[1] = sizeof(struct mds_body);
-                size[2] = sizeof(struct obdo);
-                req->rq_replen = lustre_msg_size(3, size);
+                 req->rq_replen = lustre_msg_size(3, repsize);
         } else if (it->it_op == IT_READDIR) {
                 req = ptlrpc_prep_req2(mdc->mdc_ldlm_client, mdc->mdc_conn,
                                 &mdc->mdc_connh, LDLM_ENQUEUE, 1, size, NULL);
@@ -302,8 +277,7 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type,
                         RETURN(-ENOMEM);
 
                 /* get ready for the reply */
-                size[0] = sizeof(struct ldlm_reply);
-                req->rq_replen = lustre_msg_size(1, size);
+                req->rq_replen = lustre_msg_size(1, repsize);
         } else {
                 LBUG();
                 RETURN(-1);
@@ -331,7 +305,7 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type,
 }
 
 int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags,
-             struct obdo *obdo,
+             struct lov_stripe_md *md, 
              __u64 cookie, __u64 *fh, struct ptlrpc_request **request)
 {
         struct mdc_obd *mdc = mdc_conn2mdc(conn);
@@ -340,9 +314,9 @@ int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags,
         struct ptlrpc_request *req;
         ENTRY;
 
-        if (obdo != NULL) {
+        if (md != NULL) {
                 bufcount = 2;
-                size[1] = sizeof(*obdo);
+                size[1] = md->lmd_size;
         }
 
         req = ptlrpc_prep_req2(mdc->mdc_client, mdc->mdc_conn, &mdc->mdc_connh,
@@ -357,14 +331,13 @@ int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags,
         body->flags = HTON__u32(flags);
         body->extra = cookie;
 
-        if (obdo != NULL)
-                memcpy(lustre_msg_buf(req->rq_reqmsg, 1), obdo, sizeof(*obdo));
+        if (md != NULL)
+                memcpy(lustre_msg_buf(req->rq_reqmsg, 1), md, md->lmd_size);
 
         req->rq_replen = lustre_msg_size(1, size);
 
         rc = ptlrpc_queue_wait(req);
         rc = ptlrpc_check_status(req, rc);
-
         if (!rc) {
                 body = lustre_msg_buf(req->rq_repmsg, 0);
                 mds_unpack_body(body);
@@ -668,6 +641,7 @@ static int mdc_setup(struct obd_device *obddev, obd_count len, void *buf)
                            mdc->mdc_ldlm_client);
         mdc->mdc_client->cli_name = "mdc";
         mdc->mdc_ldlm_client->cli_name = "ldlm";
+        mdc->mdc_max_mdsize = sizeof(struct lov_stripe_md); 
         /* XXX get recovery hooked in here again */
         //ptlrpc_init_client(ptlrpc_connmgr, ll_recover,...
 
index cf32175..6e48ccf 100644 (file)
@@ -95,7 +95,8 @@ static int mds_sendpage(struct ptlrpc_request *req, struct file *file,
 struct dentry *mds_name2locked_dentry(struct mds_obd *mds, struct dentry *dir,
                                       struct vfsmount **mnt, char *name,
                                       int namelen, int lock_mode,
-                                      struct lustre_handle *lockh)
+                                      struct lustre_handle *lockh, 
+                                      int dir_lock_mode)
 {
         struct dentry *dchild;
         int flags, rc;
@@ -109,9 +110,12 @@ struct dentry *mds_name2locked_dentry(struct mds_obd *mds, struct dentry *dir,
                 up(&dir->d_inode->i_sem);
                 LBUG();
         }
-        up(&dir->d_inode->i_sem);
+        if (dir_lock_mode != LCK_EX && dir_lock_mode != LCK_PW) { 
+                up(&dir->d_inode->i_sem);
+                ldlm_lock_decref(lockh, dir_lock_mode); 
+        }
 
-        if (lock_mode == 0)
+        if (lock_mode == 0 || !dchild->d_inode)
                 RETURN(dchild);
 
         res_id[0] = dchild->d_inode->i_ino;
@@ -302,6 +306,7 @@ static int mds_getstatus(struct ptlrpc_request *req)
 
 static int mds_lovinfo(struct ptlrpc_request *req)
 {
+        struct mds_obd *mds = mds_req2mds(req);
         struct mds_status_req *streq;
         struct lov_desc *desc; 
         int rc, size[2] = {sizeof(*desc)};
@@ -333,6 +338,8 @@ static int mds_lovinfo(struct ptlrpc_request *req)
                 RETURN(0);
         }
 
+        mds->mds_max_mdsize = sizeof(desc) + 
+                desc->ld_tgt_count * sizeof(uuid_t);
         rc = mds_get_lovtgts(req->rq_obd, lustre_msg_buf(req->rq_repmsg, 1));
         if (rc) { 
                 CERROR("get_lovtgts error %d", rc);
@@ -418,7 +425,7 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req)
         down(&dir->i_sem);
         dchild = lookup_one_len(name, de, namelen - 1);
         if (IS_ERR(dchild)) {
-                CERROR("child lookup error %ld\n", PTR_ERR(dchild));
+                CDEBUG(D_INODE, "child lookup error %ld\n", PTR_ERR(dchild));
                 up(&dir->i_sem);
                 LBUG();
                 GOTO(out_create_dchild, rc = -ESTALE);
@@ -426,17 +433,18 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req)
 
         if (dchild->d_inode) {
                 struct mds_body *body;
-                struct obdo *obdo;
                 struct inode *inode = dchild->d_inode;
-                CERROR("child exists (dir %ld, name %s, ino %ld)\n",
+                CDEBUG(D_INODE, "child exists (dir %ld, name %s, ino %ld)\n",
                        dir->i_ino, name, dchild->d_inode->i_ino);
 
                 body = lustre_msg_buf(req->rq_repmsg, offset);
                 mds_pack_inode2fid(&body->fid1, inode);
                 mds_pack_inode2body(body, inode);
                 if (S_ISREG(inode->i_mode)) {
-                        obdo = lustre_msg_buf(req->rq_repmsg, offset + 1);
-                        mds_fs_get_obdo(mds, inode, obdo);
+                        struct lov_stripe_md *md;
+                        md = lustre_msg_buf(req->rq_repmsg, offset + 1);
+                        md->lmd_size = mds->mds_max_mdsize;
+                        mds_fs_get_md(mds, inode, md);
                 }
                 /* now a normal case for intent locking */
                 rc = 0;
@@ -477,7 +485,7 @@ static int mds_getattr(int offset, struct ptlrpc_request *req)
         inode = de->d_inode;
         if (S_ISREG(body->fid1.f_type)) {
                 bufcount = 2;
-                size[1] = sizeof(struct obdo);
+                size[1] = mds->mds_max_mdsize;
         } else if (body->valid & OBD_MD_LINKNAME) {
                 bufcount = 2;
                 size[1] = inode->i_size;
@@ -515,10 +523,10 @@ static int mds_getattr(int offset, struct ptlrpc_request *req)
         body->valid = ~0; /* FIXME: should be more selective */
 
         if (S_ISREG(inode->i_mode)) {
-                rc = mds_fs_get_obdo(mds, inode,
+                rc = mds_fs_get_md(mds, inode,
                                      lustre_msg_buf(req->rq_repmsg, 1));
                 if (rc < 0) {
-                        CERROR("mds_fs_get_obdo failed: %d\n", rc);
+                        CERROR("mds_fs_get_md failed: %d\n", rc);
                         GOTO(out, rc);
                 }
         }
@@ -617,13 +625,12 @@ static int mds_open(struct ptlrpc_request *req)
         /* check if this inode has seen a delayed object creation */
         if (req->rq_reqmsg->bufcount > 1) {
                 void *handle;
+                struct lov_stripe_md *md;
                 struct inode *inode = de->d_inode;
                 //struct iattr iattr;
-                struct obdo *obdo;
                 int rc;
 
-                obdo = lustre_msg_buf(req->rq_reqmsg, 1);
-                //iattr.ia_valid = ATTR_MODE;
+                md = lustre_msg_buf(req->rq_reqmsg, 1);
                 //iattr.ia_mode = inode->i_mode;
 
                 handle = mds_fs_start(mds, de->d_inode, MDS_FSOP_SETATTR);
@@ -633,7 +640,7 @@ static int mds_open(struct ptlrpc_request *req)
                 }
 
                 /* XXX error handling */
-                rc = mds_fs_set_obdo(mds, inode, handle, obdo);
+                rc = mds_fs_set_md(mds, inode, handle, md);
                 //                rc = mds_fs_setattr(mds, de, handle, &iattr);
                 if (!rc) {
                         struct obd_run_ctxt saved;
@@ -980,6 +987,7 @@ static int mds_setup(struct obd_device *obddev, obd_count len, void *buf)
         if (!mds->mds_sb)
                 GOTO(err_put, rc = -ENODEV);
 
+        mds->mds_max_mdsize = sizeof(struct lov_stripe_md);
         rc = mds_fs_setup(mds, mnt);
         if (rc) {
                 CERROR("MDS filesystem method init failed: rc = %d\n", rc);
index fc8da8b..25d3990 100644 (file)
@@ -97,46 +97,42 @@ static int mds_extN_setattr(struct dentry *dentry, void *handle,
                 return inode_setattr(inode, iattr);
 }
 
-static int mds_extN_set_obdo(struct inode *inode, void *handle,
-                             struct obdo *obdo)
+static int mds_extN_set_md(struct inode *inode, void *handle,
+                             struct lov_stripe_md *md)
 {
-        struct mds_objid *data; 
         int rc;
 
 
 
         lock_kernel();
         down(&inode->i_sem);
-        if (obdo == NULL)
+        if (md == NULL)
                 rc = extN_xattr_set(handle, inode, EXTN_XATTR_INDEX_LUSTRE,
                                     XATTR_LUSTRE_MDS_OBJID, NULL, 0, 0);
         else { 
-                data = (struct mds_objid *)obdo->o_inline;       
-                data->mo_magic = cpu_to_le64(XATTR_MDS_MO_MAGIC);
+                md->lmd_magic = cpu_to_le32(XATTR_MDS_MO_MAGIC);
                 rc = extN_xattr_set(handle, inode, EXTN_XATTR_INDEX_LUSTRE,
-                                    XATTR_LUSTRE_MDS_OBJID, obdo->o_inline,
-                                    OBD_INLINESZ, XATTR_CREATE);
+                                    XATTR_LUSTRE_MDS_OBJID, md, 
+                                    md->lmd_size, XATTR_CREATE);
         }
         up(&inode->i_sem);
         unlock_kernel();
 
         if (rc)
                 CERROR("error adding objectid %Ld to inode %ld\n",
-                       (unsigned long long)obdo->o_id, inode->i_ino);
+                       (unsigned long long)md->lmd_object_id, inode->i_ino);
         return rc;
 }
 
-static int mds_extN_get_obdo(struct inode *inode, struct obdo *obdo)
+static int mds_extN_get_md(struct inode *inode, struct lov_stripe_md *md)
 {
-        struct mds_objid *data;
         int rc;
+        int size = md->lmd_size;
 
         lock_kernel();
         down(&inode->i_sem);
         rc = extN_xattr_get(inode, EXTN_XATTR_INDEX_LUSTRE,
-                            XATTR_LUSTRE_MDS_OBJID, obdo->o_inline,
-                            OBD_INLINESZ);
-        data = (struct mds_objid *)obdo->o_inline;
+                            XATTR_LUSTRE_MDS_OBJID, md, size);
 
         up(&inode->i_sem);
         unlock_kernel();
@@ -144,21 +140,17 @@ static int mds_extN_get_obdo(struct inode *inode, struct obdo *obdo)
         if (rc < 0) {
                 CDEBUG(D_INFO, "error getting EA %s from MDS inode %ld: "
                        "rc = %d\n", XATTR_LUSTRE_MDS_OBJID, inode->i_ino, rc);
-                obdo->o_id = 0;
-        } else if (data->mo_magic != cpu_to_le64(XATTR_MDS_MO_MAGIC)) {
-                CERROR("MDS object id %Ld has bad magic %Lx\n",
-                       (unsigned long long)obdo->o_id,
-                       (unsigned long long)le64_to_cpu(data->mo_magic));
+                memset(md, 0, size); 
+        } else if (md->lmd_magic != cpu_to_le32(XATTR_MDS_MO_MAGIC)) {
+                CERROR("MDS striping md for ino %ld has bad magic\n",
+                       inode->i_ino);
                 rc = -EINVAL;
         } else {
                 /* This field is byteswapped because it appears in the
                  * catalogue.  All others are opaque to the MDS */
-                obdo->o_id = le64_to_cpu(data->mo_lov_md.lmd_object_id);
-                obdo->o_mode = S_IFREG;
-                obdo->o_valid |= OBD_MD_FLID | OBD_MD_FLINLINE | OBD_MD_FLMODE;
+                md->lmd_object_id = le64_to_cpu(md->lmd_object_id);
         }
 
-#warning FIXME: pass this buffer to caller for transmission when size exceeds OBD_INLINESZ
         return rc;
 }
 
@@ -199,7 +191,7 @@ static void mds_extN_delete_inode(struct inode *inode)
                         EXIT;
                         return;
                 }
-                if (mds_extN_set_obdo(inode, handle, NULL))
+                if (mds_extN_set_md(inode, handle, NULL))
                         CERROR("error clearing obdo on %ld\n", inode->i_ino);
 
                 if (mds_extN_fs_ops.cl_delete_inode)
@@ -300,8 +292,8 @@ static struct mds_fs_operations mds_extN_fs_ops = {
         fs_start:               mds_extN_start,
         fs_commit:              mds_extN_commit,
         fs_setattr:             mds_extN_setattr,
-        fs_set_obdo:            mds_extN_set_obdo,
-        fs_get_obdo:            mds_extN_get_obdo,
+        fs_set_md:            mds_extN_set_md,
+        fs_get_md:            mds_extN_get_md,
         fs_readpage:            mds_extN_readpage,
         fs_delete_inode:        mds_extN_delete_inode,
         cl_delete_inode:        clear_inode,
index 5cc9ac5..d6761cb 100644 (file)
@@ -111,10 +111,8 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
                 struct lustre_handle dir_lockh;
                 char *name;
                 int namelen;
-                /* a name was supplied by the client; fid1 is the directory */
 
-                name = lustre_msg_buf(req->rq_reqmsg, offset + 1);
-                namelen = req->rq_reqmsg->buflens[offset + 1] - 1;
+                /* a name was supplied by the client; fid1 is the directory */
                 dir = mds_fid2locked_dentry(mds, rec->ur_fid1, NULL, LCK_PR,
                                             &dir_lockh);
                 if (!dir || IS_ERR(dir)) {
@@ -123,8 +121,10 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
                         GOTO(out_setattr, rc = -ESTALE);
                 }
 
+                name = lustre_msg_buf(req->rq_reqmsg, offset + 1);
+                namelen = req->rq_reqmsg->buflens[offset + 1] - 1;
                 de = mds_name2locked_dentry(mds, dir, NULL, name, namelen,
-                                            0, &child_lockh);
+                                            0, &child_lockh, LCK_PR);
                 l_dput(dir);
                 if (!de || IS_ERR(de)) {
                         LBUG();
@@ -277,8 +277,8 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
 
         if (dchild->d_inode) {
                 struct mds_body *body;
-                struct obdo *obdo;
                 struct inode *inode = dchild->d_inode;
+                struct lov_stripe_md *md;
                 CDEBUG(D_INODE, "child exists (dir %ld, name %s, ino %ld)\n",
                        dir->i_ino, rec->ur_name, dchild->d_inode->i_ino);
 
@@ -288,8 +288,9 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
 #warning FIXME: This ext3/N-specific code does not belong here
                 /* If i_file_acl is set, this inode has an EA */
                 if (S_ISREG(inode->i_mode) && inode->u.ext3_i.i_file_acl) {
-                        obdo = lustre_msg_buf(req->rq_repmsg, offset + 1);
-                        mds_fs_get_obdo(mds, inode, obdo);
+                        md = lustre_msg_buf(req->rq_repmsg, offset + 1);
+                        md->lmd_size = mds->mds_max_mdsize;
+                        mds_fs_get_md(mds, inode, md);
                 }
                 /* now a normal case for intent locking */
                 GOTO(out_create_dchild, rc = -EEXIST);
@@ -357,9 +358,9 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
 
                 CDEBUG(D_INODE, "created ino %ld\n", dchild->d_inode->i_ino);
                 if (!offset && type == S_IFREG) {
-                        struct obdo *obdo;
-                        obdo = lustre_msg_buf(req->rq_reqmsg, 2);
-                        rc = mds_fs_set_obdo(mds, inode, handle, obdo);
+                        struct lov_stripe_md *md;
+                        md = lustre_msg_buf(req->rq_reqmsg, 2);
+                        rc = mds_fs_set_md(mds, inode, handle, md);
                         if (rc) {
                                 CERROR("error %d setting obdo for %ld\n",
                                        rc, inode->i_ino);
@@ -434,74 +435,50 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
         struct dentry *de = NULL;
         struct dentry *dchild = NULL;
         struct mds_obd *mds = mds_req2mds(req);
-        struct obdo *obdo;
+        char *name;
+        int namelen;
         struct inode *dir, *inode;
-        int lock_mode, flags;
-        __u64 res_id[3] = {0};
-        struct lustre_handle lockh;
+        int lock_mode;
+        struct lustre_handle lockh, child_lockh;
         void *handle;
         int rc = 0;
         int err;
         ENTRY;
 
-        de = mds_fid2dentry(mds, rec->ur_fid1, NULL);
-        if (IS_ERR(de) || OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_UNLINK)) {
+        /* a name was supplied by the client; fid1 is the directory */
+        lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_CW : LCK_PW;
+        de = mds_fid2locked_dentry(mds, rec->ur_fid1, NULL, lock_mode,
+                                    &lockh);
+        if (!de || IS_ERR(de)) {
                 LBUG();
-                GOTO(out_unlink, rc = -ESTALE);
+                RETURN(-ESTALE);
         }
+        
+        name = lustre_msg_buf(req->rq_reqmsg, offset + 1);
+        namelen = req->rq_reqmsg->buflens[offset + 1] - 1;
+        dchild = mds_name2locked_dentry(mds, de, NULL, name, namelen,
+                                    LCK_EX, &child_lockh, lock_mode);
 
-        dir = de->d_inode;
-        CDEBUG(D_INODE, "parent ino %ld\n", dir->i_ino);
-        lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_CW : LCK_PW;
-        res_id[0] = dir->i_ino;
-
-        rc = ldlm_lock_match(mds->mds_local_namespace, res_id, LDLM_PLAIN,
-                                   NULL, 0, lock_mode, &lockh);
-        if (rc == 0) {
-                LDLM_DEBUG_NOLOCK("enqueue res %Lu", res_id[0]);
-                rc = ldlm_cli_enqueue(mds->mds_ldlm_client, mds->mds_ldlm_conn,
-                                      (struct lustre_handle *)&mds->mds_connh,
-                                      NULL, mds->mds_local_namespace, NULL,
-                                      res_id, LDLM_PLAIN, NULL, 0, lock_mode,
-                                      &flags, (void *)mds_lock_callback, NULL,
-                                      0, &lockh);
-                if (rc != ELDLM_OK) {
-                        CERROR("lock enqueue: err: %d\n", rc);
-                        GOTO(out_unlink_de, rc = -EIO);
-                }
-        } else
-                ldlm_lock_dump((void *)(unsigned long)lockh.addr);
-
-        down(&dir->i_sem);
-        dchild = lookup_one_len(rec->ur_name, de, rec->ur_namelen - 1);
-        if (IS_ERR(dchild)) {
-                CERROR("child lookup error %ld\n", PTR_ERR(dchild));
+        if (!dchild || IS_ERR(dchild) 
+            || OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_UNLINK)) {
                 LBUG();
-                GOTO(out_unlink_de, rc = -ESTALE);
+                GOTO(out_unlink, rc = -ESTALE);
         }
 
+        dir = de->d_inode;
         inode = dchild->d_inode;
+        CDEBUG(D_INODE, "parent ino %ld\n", dir->i_ino);
+
         if (!inode) {
-                CERROR("child doesn't exist (dir %ld, name %s\n",
+                CDEBUG(D_INODE, "child doesn't exist (dir %ld, name %s\n",
                        dir->i_ino, rec->ur_name);
                 GOTO(out_unlink_dchild, rc = -ENOENT);
+        } else if (offset) {
+                struct mds_body *body = lustre_msg_buf(req->rq_repmsg, 1); 
+                mds_pack_inode2fid(&body->fid1, inode);
+                mds_pack_inode2body(body, inode);
         }
 
-#if 0 /* in intent case the client doesn't have the inode */
-        if (inode->i_ino != rec->ur_fid2->id) {
-                CERROR("inode and FID ID do not match (%ld != %Ld)\n",
-                       inode->i_ino, rec->ur_fid2->id);
-                LBUG();
-                GOTO(out_unlink_dchild, rc = -ESTALE);
-        }
-        if (inode->i_generation != rec->ur_fid2->generation) {
-                CERROR("inode and FID GENERATION do not match (%d != %d)\n",
-                       inode->i_generation, rec->ur_fid2->generation);
-                LBUG();
-                GOTO(out_unlink_dchild, rc = -ESTALE);
-        }
-#endif
-
         OBD_FAIL_WRITE(OBD_FAIL_MDS_REINT_UNLINK_WRITE, dir->i_sb->s_dev);
 
         switch (inode->i_mode & S_IFMT) {
@@ -511,15 +488,18 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
                         GOTO(out_unlink_dchild, rc = PTR_ERR(handle));
                 rc = vfs_rmdir(dir, dchild);
                 break;
-        default:
-                if (offset) {
-                        obdo = lustre_msg_buf(req->rq_repmsg, 1); 
-                        rc = mds_fs_get_obdo(mds, inode, obdo);
-                        if (rc < 0)
-                                CDEBUG(D_INFO, "No obdo for ino %ld err %d\n",
+        case S_IFREG:
+                if (inode->u.ext3_i.i_file_acl && offset) {
+                        struct lov_stripe_md *md;
+                        md = lustre_msg_buf(req->rq_repmsg, 2); 
+                        rc = mds_fs_get_md(mds, inode, md);
+                        if (rc < 0) { 
+                                CDEBUG(D_INFO, "No md for ino %ld err %d\n",
                                        inode->i_ino, rc);
+                                memset(md, 0, md->lmd_size); 
+                        }
                 }
-
+        default:
                 handle = mds_fs_start(mds, dir, MDS_FSOP_UNLINK);
                 if (!handle)
                         GOTO(out_unlink_dchild, rc = PTR_ERR(handle));
@@ -537,42 +517,17 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
         }
 
         EXIT;
+
 out_unlink_dchild:
-        if (!rc)
-                res_id[0] = inode->i_ino;
         l_dput(dchild);
-out_unlink_de:
+        ldlm_lock_decref(&child_lockh, LCK_EX);
+        rc = ldlm_cli_cancel(&child_lockh);
+        if (rc < 0)
+                CERROR("failed to cancel child inode lock ino\n"); 
+out_unlink:
         up(&dir->i_sem);
         ldlm_lock_decref(&lockh, lock_mode);
-        if (!rc) { 
-                /* Take an exclusive lock on the resource that we're
-                 * about to free, to force everyone to drop their
-                 * locks. */
-                LDLM_DEBUG_NOLOCK("getting EX lock res %Lu", res_id[0]);
-                rc = ldlm_cli_enqueue(mds->mds_ldlm_client, mds->mds_ldlm_conn,
-                                      (struct lustre_handle *)&mds->mds_connh,
-                                      NULL, mds->mds_local_namespace, NULL, 
-                                      res_id,
-                                      LDLM_PLAIN, NULL, 0, LCK_EX, &flags,
-                                      (void *)mds_lock_callback, NULL, 0, 
-                                      &lockh);
-                if (rc) 
-                        CERROR("failed to get child inode lock (child ino %Ld, "
-                               "dir ino %ld)\n",
-                               res_id[0], de->d_inode->i_ino);
-        }
-
         l_dput(de);
-
-        if (!rc) { 
-                ldlm_lock_decref(&lockh, LCK_EX);
-                rc = ldlm_cli_cancel(&lockh);
-                if (rc < 0)
-                        CERROR("failed to cancel child inode lock ino "
-                               "%Ld: %d\n", res_id[0], rc);
-        }
-
-out_unlink:
         req->rq_status = rc;
         return 0;
 }
index 4f145b0..1039267 100644 (file)
@@ -274,7 +274,6 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                        MKSTR(data->ioc_inlbuf2), MKSTR(data->ioc_inlbuf3));
 
                 /* find the type */
-
                 type = class_nm_to_type(data->ioc_inlbuf1);
                 if (!type) {
                         CERROR("OBD: unknown type dev %d\n", obd->obd_minor);
@@ -426,10 +425,11 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
         }
 
         case OBD_IOC_CREATE: {
+                struct lov_stripe_md *ea;
                 obd_data2conn(&conn, data);
 
 
-                err = obd_create(&conn, &data->ioc_obdo1);
+                err = obd_create(&conn, &data->ioc_obdo1, &ea);
                 if (err)
                         GOTO(out, err);
 
@@ -459,9 +459,10 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
         }
 
         case OBD_IOC_DESTROY: {
+                void *ea;
                 obd_data2conn(&conn, data);
 
-                err = obd_destroy(&conn, &data->ioc_obdo1);
+                err = obd_destroy(&conn, &data->ioc_obdo1, ea);
                 if (err)
                         GOTO(out, err);
 
@@ -476,28 +477,25 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                  *        We don't really support multiple-obdo I/Os here,
                  *        for example offset and count are not per-obdo.
                  */
-                struct obdo     *obdos[2] = { NULL, NULL };
-                obd_count       oa_bufs[2] = { 0, 0 };
+                struct lov_stripe_md *md;
+                obd_count       oa_bufs = 0;
                 struct page     **bufs = NULL;
                 obd_size        *counts = NULL;
                 obd_off         *offsets = NULL;
                 obd_flag        *flags = NULL;
-                int             num = 1;
                 int             pages;
-                int             i, j;
+                int             j;
+                unsigned long off;
+                void *from;
+                        
 
                 obd_data2conn(&conn, data);
 
-                pages = oa_bufs[0] = data->ioc_plen1 / PAGE_SIZE;
-                if (data->ioc_obdo2.o_id) {
-                        num = 2;
-                        oa_bufs[1] = data->ioc_plen2 / PAGE_SIZE;
-                        pages += oa_bufs[1];
-                }
+                pages = oa_bufs = data->ioc_plen1 / PAGE_SIZE;
 
-                CDEBUG(D_INODE, "BRW %s with %dx%d pages\n",
+                CDEBUG(D_INODE, "BRW %s with %d pages\n",
                        rw == OBD_BRW_READ ? "read" : "write",
-                       num, oa_bufs[0]);
+                       oa_bufs);
                 OBD_ALLOC(bufs, pages * sizeof(*bufs));
                 OBD_ALLOC(counts, pages * sizeof(*counts));
                 OBD_ALLOC(offsets, pages * sizeof(*offsets));
@@ -508,46 +506,40 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                         GOTO(brw_free, err);
                 }
 
-                obdos[0] = &data->ioc_obdo1;
-                if (num > 1)
-                        obdos[1] = &data->ioc_obdo2;
-
-                for (i = 0, pages = 0; i < num; i++) {
-                        unsigned long off;
-                        void *from;
-
-                        from = (&data->ioc_pbuf1)[i];
-                        off = data->ioc_offset;
-
-                        for (j = 0; j < oa_bufs[i];
-                             j++, pages++, off += PAGE_SIZE, from += PAGE_SIZE){
-                                unsigned long to;
-
-                                to = __get_free_pages(GFP_KERNEL, 0);
-                                if (!to) {
+                md = &data->ioc_obdo1;
+
+                from = (&data->ioc_pbuf1)[0];
+                off = data->ioc_offset;
+                
+                for (j = 0; j < oa_bufs;
+                     j++, pages++, off += PAGE_SIZE, from += PAGE_SIZE){
+                        unsigned long to;
+                        
+                        to = __get_free_pages(GFP_KERNEL, 0);
+                        if (!to) {
                                 /*      ||
-                                    copy_from_user((void *)to,from,PAGE_SIZE))
+                                        copy_from_user((void
+                                        *)to,from,PAGE_SIZE))
                                         free_pages(to, 0);
-                                 */
-                                        CERROR("no memory for brw pages\n");
-                                        err = -ENOMEM;
-                                        GOTO(brw_cleanup, err);
-                                }
-                                bufs[pages] = virt_to_page(to);
-                                counts[pages] = PAGE_SIZE;
-                                offsets[pages] = off;
-                                flags[pages] = 0;
+                                */
+                                CERROR("no memory for brw pages\n");
+                                err = -ENOMEM;
+                                GOTO(brw_cleanup, err);
                         }
+                        bufs[pages] = virt_to_page(to);
+                        counts[pages] = PAGE_SIZE;
+                        offsets[pages] = off;
+                        flags[pages] = 0;
                 }
-
-                err = obd_brw(rw, &conn, num, obdos, oa_bufs, bufs,
+                
+                err = obd_brw(rw, &conn, md, oa_bufs, bufs,
                               counts, offsets, flags, NULL);
-
+                
                 EXIT;
         brw_cleanup:
-                i = pages;
-                while (i-- > 0)
-                        __free_pages(bufs[i], 0);
+                j = pages;
+                while (j-- > 0)
+                        __free_pages(bufs[j], 0);
         brw_free:
                 OBD_FREE(bufs, pages * sizeof(*bufs));
                 OBD_FREE(counts, pages * sizeof(*counts));
index b6403f3..966eb17 100644 (file)
@@ -91,13 +91,11 @@ int class_unregister_type(char *nm)
         ENTRY;
 
         if ( !type ) {
-                MOD_DEC_USE_COUNT;
                 CERROR("unknown obd type\n");
                 RETURN(-EINVAL);
         }
 
         if ( type->typ_refcnt ) {
-                MOD_DEC_USE_COUNT;
                 CERROR("type %s has refcount (%d)\n", nm, type->typ_refcnt);
                 RETURN(-EBUSY);
         }
index 1571b33..97f8038 100644 (file)
@@ -359,7 +359,6 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd)
         ENTRY;
         MOD_INC_USE_COUNT;
         rc = class_connect(conn, obd);
-
         if (rc)
                 MOD_DEC_USE_COUNT;
         RETURN(rc);
@@ -483,23 +482,10 @@ static inline void filter_from_inode(struct obdo *oa, struct inode *inode)
 
         if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
                 obd_rdev rdev = kdev_t_to_nr(inode->i_rdev);
-                CDEBUG(D_INODE, "copying device %x from inode to obdo\n",
-                       rdev);
-                *((obd_rdev *)oa->o_inline) = rdev;
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-        }
-
-#if 0
-        else if (filter_has_inline(inode)) {
-                CDEBUG(D_INFO, "copying inline from inode to obdo\n");
-                memcpy(oa->o_inline, inode->u.ext2_i.i_data,
-                       MIN(sizeof(inode->u.ext2_i.i_data),OBD_INLINESZ));
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
+                oa->o_rdev = rdev;
+                oa->o_valid |= OBD_MD_FLRDEV;
         }
 
-#endif
         EXIT;
 }
 
@@ -567,7 +553,8 @@ static int filter_setattr(struct lustre_handle *conn, struct obdo *oa)
         RETURN(rc);
 }
 
-static int filter_open(struct lustre_handle *conn, struct obdo *oa)
+static int filter_open(struct lustre_handle *conn, struct obdo *oa,
+                          struct lov_stripe_md *ea)
 {
         struct obd_device *obd;
         struct dentry *dentry;
@@ -587,7 +574,8 @@ static int filter_open(struct lustre_handle *conn, struct obdo *oa)
         return 0;
 } /* filter_open */
 
-static int filter_close(struct lustre_handle *conn, struct obdo *oa)
+static int filter_close(struct lustre_handle *conn, struct obdo *oa,
+                          struct lov_stripe_md *ea)
 {
         struct obd_device *obd;
         struct dentry *dentry;
@@ -613,7 +601,8 @@ static int filter_close(struct lustre_handle *conn, struct obdo *oa)
         return 0;
 } /* filter_close */
 
-static int filter_create(struct lustre_handle* conn, struct obdo *oa)
+static int filter_create(struct lustre_handle* conn, struct obdo *oa, 
+                         struct lov_stripe_md **ea)
 {
         char name[64];
         struct obd_run_ctxt saved;
@@ -654,7 +643,8 @@ static int filter_create(struct lustre_handle* conn, struct obdo *oa)
         return 0;
 }
 
-static int filter_destroy(struct lustre_handle *conn, struct obdo *oa)
+static int filter_destroy(struct lustre_handle *conn, struct obdo *oa, 
+                          struct lov_stripe_md *ea)
 {
         struct obd_device *obd;
         struct filter_obd *filter;
@@ -706,6 +696,7 @@ out:
 
 /* NB count and offset are used for punch, but not truncate */
 static int filter_truncate(struct lustre_handle *conn, struct obdo *oa,
+                           struct lov_stripe_md *md,
                            obd_size count, obd_off offset)
 {
         int error;
@@ -718,8 +709,8 @@ static int filter_truncate(struct lustre_handle *conn, struct obdo *oa,
         RETURN(error);
 }
 
-static int filter_pgcache_brw(int cmd, struct lustre_handle *conn, obd_count num_oa,
-                               struct obdo **oa, obd_count *oa_bufs,
+static int filter_pgcache_brw(int cmd, struct lustre_handle *conn, 
+                               struct lov_stripe_md *md, obd_count oa_bufs,
                                struct page **pages, obd_size *count,
                                obd_off *offset, obd_flag *flags, void *callback)
 {
@@ -731,6 +722,7 @@ static int filter_pgcache_brw(int cmd, struct lustre_handle *conn, obd_count num
         int                      error;
         struct file             *file;
         struct obd_device      *obd = class_conn2obd(conn);
+        int pg;
         ENTRY;
 
         if (!class_conn2export(conn)) {
@@ -741,53 +733,51 @@ static int filter_pgcache_brw(int cmd, struct lustre_handle *conn, obd_count num
         sb = obd->u.filter.fo_sb;
         push_ctxt(&saved, &obd->u.filter.fo_ctxt);
         pnum = 0; /* pnum indexes buf 0..num_pages */
-        for (onum = 0; onum < num_oa; onum++) {
-                int pg;
-
-                file = filter_obj_open(obd, oa[onum]->o_id, oa[onum]->o_mode);
-                if (IS_ERR(file))
-                        GOTO(out, retval = PTR_ERR(file));
-
-                /* count doubles as retval */
-                for (pg = 0; pg < oa_bufs[onum]; pg++) {
-                        CDEBUG(D_INODE, "OP %d obdo no/pno: (%d,%d) (%ld,%ld) "
-                               "off count (%Ld,%Ld)\n",
-                               cmd, onum, pnum, file->f_dentry->d_inode->i_ino,
-                               (unsigned long)offset[pnum] >> PAGE_CACHE_SHIFT,
-                               (unsigned long long)offset[pnum],
-                               (unsigned long long)count[pnum]);
-                        if (cmd & OBD_BRW_WRITE) {
-                                loff_t off;
-                                char *buffer;
-                                off = offset[pnum];
-                                buffer = kmap(pages[pnum]);
-                                retval = file->f_op->write(file, buffer, count[pnum], &off);
-                                kunmap(pages[pnum]);
-                                CDEBUG(D_INODE, "retval %ld\n", retval);
+
+        file = filter_obj_open(obd, md->lmd_object_id, S_IFREG);
+        if (IS_ERR(file))
+                GOTO(out, retval = PTR_ERR(file));
+        
+        /* count doubles as retval */
+        for (pg = 0; pg < oa_bufs; pg++) {
+                CDEBUG(D_INODE, "OP %d obdo no/pno: (%d,%d) (%ld,%ld) "
+                       "off count (%Ld,%Ld)\n",
+                       cmd, onum, pnum, file->f_dentry->d_inode->i_ino,
+                       (unsigned long)offset[pnum] >> PAGE_CACHE_SHIFT,
+                       (unsigned long long)offset[pnum],
+                       (unsigned long long)count[pnum]);
+                if (cmd & OBD_BRW_WRITE) {
+                        loff_t off;
+                        char *buffer;
+                        off = offset[pnum];
+                        buffer = kmap(pages[pnum]);
+                        retval = file->f_op->write(file, buffer, count[pnum], &off);
+                        kunmap(pages[pnum]);
+                        CDEBUG(D_INODE, "retval %ld\n", retval);
+                } else {
+                        loff_t off = offset[pnum];
+                        char *buffer = kmap(pages[pnum]);
+                        
+                        if (off >= file->f_dentry->d_inode->i_size) {
+                                memset(buffer, 0, count[pnum]);
+                                retval = count[pnum];
                         } else {
-                                loff_t off = offset[pnum];
-                                char *buffer = kmap(pages[pnum]);
-
-                                if (off >= file->f_dentry->d_inode->i_size) {
-                                        memset(buffer, 0, count[pnum]);
-                                        retval = count[pnum];
-                                } else {
-                                        retval = file->f_op->read(file, buffer, count[pnum], &off);
-                                }
-                                kunmap(pages[pnum]);
-
-                                if (retval != count[pnum]) {
-                                        filp_close(file, 0);
-                                        GOTO(out, retval = -EIO);
-                                }
-                                CDEBUG(D_INODE, "retval %ld\n", retval);
+                                retval = file->f_op->read(file, buffer, count[pnum], &off);
+                        }
+                        kunmap(pages[pnum]);
+                        
+                        if (retval != count[pnum]) {
+                                filp_close(file, 0);
+                                GOTO(out, retval = -EIO);
                         }
-                        pnum++;
+                        CDEBUG(D_INODE, "retval %ld\n", retval);
                 }
-                /* sizes and blocks are set by generic_file_write */
-                /* ctimes/mtimes will follow with a setattr call */
-                filp_close(file, 0);
+                pnum++;
         }
+        /* sizes and blocks are set by generic_file_write */
+        /* ctimes/mtimes will follow with a setattr call */
+        filp_close(file, 0);
+
 
         EXIT;
 out:
@@ -1338,9 +1328,15 @@ int filter_copy_data(struct lustre_handle *dst_conn, struct obdo *dst,
                   obd_size count, obd_off offset)
 {
         struct page *page;
+        struct lov_stripe_md srcmd, dstmd; 
         unsigned long index = 0;
         int err = 0;
 
+        memset(&srcmd, 0, sizeof(srcmd));
+        memset(&dstmd, 0, sizeof(dstmd));
+        srcmd.lmd_object_id = src->o_id;
+        dstmd.lmd_object_id = dst->o_id;
+
         ENTRY;
         CDEBUG(D_INFO, "src: ino %Ld blocks %Ld, size %Ld, dst: ino %Ld\n",
                (unsigned long long)src->o_id, (unsigned long long)src->o_blocks,
@@ -1357,15 +1353,13 @@ int filter_copy_data(struct lustre_handle *dst_conn, struct obdo *dst,
          *     and arrays to handle the request parameters.
          */
         while (index < ((src->o_size + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
-                obd_count        num_oa = 1;
-                obd_count        num_buf = 1;
                 obd_size         brw_count = PAGE_SIZE;
                 obd_off          brw_offset = (page->index) << PAGE_SHIFT;
                 obd_flag         flagr = 0;
                 obd_flag         flagw = OBD_BRW_CREATE;
 
                 page->index = index;
-                err = obd_brw(OBD_BRW_READ, src_conn, num_oa, &src, &num_buf,
+                err = obd_brw(OBD_BRW_READ, src_conn, &srcmd, 1,
                              &page, &brw_count, &brw_offset, &flagr, NULL);
 
                 if ( err ) {
@@ -1374,7 +1368,7 @@ int filter_copy_data(struct lustre_handle *dst_conn, struct obdo *dst,
                 }
                 CDEBUG(D_INFO, "Read page %ld ...\n", page->index);
 
-                err = obd_brw(OBD_BRW_WRITE, dst_conn, num_oa, &dst, &num_buf,
+                err = obd_brw(OBD_BRW_WRITE, dst_conn, &dstmd, 1,
                              &page, &brw_count, &brw_offset, &flagw, NULL);
 
                 /* XXX should handle dst->o_size, dst->o_blocks here */
index 1ab2986..ef8dfa5 100644 (file)
@@ -152,7 +152,7 @@ static struct inode *obdfs_new_inode(struct inode *dir, int mode)
         oa->o_mode = mode;
         oa->o_valid |= OBD_MD_FLMODE;
         CDEBUG(D_INODE, "\n");
-        err = obd_create(IID(dir), oa);
+        err = obd_create(IID(dir), oa, NULL);
         CDEBUG(D_INODE, "\n");
 
         if ( err ) {
@@ -168,7 +168,7 @@ static struct inode *obdfs_new_inode(struct inode *dir, int mode)
 
         if (!inode) {
                 CERROR("new_inode -fatal:  %ld\n", (long)oa->o_id);
-                obd_destroy(IID(dir), oa);
+                obd_destroy(IID(dir), oa, NULL);
                 obdo_free(oa);
                 EXIT;
                 return ERR_PTR(-EIO);
@@ -180,7 +180,7 @@ static struct inode *obdfs_new_inode(struct inode *dir, int mode)
                        (long)oa->o_id,
                        atomic_read(&inode->i_count), 
                        inode->i_nlink);
-                obd_destroy(IID(dir), oa);
+                obd_destroy(IID(dir), oa, NULL);
                 iput(inode);
                 EXIT;
                 return ERR_PTR(-EIO);
index 46243ba..670538b 100644 (file)
@@ -148,11 +148,11 @@ inline void set_page_clean(struct page *page)
 }
 
 /* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */
-static int obdfs_brw(int rw, struct inode *inode, struct page *page, int create)
+static int obdfs_brw(int rw, struct inode *inode2, 
+                     struct page *page, int create)
 {
-        obd_count        num_obdo = 1;
-        obd_count        bufs_per_obdo = 1;
-        struct obdo     *oa;
+        struct inode *inode = page->mapping->host;
+        struct ll_inode_info *lii = ll_i2info(inode);
         obd_size         count = PAGE_SIZE;
         obd_off          offset = ((obd_off)page->index) << PAGE_SHIFT;
         obd_flag         flags = create ? OBD_BRW_CREATE : 0;
@@ -160,16 +160,8 @@ static int obdfs_brw(int rw, struct inode *inode, struct page *page, int create)
 
         ENTRY;
 
-        oa = obdo_alloc();
-        if ( !oa ) {
-                EXIT;
-                return -ENOMEM;
-        }
-        oa->o_valid = (__u32)OBD_MD_FLNOTOBD;
-        obdfs_from_inode(oa, inode);
-
         err = obd_brw(rw == WRITE ? OBD_BRW_WRITE : OBD_BRW_READ, IID(inode),
-                     num_obdo, &oa, &bufs_per_obdo, &page, &count, &offset,
+                      md, 1, &page, &count, &offset,
                      &flags, NULL);
         //if ( !err )
         //      obdfs_to_inode(inode, oa); /* copy o_blocks to i_blocks */
@@ -194,18 +186,11 @@ static int obdfs_commit_page(struct page *page, int create, int from, int to)
         int              err;
 
         ENTRY;
-        oa = obdo_alloc();
-        if ( !oa ) {
-                EXIT;
-                return -ENOMEM;
-        }
-        oa->o_valid = (__u32)OBD_MD_FLNOTOBD;
-        obdfs_from_inode(oa, inode);
 
         CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n",
                from, to, (unsigned long long)count);
 
-        err = obd_brw(OBD_BRW_WRITE, IID(inode), num_obdo, &oa, &bufs_per_obdo,
+        err = obd_brw(OBD_BRW_WRITE, IID(inode), md, 1,
                      &page, &count, &offset, &flags, NULL);
         if ( !err ) {
                 SetPageUptodate(page);
index 70d40c2..a65f2cf 100644 (file)
@@ -157,7 +157,8 @@ static int osc_getattr(struct lustre_handle *conn, struct obdo *oa)
         return rc;
 }
 
-static int osc_open(struct lustre_handle *conn, struct obdo *oa)
+static int osc_open(struct lustre_handle *conn, struct obdo *oa,
+                    struct lov_stripe_md *md)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
@@ -195,7 +196,8 @@ static int osc_open(struct lustre_handle *conn, struct obdo *oa)
         return rc;
 }
 
-static int osc_close(struct lustre_handle *conn, struct obdo *oa)
+static int osc_close(struct lustre_handle *conn, struct obdo *oa,
+                     struct lov_stripe_md *md)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
@@ -211,6 +213,9 @@ static int osc_close(struct lustre_handle *conn, struct obdo *oa)
         if (!request)
                 RETURN(-ENOMEM);
 
+        oa->o_id = md->lmd_object_id;
+        oa->o_mode = S_IFREG;
+        oa->o_valid = (OBD_MD_FLMODE | OBD_MD_FLID);
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         memcpy(&body->oa, oa, sizeof(*oa));
 
@@ -262,15 +267,14 @@ static int osc_setattr(struct lustre_handle *conn, struct obdo *oa)
         return rc;
 }
 
-static int osc_create(struct lustre_handle *conn, struct obdo *oa)
+static int osc_create(struct lustre_handle *conn, struct obdo *oa, 
+                      struct lov_stripe_md **ea)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
         struct ptlrpc_connection *connection;
         struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ost_body *body;
-        struct mds_objid *objid;
-        struct lov_object_id *lov_id;
         int rc, size = sizeof(*body);
         ENTRY;
 
@@ -278,6 +282,18 @@ static int osc_create(struct lustre_handle *conn, struct obdo *oa)
                 CERROR("oa NULL\n");
                 RETURN(-EINVAL);
         }
+
+        if (!ea) { 
+                LBUG();
+        }
+
+        if (!*ea) { 
+                OBD_ALLOC(*ea, oa->o_easize);
+                if (!*ea) 
+                        RETURN(-ENOMEM); 
+                (*ea)->lmd_size = oa->o_easize;
+        }
+
         osc_con2cl(conn, &cl, &connection);
         request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh, 
                                   OST_CREATE, 1, &size, NULL);
@@ -297,21 +313,16 @@ static int osc_create(struct lustre_handle *conn, struct obdo *oa)
         body = lustre_msg_buf(request->rq_repmsg, 0);
         memcpy(oa, &body->oa, sizeof(*oa));
 
-        memset(oa->o_inline, 0, sizeof(oa->o_inline));
-        objid = (struct mds_objid *)oa->o_inline;
-        objid->mo_lov_md.lmd_object_id = oa->o_id;
-        objid->mo_lov_md.lmd_stripe_count = 1;
-        lov_id = (struct lov_object_id *)(oa->o_inline + sizeof(*objid));
-        lov_id->l_device_id = 0;
-        lov_id->l_object_id = oa->o_id;
-
+        (*ea)->lmd_object_id = oa->o_id;
+        (*ea)->lmd_stripe_count = 1;
         EXIT;
  out:
         ptlrpc_free_req(request);
         return rc;
 }
 
-static int osc_punch(struct lustre_handle *conn, struct obdo *oa, obd_size count,
+static int osc_punch(struct lustre_handle *conn, struct obdo *oa, 
+                     struct lov_stripe_md *md, obd_size count,
                      obd_off offset)
 {
         struct ptlrpc_request *request;
@@ -353,7 +364,8 @@ static int osc_punch(struct lustre_handle *conn, struct obdo *oa, obd_size count
         return rc;
 }
 
-static int osc_destroy(struct lustre_handle *conn, struct obdo *oa)
+static int osc_destroy(struct lustre_handle *conn, struct obdo *oa, 
+                       struct lov_stripe_md *ea)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
@@ -423,8 +435,9 @@ static void brw_finish(struct ptlrpc_bulk_desc *desc, void *data)
         EXIT;
 }
 
-static int osc_brw_read(struct lustre_handle *conn, obd_count num_oa,
-                        struct obdo **oa, obd_count *oa_bufs, struct page **buf,
+static int osc_brw_read(struct lustre_handle *conn, 
+                        struct lov_stripe_md *md, obd_count page_count, 
+                        struct page **page_array,
                         obd_size *count, obd_off *offset, obd_flag *flags,
                         bulk_callback_t callback)
 {
@@ -434,18 +447,14 @@ static int osc_brw_read(struct lustre_handle *conn, obd_count num_oa,
         struct ptlrpc_bulk_desc *desc = NULL;
         struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ost_body *body;
-        struct osc_brw_cb_data *cb_data = NULL;
-        long pages;
-        int rc, i, j, size[3] = {sizeof(*body)};
+        int rc, j, size[3] = {sizeof(*body)};
         void *iooptr, *nioptr;
+        struct osc_brw_cb_data *cb_data = NULL;
+
         ENTRY;
 
-        /* XXX almost identical to brw_write case */
-        size[1] = num_oa * sizeof(struct obd_ioobj);
-        pages = 0;
-        for (i = 0; i < num_oa; i++)
-                pages += oa_bufs[i];
-        size[2] = pages * sizeof(struct niobuf_remote);
+        size[1] = sizeof(struct obd_ioobj);
+        size[2] = page_count * sizeof(struct niobuf_remote);
 
         osc_con2cl(conn, &cl, &connection);
         request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh, 
@@ -471,25 +480,22 @@ static int osc_brw_read(struct lustre_handle *conn, obd_count num_oa,
 
         iooptr = lustre_msg_buf(request->rq_reqmsg, 1);
         nioptr = lustre_msg_buf(request->rq_reqmsg, 2);
-        for (pages = 0, i = 0; i < num_oa; i++) {
-                ost_pack_ioo(&iooptr, oa[i], oa_bufs[i]);
-                /* FIXME: this inner loop is wrong for multiple OAs */
-                for (j = 0; j < oa_bufs[i]; j++, pages++) {
-                        struct ptlrpc_bulk_page *bulk;
-                        bulk = ptlrpc_prep_bulk_page(desc);
-                        if (bulk == NULL)
-                                GOTO(out_unmap, rc = -ENOMEM);
-
-                        spin_lock(&connection->c_lock);
-                        bulk->b_xid = ++connection->c_xid_out;
-                        spin_unlock(&connection->c_lock);
-
-                        bulk->b_buf = kmap(buf[pages]);
-                        bulk->b_page = buf[pages];
-                        bulk->b_buflen = PAGE_SIZE;
-                        ost_pack_niobuf(&nioptr, offset[pages], count[pages],
-                                        flags[pages], bulk->b_xid);
-                }
+        ost_pack_ioo(&iooptr, md, page_count); 
+        for (j = 0; j < page_count; j++) { 
+                struct ptlrpc_bulk_page *bulk;
+                bulk = ptlrpc_prep_bulk_page(desc);
+                if (bulk == NULL)
+                        GOTO(out_unmap, rc = -ENOMEM);
+                
+                spin_lock(&connection->c_lock);
+                bulk->b_xid = ++connection->c_xid_out;
+                spin_unlock(&connection->c_lock);
+                
+                bulk->b_buf = kmap(page_array[j]);
+                bulk->b_page = page_array[j];
+                bulk->b_buflen = PAGE_SIZE;
+                ost_pack_niobuf(&nioptr, offset[j], count[j],
+                                flags[j], bulk->b_xid);
         }
 
         /* 
@@ -520,13 +526,13 @@ static int osc_brw_read(struct lustre_handle *conn, obd_count num_oa,
         ptlrpc_bulk_decref(desc);
         if (desc->b_flags & PTL_RPC_FL_INTR)
                 RETURN(-EINTR);
+
         RETURN(0);
         
         /* Clean up on error. */
  out_unmap:
-        for (pages = 0, i = 0; i < num_oa; i++)
-                for (j = 0; j < oa_bufs[i]; j++, pages++)
-                        kunmap(pagearray[pages]);
+        for (j = 0; j < desc->b_page_count; j++)
+                        kunmap(pagearray[j]);
  out_free:
         if (cb_data)
                 OBD_FREE(cb_data, sizeof(*cb_data));
@@ -535,8 +541,8 @@ static int osc_brw_read(struct lustre_handle *conn, obd_count num_oa,
         return rc;
 }
 
-static int osc_brw_write(struct lustre_handle *conn, obd_count num_oa,
-                         struct obdo **oa, obd_count *oa_bufs,
+static int osc_brw_write(struct lustre_handle *conn,
+                         struct lov_stripe_md *md, obd_count page_count,
                          struct page **pagearray, obd_size *count,
                          obd_off *offset, obd_flag *flags,
                          bulk_callback_t callback)
@@ -550,17 +556,12 @@ static int osc_brw_write(struct lustre_handle *conn, obd_count num_oa,
         struct niobuf_local *local = NULL;
         struct niobuf_remote *remote;
         struct osc_brw_cb_data *cb_data = NULL;
-        long pages;
-        int rc, i, j, size[3] = {sizeof(*body)};
+        int rc, j, size[3] = {sizeof(*body)};
         void *iooptr, *nioptr;
         ENTRY;
 
-        /* XXX almost identical to brw_read case */
-        size[1] = num_oa * sizeof(struct obd_ioobj);
-        pages = 0;
-        for (i = 0; i < num_oa; i++)
-                pages += oa_bufs[i];
-        size[2] = pages * sizeof(struct niobuf_remote);
+        size[1] = sizeof(struct obd_ioobj);
+        size[2] = page_count * sizeof(*remote);
 
         osc_con2cl(conn, &cl, &connection);
         request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh, 
@@ -571,7 +572,7 @@ static int osc_brw_write(struct lustre_handle *conn, obd_count num_oa,
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         body->data = OBD_BRW_WRITE;
 
-        OBD_ALLOC(local, pages * sizeof(*local));
+        OBD_ALLOC(local, page_count * sizeof(*local));
         if (!local)
                 GOTO(out_free, rc = -ENOMEM);
 
@@ -588,22 +589,20 @@ static int osc_brw_write(struct lustre_handle *conn, obd_count num_oa,
         desc->b_cb_data = cb_data;
         /* XXX end almost identical to brw_read case */
         cb_data->obd_data = local;
-        cb_data->obd_size = pages * sizeof(*local);
+        cb_data->obd_size = page_count * sizeof(*local);
 
         iooptr = lustre_msg_buf(request->rq_reqmsg, 1);
         nioptr = lustre_msg_buf(request->rq_reqmsg, 2);
-        for (pages = 0, i = 0; i < num_oa; i++) {
-                ost_pack_ioo(&iooptr, oa[i], oa_bufs[i]);
-                for (j = 0; j < oa_bufs[i]; j++, pages++) {
-                        local[pages].addr = kmap(pagearray[pages]);
-                        local[pages].offset = offset[pages];
-                        local[pages].len = count[pages];
-                        ost_pack_niobuf(&nioptr, offset[pages], count[pages],
-                                        flags[pages], 0);
-                }
+        ost_pack_ioo(&iooptr, md, page_count);
+        for (j = 0; j < page_count; j++) {
+                local[j].addr = kmap(pagearray[j]);
+                local[j].offset = offset[j];
+                local[j].len = count[j];
+                ost_pack_niobuf(&nioptr, offset[j], count[j],
+                                flags[j], 0);
         }
 
-        size[1] = pages * sizeof(struct niobuf_remote);
+        size[1] = page_count * sizeof(struct niobuf_remote);
         request->rq_replen = lustre_msg_size(2, size);
         rc = ptlrpc_queue_wait(request);
         rc = ptlrpc_check_status(request, rc);
@@ -615,30 +614,29 @@ static int osc_brw_write(struct lustre_handle *conn, obd_count num_oa,
                 GOTO(out_unmap, rc = -EINVAL);
 
         if (request->rq_repmsg->buflens[1] !=
-            pages * sizeof(struct niobuf_remote)) {
-                CERROR("buffer length wrong (%d vs. %ld)\n",
+            page_count * sizeof(struct niobuf_remote)) {
+                CERROR("buffer length wrong (%d vs. %d)\n",
                        request->rq_repmsg->buflens[1],
-                       pages * sizeof(struct niobuf_remote));
+                       page_count * sizeof(struct niobuf_remote));
                 GOTO(out_unmap, rc = -EINVAL);
         }
 
-        for (pages = 0, i = 0; i < num_oa; i++) {
-                for (j = 0; j < oa_bufs[i]; j++, pages++) {
-                        struct ptlrpc_bulk_page *page;
-
-                        ost_unpack_niobuf(&nioptr, &remote);
-
-                        page = ptlrpc_prep_bulk_page(desc);
-                        if (!page)
-                                GOTO(out_unmap, rc = -ENOMEM);
 
-                        page->b_buf = (void *)(unsigned long)local[pages].addr;
-                        page->b_buflen = local[pages].len;
-                        page->b_xid = remote->xid;
-                }
+        for (j = 0; j < page_count; j++) {
+                struct ptlrpc_bulk_page *page;
+                
+                ost_unpack_niobuf(&nioptr, &remote);
+                
+                page = ptlrpc_prep_bulk_page(desc);
+                if (!page)
+                        GOTO(out_unmap, rc = -ENOMEM);
+                
+                page->b_buf = (void *)(unsigned long)local[j].addr;
+                page->b_buflen = local[j].len;
+                page->b_xid = remote->xid;
         }
-
-        if (desc->b_page_count != pages)
+        
+        if (desc->b_page_count != page_count)
                 LBUG();
 
         /*
@@ -666,33 +664,32 @@ static int osc_brw_write(struct lustre_handle *conn, obd_count num_oa,
 
         /* Clean up on error. */
  out_unmap:
-        for (pages = 0, i = 0; i < num_oa; i++)
-                for (j = 0; j < oa_bufs[i]; j++, pages++)
-                        kunmap(pagearray[pages]);
+        for (j = 0; j < page_count; j++)
+                kunmap(pagearray[j]);
 
  out_free:
         if (cb_data)
                 OBD_FREE(cb_data, sizeof(*cb_data));
         if (local)
-                OBD_FREE(local, pages * sizeof(*local));
+                OBD_FREE(local, page_count * sizeof(*local));
         ptlrpc_free_bulk(desc);
         ptlrpc_req_finished(request);
         return rc;
 }
 
-static int osc_brw(int cmd, struct lustre_handle *conn, obd_count num_oa,
-                   struct obdo **oa, obd_count *oa_bufs, struct page **buf,
-                   obd_size *count, obd_off *offset, obd_flag *flags,
+static int osc_brw(int cmd, struct lustre_handle *conn, 
+                   struct lov_stripe_md *md, obd_count page_count, 
+                   struct page **page_array,
+                   obd_size *count, 
+                   obd_off *offset, 
+                   obd_flag *flags,
                    void *callback)
 {
-        if (num_oa != 1)
-                LBUG();
-
         if (cmd & OBD_BRW_WRITE)
-                return osc_brw_write(conn, num_oa, oa, oa_bufs, buf, count,
+                return osc_brw_write(conn, md, page_count, page_array, count,
                                      offset, flags, (bulk_callback_t)callback);
         else
-                return osc_brw_read(conn, num_oa, oa, oa_bufs, buf, count,
+                return osc_brw_read(conn, md, page_count, page_array, count,
                                     offset, flags, (bulk_callback_t)callback);
 }
 
index d7f89f8..a9221b4 100644 (file)
@@ -51,7 +51,7 @@ static int ost_destroy(struct ptlrpc_request *req)
         if (rc)
                 RETURN(rc);
 
-        req->rq_status = obd_destroy(conn, &body->oa);
+        req->rq_status = obd_destroy(conn, &body->oa, NULL);
         RETURN(0);
 }
 
@@ -114,7 +114,7 @@ static int ost_open(struct ptlrpc_request *req)
 
         repbody = lustre_msg_buf(req->rq_repmsg, 0);
         memcpy(&repbody->oa, &body->oa, sizeof(body->oa));
-        req->rq_status = obd_open(conn, &repbody->oa);
+        req->rq_status = obd_open(conn, &repbody->oa, NULL);
         RETURN(0);
 }
 
@@ -133,7 +133,7 @@ static int ost_close(struct ptlrpc_request *req)
 
         repbody = lustre_msg_buf(req->rq_repmsg, 0);
         memcpy(&repbody->oa, &body->oa, sizeof(body->oa));
-        req->rq_status = obd_close(conn, &repbody->oa);
+        req->rq_status = obd_close(conn, &repbody->oa, NULL);
         RETURN(0);
 }
 
@@ -152,7 +152,7 @@ static int ost_create(struct ptlrpc_request *req)
 
         repbody = lustre_msg_buf(req->rq_repmsg, 0);
         memcpy(&repbody->oa, &body->oa, sizeof(body->oa));
-        req->rq_status = obd_create(conn, &repbody->oa);
+        req->rq_status = obd_create(conn, &repbody->oa, NULL);
         RETURN(0);
 }
 
@@ -171,7 +171,7 @@ static int ost_punch(struct ptlrpc_request *req)
 
         repbody = lustre_msg_buf(req->rq_repmsg, 0);
         memcpy(&repbody->oa, &body->oa, sizeof(body->oa));
-        req->rq_status = obd_punch(conn, &repbody->oa,
+        req->rq_status = obd_punch(conn, &repbody->oa, NULL, 
                                    repbody->oa.o_blocks, repbody->oa.o_size);
         RETURN(0);
 }
index 7cdc114..4064840 100644 (file)
@@ -1,5 +1,5 @@
 --- lum-pristine/arch/ia64/mm/init.c   Fri Nov  9 15:26:17 2001
-+++ lum/arch/ia64/mm/init.c    Thu Jun 20 14:46:05 2002
++++ lum/arch/ia64/mm/init.c    Thu Jul  4 10:04:25 2002
 @@ -37,6 +37,12 @@
  
  static unsigned long totalram_pages;
@@ -13,9 +13,9 @@
  int
  do_check_pgt_cache (int low, int high)
  {
---- lum-pristine/arch/um/kernel/mem.c  Thu Jun 13 14:07:26 2002
-+++ lum/arch/um/kernel/mem.c   Fri Jun 14 17:00:21 2002
-@@ -489,6 +489,22 @@
+--- lum-pristine/arch/um/kernel/mem.c  Sat Jul 13 13:20:13 2002
++++ lum/arch/um/kernel/mem.c   Thu Jul  4 10:04:25 2002
+@@ -527,6 +527,22 @@
        return(phys_mem_map(pte_val(pte)));
  }
  
@@ -38,7 +38,7 @@
  struct mem_region *page_region(struct page *page, int *index_out)
  {
        int i;
-@@ -504,12 +520,14 @@
+@@ -542,12 +558,14 @@
                        return(region);
                }
        }
@@ -55,7 +55,7 @@
  }
  
 --- lum-pristine/arch/i386/mm/init.c   Fri Dec 21 10:41:53 2001
-+++ lum/arch/i386/mm/init.c    Sat Jun 15 00:31:15 2002
++++ lum/arch/i386/mm/init.c    Thu Jul  4 10:04:25 2002
 @@ -43,6 +43,12 @@
  static unsigned long totalram_pages;
  static unsigned long totalhigh_pages;
@@ -70,7 +70,7 @@
  {
        int freed = 0;
 --- lum-pristine/mm/slab.c     Fri Dec 21 10:42:05 2001
-+++ lum/mm/slab.c      Fri Jun 14 23:57:09 2002
++++ lum/mm/slab.c      Thu Jul  4 10:04:25 2002
 @@ -1187,6 +1187,59 @@
   * Called with the cache-lock held.
   */
  static int kmem_extra_free_checks (kmem_cache_t * cachep,
                        slab_t *slabp, void * objp)
 --- lum-pristine/drivers/block/blkpg.c Mon Feb 25 12:37:57 2002
-+++ lum/drivers/block/blkpg.c  Fri Jun  7 12:49:14 2002
++++ lum/drivers/block/blkpg.c  Thu Jul  4 10:04:25 2002
 @@ -294,3 +294,38 @@
  }
  
 +EXPORT_SYMBOL(dev_check_rdonly);
 +EXPORT_SYMBOL(dev_clear_rdonly);
 --- lum-pristine/drivers/block/loop.c  Fri Dec 21 10:41:53 2001
-+++ lum/drivers/block/loop.c   Fri Jun  7 12:49:14 2002
++++ lum/drivers/block/loop.c   Thu Jul  4 10:04:25 2002
 @@ -471,6 +471,11 @@
        spin_unlock_irq(&lo->lo_lock);
  
                        goto err;
        } else if (rw == READA) {
 --- lum-pristine/drivers/ide/ide-disk.c        Fri Dec 21 10:41:54 2001
-+++ lum/drivers/ide/ide-disk.c Fri Jun  7 12:49:14 2002
++++ lum/drivers/ide/ide-disk.c Thu Jul  4 10:04:25 2002
 @@ -367,6 +367,12 @@
   */
  static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
                OUT_BYTE(drive->ctl,IDE_CONTROL_REG);
        OUT_BYTE(0x00, IDE_FEATURE_REG);
 --- lum-pristine/fs/ext3/Makefile      Fri Dec 21 10:41:55 2001
-+++ lum/fs/ext3/Makefile       Fri Jun  7 12:49:13 2002
++++ lum/fs/ext3/Makefile       Thu Jul  4 10:04:25 2002
 @@ -9,6 +9,8 @@
  
  O_TARGET := ext3.o
                ioctl.o namei.o super.o symlink.o
  obj-m    := $(O_TARGET)
 --- lum-pristine/fs/ext3/super.c       Mon Feb 25 12:38:08 2002
-+++ lum/fs/ext3/super.c        Fri Jun  7 12:49:14 2002
++++ lum/fs/ext3/super.c        Thu Jul  4 10:04:25 2002
 @@ -1744,7 +1744,7 @@
        unregister_filesystem(&ext3_fs_type);
  }
  MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
  MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
 --- lum-pristine/fs/jbd/commit.c       Mon Feb 25 12:38:08 2002
-+++ lum/fs/jbd/commit.c        Fri Jun  7 12:49:14 2002
++++ lum/fs/jbd/commit.c        Thu Jul  4 10:04:25 2002
 @@ -475,7 +475,7 @@
             transaction's t_log_list queue, and metadata buffers are on
             the t_iobuf_list queue.
  
        J_ASSERT(commit_transaction->t_sync_datalist == NULL);
 --- lum-pristine/fs/jbd/journal.c      Mon Feb 25 12:38:08 2002
-+++ lum/fs/jbd/journal.c       Fri Jun  7 12:49:14 2002
++++ lum/fs/jbd/journal.c       Thu Jul  4 10:04:25 2002
 @@ -58,6 +58,7 @@
  #endif
  EXPORT_SYMBOL(journal_flush);
  EXPORT_SYMBOL(journal_init_dev);
  EXPORT_SYMBOL(journal_init_inode);
 --- lum-pristine/fs/jbd/transaction.c  Mon Feb 25 12:38:08 2002
-+++ lum/fs/jbd/transaction.c   Fri Jun  7 12:49:14 2002
++++ lum/fs/jbd/transaction.c   Thu Jul  4 10:04:25 2002
 @@ -57,6 +57,7 @@
        transaction->t_state = T_RUNNING;
        transaction->t_tid = journal->j_transaction_sequence++;
         * If the handle is marked SYNC, we need to set another commit
         * going!  We also want to force a commit if the current
 --- lum-pristine/include/linux/blkdev.h        Mon Nov 26 06:29:17 2001
-+++ lum/include/linux/blkdev.h Sat Jun 22 12:23:55 2002
++++ lum/include/linux/blkdev.h Sat Jul 13 13:06:04 2002
 @@ -228,4 +228,8 @@
        return retval;
  }
 +void dev_clear_rdonly(int);
  #endif
 --- lum-pristine/include/linux/slab.h  Fri Dec 21 10:42:04 2001
-+++ lum/include/linux/slab.h   Sat Jun 22 12:23:50 2002
++++ lum/include/linux/slab.h   Sat Jul 13 13:06:04 2002
 @@ -57,6 +57,7 @@
  extern int kmem_cache_shrink(kmem_cache_t *);
  extern void *kmem_cache_alloc(kmem_cache_t *, int);
  extern void *kmalloc(size_t, int);
  extern void kfree(const void *);
 --- lum-pristine/include/linux/jbd.h   Mon Feb 25 12:38:13 2002
-+++ lum/include/linux/jbd.h    Sat Jun 22 12:24:17 2002
++++ lum/include/linux/jbd.h    Sat Jul 13 13:09:28 2002
 @@ -249,6 +249,13 @@
        return bh->b_private;
  }
  extern void    journal_lock_updates (journal_t *);
  extern void    journal_unlock_updates (journal_t *);
 --- lum-pristine/kernel/ksyms.c        Mon Feb 25 12:38:13 2002
-+++ lum/kernel/ksyms.c Sat Jun 22 12:20:01 2002
++++ lum/kernel/ksyms.c Thu Jul  4 10:47:09 2002
 @@ -271,6 +271,12 @@
  EXPORT_SYMBOL(lock_may_write);
  EXPORT_SYMBOL(dcache_readdir);
  EXPORT_SYMBOL(default_llseek);
  EXPORT_SYMBOL(dentry_open);
 --- lum-pristine/include/linux/dcache.h        Thu Nov 22 12:46:18 2001
-+++ lum/include/linux/dcache.h Sat Jun 22 12:23:50 2002
-@@ -6,6 +6,32 @@
++++ lum/include/linux/dcache.h Sat Jul 13 13:05:41 2002
+@@ -6,6 +6,33 @@
  #include <asm/atomic.h>
  #include <linux/mount.h>
  
 +#define IT_SETATTR  (1<<11)
 +#define IT_READLINK  (1<<12)
 +#define IT_MKNOD   (1<<13)
++#define IT_LOOKUP   (1<<14)
 +
 +struct lookup_intent { 
 +      int it_op;
  /*
   * linux/include/linux/dcache.h
   *
-@@ -79,17 +105,20 @@
+@@ -79,17 +106,20 @@
        struct dentry_operations  *d_op;
        struct super_block * d_sb;      /* The root of the dentry tree */
        unsigned long d_vfs_flags;
  };
  
  /* the dentry parameter passed to d_hash and d_compare is the parent
---- lum-pristine/include/linux/fs.h    Thu Jun 13 14:07:26 2002
-+++ lum/include/linux/fs.h     Sat Jun 22 12:23:50 2002
+--- lum-pristine/include/linux/fs.h    Sat Jul 13 13:20:13 2002
++++ lum/include/linux/fs.h     Sat Jul 13 13:06:04 2002
 @@ -536,6 +536,7 @@
  
        /* needed for tty driver, and maybe others */
  extern void iput(struct inode *);
  extern void force_delete(struct inode *);
 --- lum-pristine/fs/nfsd/vfs.c Fri Dec 21 10:41:55 2001
-+++ lum/fs/nfsd/vfs.c  Thu Jun 20 10:37:05 2002
++++ lum/fs/nfsd/vfs.c  Thu Jul  4 10:04:25 2002
 @@ -1285,7 +1285,7 @@
                        err = nfserr_perm;
        } else
                nfsd_sync_dir(tdentry);
                nfsd_sync_dir(fdentry);
 --- lum-pristine/fs/namei.c    Mon Feb 25 12:38:09 2002
-+++ lum/fs/namei.c     Wed Jul  3 15:00:09 2002
++++ lum/fs/namei.c     Sat Jul 13 12:14:38 2002
 @@ -94,6 +94,14 @@
   * XEmacs seems to be relying on it...
   */
        /* Negative dentry, just create the file */
        if (!dentry->d_inode) {
                error = vfs_create(dir->d_inode, dentry,
-@@ -1139,6 +1215,7 @@
+@@ -1136,9 +1212,11 @@
+               if (flag & FMODE_WRITE)
+                       DQUOT_INIT(inode);
++        intent_release(dentry);
        return 0;
  
  exit_dput:
        dput(dentry);
  exit:
        path_release(nd);
-@@ -1181,13 +1258,20 @@
+@@ -1181,13 +1259,20 @@
        }
        dir = nd->dentry;
        down(&dir->d_inode->i_sem);
  {
        struct dentry *dentry;
  
-@@ -1195,7 +1279,7 @@
+@@ -1195,7 +1280,7 @@
        dentry = ERR_PTR(-EEXIST);
        if (nd->last_type != LAST_NORM)
                goto fail;
        if (IS_ERR(dentry))
                goto fail;
        if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
-@@ -1241,6 +1325,7 @@
+@@ -1241,6 +1326,7 @@
        char * tmp;
        struct dentry * dentry;
        struct nameidata nd;
  
        if (S_ISDIR(mode))
                return -EPERM;
-@@ -1252,11 +1337,12 @@
+@@ -1252,11 +1338,12 @@
                error = path_walk(tmp, &nd);
        if (error)
                goto out;
                switch (mode & S_IFMT) {
                case 0: case S_IFREG:
                        error = vfs_create(nd.dentry->d_inode,dentry,mode);
-@@ -1270,6 +1356,7 @@
+@@ -1270,6 +1357,7 @@
                default:
                        error = -EINVAL;
                }
                dput(dentry);
        }
        up(&nd.dentry->d_inode->i_sem);
-@@ -1310,6 +1397,7 @@
+@@ -1310,6 +1398,7 @@
  {
        int error = 0;
        char * tmp;
  
        tmp = getname(pathname);
        error = PTR_ERR(tmp);
-@@ -1321,11 +1409,13 @@
+@@ -1321,11 +1410,13 @@
                        error = path_walk(tmp, &nd);
                if (error)
                        goto out;
                        dput(dentry);
                }
                up(&nd.dentry->d_inode->i_sem);
-@@ -1407,6 +1497,7 @@
+@@ -1407,6 +1498,7 @@
        char * name;
        struct dentry *dentry;
        struct nameidata nd;
  
        name = getname(pathname);
        if(IS_ERR(name))
-@@ -1429,10 +1520,12 @@
+@@ -1429,10 +1521,12 @@
                        goto exit1;
        }
        down(&nd.dentry->d_inode->i_sem);
                dput(dentry);
        }
        up(&nd.dentry->d_inode->i_sem);
-@@ -1476,6 +1569,7 @@
+@@ -1476,6 +1570,7 @@
        char * name;
        struct dentry *dentry;
        struct nameidata nd;
  
        name = getname(pathname);
        if(IS_ERR(name))
-@@ -1489,14 +1583,16 @@
+@@ -1489,14 +1584,16 @@
        if (nd.last_type != LAST_NORM)
                goto exit1;
        down(&nd.dentry->d_inode->i_sem);
                dput(dentry);
        }
        up(&nd.dentry->d_inode->i_sem);
-@@ -1543,6 +1639,7 @@
+@@ -1543,6 +1640,7 @@
        int error = 0;
        char * from;
        char * to;
  
        from = getname(oldname);
        if(IS_ERR(from))
-@@ -1557,10 +1654,12 @@
+@@ -1557,10 +1655,12 @@
                        error = path_walk(to, &nd);
                if (error)
                        goto out;
                        dput(dentry);
                }
                up(&nd.dentry->d_inode->i_sem);
-@@ -1626,6 +1725,7 @@
+@@ -1626,6 +1726,7 @@
        int error;
        char * from;
        char * to;
  
        from = getname(oldname);
        if(IS_ERR(from))
-@@ -1648,10 +1748,12 @@
+@@ -1648,10 +1749,12 @@
                error = -EXDEV;
                if (old_nd.mnt != nd.mnt)
                        goto out_release;
                        dput(new_dentry);
                }
                up(&nd.dentry->d_inode->i_sem);
-@@ -1694,7 +1796,8 @@
+@@ -1694,7 +1797,8 @@
   *       locking].
   */
  int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
  {
        int error;
        struct inode *target;
-@@ -1748,12 +1851,14 @@
+@@ -1748,12 +1852,14 @@
        } else
                double_down(&old_dir->i_zombie,
                            &new_dir->i_zombie);
        if (target) {
                if (!error)
                        target->i_flags |= S_DEAD;
-@@ -1775,7 +1880,8 @@
+@@ -1775,7 +1881,8 @@
  }
  
  int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
  {
        int error;
  
-@@ -1802,10 +1908,12 @@
+@@ -1802,10 +1909,12 @@
        DQUOT_INIT(old_dir);
        DQUOT_INIT(new_dir);
        double_down(&old_dir->i_zombie, &new_dir->i_zombie);
        double_up(&old_dir->i_zombie, &new_dir->i_zombie);
        if (error)
                return error;
-@@ -1817,13 +1925,14 @@
+@@ -1817,13 +1926,14 @@
  }
  
  int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        if (!error) {
                if (old_dir == new_dir)
                        inode_dir_notify(old_dir, DN_RENAME);
-@@ -1841,6 +1950,7 @@
+@@ -1841,6 +1951,7 @@
        struct dentry * old_dir, * new_dir;
        struct dentry * old_dentry, *new_dentry;
        struct nameidata oldnd, newnd;
  
        if (path_init(oldname, LOOKUP_PARENT, &oldnd))
                error = path_walk(oldname, &oldnd);
-@@ -1868,7 +1978,9 @@
+@@ -1868,7 +1979,9 @@
  
        double_lock(new_dir, old_dir);
  
        error = PTR_ERR(old_dentry);
        if (IS_ERR(old_dentry))
                goto exit3;
-@@ -1884,18 +1996,21 @@
+@@ -1884,18 +1997,21 @@
                if (newnd.last.name[newnd.last.len])
                        goto exit4;
        }
  exit3:
        double_up(&new_dir->d_inode->i_sem, &old_dir->d_inode->i_sem);
 --- lum-pristine/fs/open.c     Fri Oct 12 14:48:42 2001
-+++ lum/fs/open.c      Sat Jun 22 16:44:30 2002
++++ lum/fs/open.c      Thu Jul  4 10:04:25 2002
 @@ -19,6 +19,8 @@
  #include <asm/uaccess.h>
  
   * Find an empty file descriptor entry, and mark it busy.
   */
 --- lum-pristine/fs/stat.c     Thu Sep 13 17:04:43 2001
-+++ lum/fs/stat.c      Sat Jun 22 18:39:04 2002
++++ lum/fs/stat.c      Thu Jul  4 10:04:25 2002
 @@ -135,13 +135,15 @@
  asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
  {
index 54c4304..bdfebc5 100644 (file)
  EXPORT_SYMBOL(dentry_open);
 --- linux-2.4.18-chaos4-pristine/include/linux/dcache.h        Thu Jun 27 21:52:26 2002
 +++ linux-2.4.18-chaos4/include/linux/dcache.h Thu Jun 27 22:34:38 2002
-@@ -6,6 +6,32 @@
+@@ -6,6 +6,33 @@
  #include <asm/atomic.h>
  #include <linux/mount.h>
  
 +#define IT_SETATTR  (1<<11)
 +#define IT_READLINK  (1<<12)
 +#define IT_MKNOD  (1<<13)
++#define IT_LOOKUP  (1<<14)
 +
 +struct lookup_intent { 
 +      int it_op;
  /*
   * linux/include/linux/dcache.h
   *
-@@ -78,6 +104,7 @@
+@@ -78,6 +105,7 @@
        unsigned long d_time;           /* used by d_revalidate */
        struct dentry_operations  *d_op;
        struct super_block * d_sb;      /* The root of the dentry tree */
        unsigned long d_vfs_flags;
        void * d_fsdata;                /* fs-specific data */
        void * d_extra_attributes;      /* TUX-specific data */
-@@ -91,6 +118,8 @@
+@@ -91,6 +119,8 @@
        int (*d_delete)(struct dentry *);
        void (*d_release)(struct dentry *);
        void (*d_iput)(struct dentry *, struct inode *);
index 802d8aa..e092dd8 100644 (file)
@@ -259,6 +259,7 @@ setup_lustre() {
                echo "$0: RPCDEV is already configured, skipping"
                return 0
        fi
+        list_mods
 
        $OBDCTL <<- EOF || return $?
        newdev
@@ -266,7 +267,6 @@ setup_lustre() {
        setup
        quit
        EOF
-        list_mods
 
        [ -d /mnt/lustre ] || mkdir /mnt/lustre
 }
@@ -282,7 +282,6 @@ setup_ldlm() {
        setup
        quit
        EOF
-        list_mods
 }
 
 find_devno() {
@@ -322,7 +321,6 @@ setup_mds() {
        setup ${MDS} ${MDSFS}
        quit
        EOF
-        list_mods
 }
 
 setup_mds_lov() { 
@@ -341,8 +339,6 @@ setup_mds_lov() {
         disconnect
        quit
        EOF
-
-        list_mods
 }
 
 
@@ -397,7 +393,6 @@ setup_ost() {
        setup ${OBD} ${OBDARG}
        quit
        EOF
-        list_mods
 
        $OBDCTL <<- EOF || return $?
        newdev
@@ -405,7 +400,6 @@ setup_ost() {
        setup \$OBDDEV
        quit
        EOF
-        list_mods
 }
 
 setup_server() {
@@ -432,7 +426,6 @@ setup_osc() {
        quit
        EOF
         done
-        list_mods
 }
 
 setup_mdc() {
@@ -454,7 +447,6 @@ setup_mdc() {
        quit
        EOF
         done
-        list_mods
 }
 
 setup_lov () { 
@@ -471,7 +463,6 @@ setup_lov () {
        setup  MDCDEV-UUID
        quit
        EOF
-        list_mods
 }        
 
 
index 25666c3..143f88e 100644 (file)
@@ -1077,7 +1077,7 @@ static int do_name2dev(char *func, char *name)
 static int jt_name2dev(int argc, char **argv)
 {
         if (argc != 2) {
-                fprintf(stderr, "usage: %s name\n", cmdname(argv[0]));
+                Parser_printhelp("name2dev"); 
                 return -1;
         }
 
@@ -1538,11 +1538,11 @@ command_t cmdlist[] = {
 
         /* Device configuration commands */
         {"lovconfig", jt_lov_config, 0, "configure lov data on MDS "
-         "(usage: lov-uuid stripecount, stripesize, pattern, UUID1, [UUID2, ...])"}, 
+         "[usage: lovconfig lov-uuid stripecount, stripesize, pattern, UUID1, [UUID2, ...]"}, 
         {"list", jt_list, 0, "list the devices (no args)"},
         {"newdev", jt_newdev, 0, "set device to a new unused obd (no args)"},
         {"device", jt_device, 0, "set current device (args device_no name)"},
-        {"name2dev", jt_name2dev, 0, "set device by name (args name)"},
+        {"name2dev", jt_name2dev, 0, "set device by name [usage: name2dev devname]"},
         {"attach", jt_attach, 0, "name the type of device (args: type data"},
         {"setup", jt_setup, 0, "setup device (args: <blkdev> [data]"},
         {"detach", jt_detach, 0, "detach the current device (arg: )"},