Whamcloud - gitweb
LU-2675 obd: cleanup struct md_op_data and uses 34/11734/4
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 2 Sep 2014 19:30:07 +0000 (14:30 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 4 Nov 2014 18:01:41 +0000 (18:01 +0000)
Make the following changes in or around struct md_op_data:

* Move the definition of enum op_cli_flags from lclient.h to obd.h and
  rename it to enum md_cli_flags.

* Change to type of the op_flags member from __u32 to enum
  md_op_flags.

* Remove the used but never set member op_npages.

* Remove the set but never used member op_stripe_offset (an alias for
  op_ioepoch).

* Remove the op_max_pages alias for op_valid and add a op_max_pages
  member.

* Add a new member op_attr_flags.

* Remove the definition and all uses of struct ll_iattr. This
  structure was only used in expressions of the form
  ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags which can all
  be rewritten as op_data->op_attr_flags.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I17aabfcecdfd1a02dbee04362b033ef404a2cb27
Reviewed-on: http://review.whamcloud.com/11734
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lclient.h
lustre/include/linux/obd.h
lustre/include/obd.h
lustre/llite/file.c
lustre/llite/llite_lib.c
lustre/llite/statahead.c
lustre/lmv/lmv_obd.c
lustre/mdc/mdc_lib.c
lustre/mdc/mdc_request.c
lustre/obdclass/obdo.c

index 9c56e69..c289878 100644 (file)
@@ -498,12 +498,4 @@ enum {
        LUSTRE_OPC_ANY      = 5
 };
 
-enum op_cli_flags {
-       CLI_SET_MEA     = 1 << 0,
-       CLI_RM_ENTRY    = 1 << 1,
-       CLI_HASH64      = 1 << 2,
-       CLI_API32       = 1 << 3,
-       CLI_MIGRATE     = 1 << 4,
-};
-
 #endif /*LCLIENT_H */
index fcb846e..41deb08 100644 (file)
 #include <linux/proc_fs.h>
 #include <linux/mount.h>
 
-struct ll_iattr {
-       struct iattr    iattr;
-       unsigned int    ia_attr_flags;
-};
-
 #define CLIENT_OBD_LIST_LOCK_DEBUG 1
 
 typedef struct {
index a4bc0cf..d2d0012 100644 (file)
@@ -802,6 +802,14 @@ static inline int it_to_lock_mode(struct lookup_intent *it)
        return -EINVAL;
 }
 
+enum md_cli_flags {
+       CLI_SET_MEA     = 1 << 0,
+       CLI_RM_ENTRY    = 1 << 1,
+       CLI_HASH64      = 1 << 2,
+       CLI_API32       = 1 << 3,
+       CLI_MIGRATE     = 1 << 4,
+};
+
 struct md_op_data {
         struct lu_fid           op_fid1; /* operation fid1 (usualy parent) */
         struct lu_fid           op_fid2; /* operation fid2 (usualy child) */
@@ -823,13 +831,14 @@ struct md_op_data {
        size_t                  op_data_size;
 
         /* iattr fields and blocks. */
-        struct iattr            op_attr;
-       __u64                   op_valid;
+       struct iattr            op_attr;
        loff_t                  op_attr_blocks;
+       unsigned int            op_attr_flags; /* LUSTRE_{SYNC,..}_FL */
+       __u64                   op_valid; /* OBD_MD_* */
 
        /* Size-on-MDS epoch and flags. */
        __u64                   op_ioepoch;
-       __u32                   op_flags;
+       enum md_op_flags        op_flags;
 
        /* Capa fields */
        struct obd_capa        *op_capa1;
@@ -839,20 +848,17 @@ struct md_op_data {
        enum mds_op_bias        op_bias;
 
        /* Used by readdir */
-       __u32                   op_npages;
+       unsigned int            op_max_pages;
 
        /* used to transfer info between the stacks of MD client
         * see enum op_cli_flags */
-       __u32                   op_cli_flags;
+       enum md_cli_flags       op_cli_flags;
 
        /* File object data version for HSM release, on client */
        __u64                   op_data_version;
        struct lustre_handle    op_lease_handle;
 };
 
-#define op_stripe_offset       op_ioepoch
-#define op_max_pages           op_valid
-
 struct md_callback {
        int (*md_blocking_ast)(struct ldlm_lock *lock,
                               struct ldlm_lock_desc *desc,
index 59a828f..6bd91ed 100644 (file)
@@ -90,8 +90,7 @@ void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data,
         op_data->op_attr.ia_ctime = inode->i_ctime;
         op_data->op_attr.ia_size = i_size_read(inode);
         op_data->op_attr_blocks = inode->i_blocks;
-        ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags =
-                                        ll_inode_to_ext_flags(inode->i_flags);
+       op_data->op_attr_flags = ll_inode_to_ext_flags(inode->i_flags);
         op_data->op_ioepoch = ll_i2info(inode)->lli_ioepoch;
         if (fh)
                 op_data->op_handle = *fh;
index 7274ff6..824ea66 100644 (file)
@@ -2231,7 +2231,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,
                 if (IS_ERR(op_data))
                         RETURN(PTR_ERR(op_data));
 
-                ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags = flags;
+               op_data->op_attr_flags = flags;
                 op_data->op_attr.ia_valid |= ATTR_ATTR_FLAG;
                 rc = md_setattr(sbi->ll_md_exp, op_data,
                                 NULL, 0, NULL, 0, &req, NULL);
index 09547c9..c62b3ea 100644 (file)
@@ -1278,7 +1278,6 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)
        /**
         *FIXME choose the start offset of the readdir
         */
-       op_data->op_stripe_offset = 0;
        op_data->op_max_pages = ll_i2sbi(dir)->ll_md_brw_pages;
 
        ll_dir_chain_init(&chain);
index ccaecc4..54f5b67 100644 (file)
@@ -53,7 +53,6 @@
 #include <lustre_lmv.h>
 #include <lprocfs_status.h>
 #include <cl_object.h>
-#include <lclient.h>
 #include <lustre_fid.h>
 #include <lustre_ioctl.h>
 #include "lmv_internal.h"
@@ -2281,7 +2280,6 @@ static int lmv_get_min_striped_entry(struct obd_export *exp,
 
                /* op_data will be shared by each stripe, so we need
                 * reset these value for each stripe */
-               op_data->op_stripe_offset = i;
                op_data->op_fid1 = lsm->lsm_md_oinfo[i].lmo_fid;
                op_data->op_fid2 = lsm->lsm_md_oinfo[i].lmo_fid;
                op_data->op_data = lsm->lsm_md_oinfo[i].lmo_root;
index 279152d..d07c555 100644 (file)
@@ -40,7 +40,6 @@
 #include <obd_class.h>
 #include <obd.h>
 #include <cl_object.h>
-#include <lclient.h>
 #include "mdc_internal.h"
 
 
@@ -334,8 +333,7 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
        rec->sa_atime  = LTIME_S(op_data->op_attr.ia_atime);
        rec->sa_mtime  = LTIME_S(op_data->op_attr.ia_mtime);
        rec->sa_ctime  = LTIME_S(op_data->op_attr.ia_ctime);
-       rec->sa_attr_flags =
-               ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
+       rec->sa_attr_flags = op_data->op_attr_flags;
        if ((op_data->op_attr.ia_valid & ATTR_GID) &&
             in_group_p(op_data->op_attr.ia_gid))
                rec->sa_suppgid =
index f43caa8..9ce58a9 100644 (file)
@@ -51,7 +51,6 @@
 #include <lustre_param.h>
 #include <lustre_log.h>
 #include <cl_object.h>
-#include <lclient.h>
 
 #include "mdc_internal.h"
 
@@ -1407,8 +1406,7 @@ static int mdc_read_page_remote(void *data, struct page *page0)
                                                        LU_PAGE_SHIFT;
                LASSERT(!(req->rq_bulk->bd_nob_transferred & ~LU_PAGE_MASK));
 
-               CDEBUG(D_INODE, "read %d(%d)/%d pages\n", rd_pgs, lu_pgs,
-                      op_data->op_npages);
+               CDEBUG(D_INODE, "read %d(%d) pages\n", rd_pgs, lu_pgs);
 
                mdc_adjust_dirpages(page_pool, rd_pgs, lu_pgs);
 
index 7765fe5..2868954 100644 (file)
@@ -226,8 +226,7 @@ void md_from_obdo(struct md_op_data *op_data, const struct obdo *oa,
                 op_data->op_attr.ia_valid |= ATTR_BLOCKS;
         }
         if (valid & OBD_MD_FLFLAGS) {
-                ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags =
-                        oa->o_flags;
+               op_data->op_attr_flags = oa->o_flags;
                 op_data->op_attr.ia_valid |= ATTR_ATTR_FLAG;
         }
 }