From: John L. Hammond Date: Tue, 2 Sep 2014 19:30:07 +0000 (-0500) Subject: LU-2675 obd: cleanup struct md_op_data and uses X-Git-Tag: 2.6.90~21 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=83cce524dd47e5433dfdbe530f3b453807ef6976 LU-2675 obd: cleanup struct md_op_data and uses 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 Change-Id: I17aabfcecdfd1a02dbee04362b033ef404a2cb27 Reviewed-on: http://review.whamcloud.com/11734 Reviewed-by: Bob Glossman Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lclient.h b/lustre/include/lclient.h index 9c56e69..c289878 100644 --- a/lustre/include/lclient.h +++ b/lustre/include/lclient.h @@ -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 */ diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index fcb846e..41deb08 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -49,11 +49,6 @@ #include #include -struct ll_iattr { - struct iattr iattr; - unsigned int ia_attr_flags; -}; - #define CLIENT_OBD_LIST_LOCK_DEBUG 1 typedef struct { diff --git a/lustre/include/obd.h b/lustre/include/obd.h index a4bc0cf..d2d0012 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -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, diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 59a828f..6bd91ed 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 7274ff6..824ea66 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -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); diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 09547c9..c62b3ea 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -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); diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index ccaecc4..54f5b67 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #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; diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 279152d..d07c555 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -40,7 +40,6 @@ #include #include #include -#include #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 = diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index f43caa8..9ce58a9 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -51,7 +51,6 @@ #include #include #include -#include #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); diff --git a/lustre/obdclass/obdo.c b/lustre/obdclass/obdo.c index 7765fe5..2868954 100644 --- a/lustre/obdclass/obdo.c +++ b/lustre/obdclass/obdo.c @@ -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; } }