From 4e601864fdf650cca88a8c3b539fb0f36290a89b Mon Sep 17 00:00:00 2001
From: yury <yury>
Date: Fri, 3 Dec 2004 09:07:53 +0000
Subject: [PATCH] - fixes in fsfilt interface about 2.6/2.4 versions of kernel.
 Fixes in ext3 implementation. - removed not needed lookup_by_path() from
 lustre_smfs.h - small cleanups about names of variables to make them coherent
 with another parts.

---
 lustre/include/linux/lustre_fsfilt.h |  3 +--
 lustre/include/linux/lustre_mds.h    |  4 ++--
 lustre/include/linux/lustre_smfs.h   | 26 --------------------------
 lustre/lov/lov_obd.c                 |  6 +++---
 lustre/lvfs/fsfilt_ext3.c            | 28 ++++++++++++----------------
 lustre/lvfs/fsfilt_smfs.c            |  2 +-
 lustre/mdc/mdc_request.c             | 10 +++++-----
 lustre/mgmt/mgmt_cli.c               |  2 +-
 lustre/mgmt/mgmt_svc.c               |  3 ++-
 lustre/obdfilter/filter_io_24.c      |  1 -
 lustre/obdfilter/filter_io_26.c      |  2 --
 11 files changed, 27 insertions(+), 60 deletions(-)

diff --git a/lustre/include/linux/lustre_fsfilt.h b/lustre/include/linux/lustre_fsfilt.h
index 32cd252f9a..62b5686d80 100644
--- a/lustre/include/linux/lustre_fsfilt.h
+++ b/lustre/include/linux/lustre_fsfilt.h
@@ -75,8 +75,7 @@ struct fsfilt_operations {
                                int size);
         int     (* fs_get_sid)(struct inode *inode, void *sid, int size);
 
-        /* this method is needed to make IO operation fsfilt nature depend. */
-        int     (* fs_send_bio)(int rw, struct inode *inode,struct kiobuf *bio);
+        int     (* fs_send_bio)(int rw, struct inode *inode, void *bio);
 
         /* methods for getting page from backing fs and putting page there
          * during IO. Used on OST. */
diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h
index 9f9f4dfc46..0ed932f09a 100644
--- a/lustre/include/linux/lustre_mds.h
+++ b/lustre/include/linux/lustre_mds.h
@@ -219,8 +219,8 @@ int mdc_enqueue(struct obd_export *exp,
 /* mdc/mdc_request.c */
 int mdc_get_secdesc_size(void);
 void mdc_pack_secdesc(struct ptlrpc_request *req, int size);
-int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req, 
-                      unsigned int offset, struct obd_export *exp_osc, 
+int mdc_req2lustre_md(struct obd_export *exp_lmv, struct ptlrpc_request *req, 
+                      unsigned int offset, struct obd_export *exp_lov, 
                       struct lustre_md *md);
 int mdc_getstatus(struct obd_export *exp, struct lustre_id *rootid);
 int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
diff --git a/lustre/include/linux/lustre_smfs.h b/lustre/include/linux/lustre_smfs.h
index b6fd845b14..fa6dddbb39 100644
--- a/lustre/include/linux/lustre_smfs.h
+++ b/lustre/include/linux/lustre_smfs.h
@@ -451,32 +451,6 @@ static inline void post_smfs_dentry(struct dentry *cache_dentry)
         d_unalloc(cache_dentry);
 }
 
-static inline int lookup_by_path(char *path, int flags, struct nameidata *nd)
-{
-        struct dentry *dentry = NULL;
-        int rc = 0;
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        if (path_init(path, flags, nd)) {
-#else
-        if (path_lookup(path, flags, nd)) {
-#endif
-                rc = path_walk(path, nd);
-                if (rc)
-                        RETURN(rc);
-        } else {
-                RETURN(-EINVAL);
-        }
-
-        dentry = nd->dentry;
-
-        if (!dentry->d_inode || is_bad_inode(dentry->d_inode)) {
-                path_release(nd);
-                RETURN(-ENODEV);
-        }
-        RETURN(rc);
-}
-
 /*FIXME there should be more conditions in this check*/
 static inline int smfs_do_rec(struct inode *inode)
 {
diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c
index b480612f74..18aa9e4b26 100644
--- a/lustre/lov/lov_obd.c
+++ b/lustre/lov/lov_obd.c
@@ -210,7 +210,7 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt,
 }
 
 static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
-                       struct obd_uuid *cluuid, unsigned long connect_flags)
+                       struct obd_uuid *cluuid, unsigned long flags)
 {
 #ifdef __KERNEL__
         struct proc_dir_entry *lov_proc_dir;
@@ -246,11 +246,11 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
 #endif
 
         /* connect_flags is the MDS number, save for use in lov_add_obd */
-        lov->lov_connect_flags = connect_flags;
+        lov->lov_connect_flags = flags;
         for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) {
                 if (obd_uuid_empty(&tgt->uuid))
                         continue;
-                rc = lov_connect_obd(obd, tgt, 0, connect_flags);
+                rc = lov_connect_obd(obd, tgt, 0, flags);
                 if (rc)
                         GOTO(out_disc, rc);
         }
diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c
index 877cfcacf8..a9fb04fe9e 100644
--- a/lustre/lvfs/fsfilt_ext3.c
+++ b/lustre/lvfs/fsfilt_ext3.c
@@ -550,33 +550,29 @@ static int fsfilt_ext3_get_sid(struct inode *inode, void *sid, int sid_size)
         return rc;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-static int fsfilt_ext3_send_bio(int rw, struct inode *inode, struct bio *bio)
+static int fsfilt_ext3_send_bio(int rw, struct inode *inode, void *bio)
 {
-        submit_bio(rw, bio);
-        return 0;
-}
+	int rc = 0;
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+        submit_bio(rw, (struct bio *)bio);
 #else
-static int fsfilt_ext3_send_bio(int rw, struct inode *inode, struct kiobuf *bio)
-{
-        int rc, blocks_per_page;
-
-        rc = brw_kiovec(rw, 1, &bio, inode->i_dev,
-                        bio->blocks, 1 << inode->i_blkbits);
+	struct bio *b = (struct kiobuf *)bio;
+        int blocks_per_page;
+	
+        rc = brw_kiovec(rw, 1, &b, inode->i_dev,
+                        b->blocks, 1 << inode->i_blkbits);
 
         blocks_per_page = PAGE_SIZE >> inode->i_blkbits;
 
-        if (rc != (1 << inode->i_blkbits) * bio->nr_pages * blocks_per_page) {
+        if (rc != (1 << inode->i_blkbits) * b->nr_pages * blocks_per_page) {
                 CERROR("short write?  expected %d, wrote %d\n",
-                       (1 << inode->i_blkbits) * bio->nr_pages *
+                       (1 << inode->i_blkbits) * b->nr_pages *
                        blocks_per_page, rc);
         }
-
+#endif
         return rc;
 }
-#endif
 
-/* FIXME-UMKA: This should be used in 2.6.x io code later. */
 static struct page *fsfilt_ext3_getpage(struct inode *inode, long int index)
 {
         int rc;
diff --git a/lustre/lvfs/fsfilt_smfs.c b/lustre/lvfs/fsfilt_smfs.c
index b0b77b1fe1..acbc93ae15 100644
--- a/lustre/lvfs/fsfilt_smfs.c
+++ b/lustre/lvfs/fsfilt_smfs.c
@@ -358,7 +358,7 @@ static int fsfilt_smfs_get_sid(struct inode *inode, void *sid,
                                   cache_fsfilt->fs_get_sid);
 }
 
-static int fsfilt_smfs_send_bio(int rw, struct inode *inode, struct kiobuf *bio)
+static int fsfilt_smfs_send_bio(int rw, struct inode *inode, void *bio)
 {
         struct inode *cache_inode;
         struct fsfilt_operations *cache_fsfilt;
diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
index 670191443d..f8a8f08f9a 100644
--- a/lustre/mdc/mdc_request.c
+++ b/lustre/mdc/mdc_request.c
@@ -300,8 +300,8 @@ int mdc_store_inode_generation(struct obd_export *exp,
         return 0;
 }
 
-int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req, 
-                      unsigned int offset, struct obd_export *exp_osc, 
+int mdc_req2lustre_md(struct obd_export *exp_lmv, struct ptlrpc_request *req, 
+                      unsigned int offset, struct obd_export *exp_lov, 
                       struct lustre_md *md)
 {
         int rc = 0;
@@ -332,7 +332,7 @@ int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req,
                 LASSERT (lmm != NULL);
                 LASSERT_REPSWABBED (req, offset + 1);
 
-                rc = obd_unpackmd(exp_osc, &md->lsm, lmm, lmmsize);
+                rc = obd_unpackmd(exp_lov, &md->lsm, lmm, lmmsize);
                 if (rc >= 0) {
                         LASSERT (rc >= sizeof (*md->lsm));
                         rc = 0;
@@ -340,7 +340,7 @@ int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req,
         } else if (S_ISDIR(md->body->mode)) {
                 struct mea *mea;
                 int mdsize;
-                LASSERT(exp_mdc != NULL);
+                LASSERT(exp_lmv != NULL);
                 
                 /* dir can be non-splitted */
                 if (md->body->eadatasize == 0)
@@ -365,7 +365,7 @@ int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req,
                         
                 LASSERT(id_fid(&mea->mea_ids[0]));
 
-                rc = obd_unpackmd(exp_mdc, (void *)&md->mea,
+                rc = obd_unpackmd(exp_lmv, (void *)&md->mea,
                                   (void *)mea, mdsize);
                 if (rc >= 0) {
                         LASSERT (rc >= sizeof (*md->mea));
diff --git a/lustre/mgmt/mgmt_cli.c b/lustre/mgmt/mgmt_cli.c
index 313a9d5f93..e7663c5181 100644
--- a/lustre/mgmt/mgmt_cli.c
+++ b/lustre/mgmt/mgmt_cli.c
@@ -264,7 +264,7 @@ static int __init mgmtcli_init(void)
                               mgmtcli_register_for_events);
         inter_module_register("mgmtcli_deregister_for_events", THIS_MODULE,
                               mgmtcli_deregister_for_events);
-        return class_register_type(&mgmtcli_obd_ops, 0, LUSTRE_MGMTCLI_NAME);
+        return class_register_type(&mgmtcli_obd_ops, NULL, 0, LUSTRE_MGMTCLI_NAME);
 }
 
 static void __exit mgmtcli_exit(void)
diff --git a/lustre/mgmt/mgmt_svc.c b/lustre/mgmt/mgmt_svc.c
index 6d39b2b05d..f0ff838c1e 100644
--- a/lustre/mgmt/mgmt_svc.c
+++ b/lustre/mgmt/mgmt_svc.c
@@ -151,7 +151,8 @@ static struct obd_ops mgmt_obd_ops = {
 
 static int __init mgmt_init(void)
 {
-        int rc = class_register_type(&mgmt_obd_ops, 0, MGMT_DEVICE_NAME);
+        int rc = class_register_type(&mgmt_obd_ops, NULL, 
+				     0, MGMT_DEVICE_NAME);
 
         return rc;
 }
diff --git a/lustre/obdfilter/filter_io_24.c b/lustre/obdfilter/filter_io_24.c
index 2c59f68890..6029329795 100644
--- a/lustre/obdfilter/filter_io_24.c
+++ b/lustre/obdfilter/filter_io_24.c
@@ -442,4 +442,3 @@ cleanup:
 
         RETURN(rc);
 }
-
diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c
index 24e6229bca..d807f76e4c 100644
--- a/lustre/obdfilter/filter_io_26.c
+++ b/lustre/obdfilter/filter_io_26.c
@@ -255,8 +255,6 @@ cleanup:
         RETURN(rc);
 }
 
-
-
 /* See if there are unallocated parts in given file region */
 static int filter_range_is_mapped(struct inode *inode, obd_size offset, int len)
 {
-- 
GitLab