Whamcloud - gitweb
LU-5478 osc: get rid of obd_* typedefs 48/13148/16
authorDmitry Eremin <dmitry.eremin@intel.com>
Wed, 11 Feb 2015 18:58:11 +0000 (21:58 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 30 Mar 2015 03:53:40 +0000 (03:53 +0000)
We have a bunch of typedefs for common things that made no sense
and hid the actual type from plain view.
Replace them with proper uXX or sXX types.
Exception is in lustre_idl.h and lustre_ioctl.h where
they are replaced with __uXX and __sXX to be able to be included
in userspace

Also fix valid flags to u64.

patch 6 in series: modify osc/osp

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ib18583489ed79eaded6339a283bc48e4fda319f6
Reviewed-on: http://review.whamcloud.com/13148
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
15 files changed:
lustre/include/obd.h
lustre/include/obd_class.h
lustre/llite/vvp_req.c
lustre/obdclass/linux/linux-obdo.c
lustre/obdclass/obdo.c
lustre/osc/osc_cache.c
lustre/osc/osc_cl_internal.h
lustre/osc/osc_internal.h
lustre/osc/osc_io.c
lustre/osc/osc_page.c
lustre/osc/osc_quota.c
lustre/osc/osc_request.c
lustre/osp/osp_internal.h
lustre/osp/osp_precreate.c
lustre/ptlrpc/pack_generic.c

index 596e0ef..c22ad54 100644 (file)
@@ -1219,7 +1219,7 @@ static inline struct md_open_data *obd_mod_alloc(void)
        }                                                         \
 })
 
-void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid);
+void obdo_from_inode(struct obdo *dst, struct inode *src, u64 valid);
 void obdo_set_parent_fid(struct obdo *dst, const struct lu_fid *parent);
 
 /* return 1 if client should be resend request */
index b3ccb08..44338e0 100644 (file)
@@ -319,10 +319,10 @@ static inline struct lr_server_data *class_server_data(struct obd_device *obd)
 struct lu_attr;
 struct inode;
 
-void obdo_from_la(struct obdo *dst, const struct lu_attr *la, __u64 valid);
-void la_from_obdo(struct lu_attr *la, const struct obdo *dst, u32 valid);
+void obdo_from_la(struct obdo *dst, const struct lu_attr *la, u64 valid);
+void la_from_obdo(struct lu_attr *la, const struct obdo *dst, u64 valid);
 
-void obdo_cpy_md(struct obdo *dst, const struct obdo *src, u32 valid);
+void obdo_cpy_md(struct obdo *dst, const struct obdo *src, u64 valid);
 void obdo_to_ioobj(const struct obdo *oa, struct obd_ioobj *ioobj);
 
 #define OBT(dev)        (dev)->obd_type
index 17b6866..e78e0b2 100644 (file)
@@ -65,11 +65,10 @@ static void vvp_req_attr_set(const struct lu_env *env,
 {
        struct inode    *inode;
        struct obdo     *oa;
-       u32              valid_flags;
+       u64              valid_flags = OBD_MD_FLTYPE;
 
        oa = attr->cra_oa;
        inode = vvp_object_inode(obj);
-       valid_flags = OBD_MD_FLTYPE;
 
        if ((flags & OBD_MD_FLOSSCAPA) != 0) {
                LASSERT(attr->cra_capa == NULL);
index 382db01..0a3858e 100644 (file)
@@ -49,9 +49,9 @@
 #include <obd_class.h>
 
 /*FIXME: Just copy from obdo_from_inode*/
-void obdo_from_la(struct obdo *dst, const struct lu_attr *la, __u64 valid)
+void obdo_from_la(struct obdo *dst, const struct lu_attr *la, u64 valid)
 {
-       u32 newvalid = 0;
+       u64 newvalid = 0;
 
         if (valid & LA_ATIME) {
                 dst->o_atime = la->la_atime;
@@ -100,9 +100,9 @@ void obdo_from_la(struct obdo *dst, const struct lu_attr *la, __u64 valid)
 EXPORT_SYMBOL(obdo_from_la);
 
 /*FIXME: Just copy from obdo_from_inode*/
-void la_from_obdo(struct lu_attr *dst, const struct obdo *obdo, u32 valid)
+void la_from_obdo(struct lu_attr *dst, const struct obdo *obdo, u64 valid)
 {
-        __u64 newvalid = 0;
+       u64 newvalid = 0;
 
         valid &= obdo->o_valid;
 
index 69960e7..457dfc3 100644 (file)
@@ -56,14 +56,14 @@ EXPORT_SYMBOL(obdo_set_parent_fid);
 
 /* WARNING: the file systems must take care not to tinker with
    attributes they don't manage (such as blocks). */
-void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
+void obdo_from_inode(struct obdo *dst, struct inode *src, u64 valid)
 {
-       u32 newvalid = 0;
+       u64 newvalid = 0;
 
-        if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
-                CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n",
-                       valid, LTIME_S(src->i_mtime),
-                       LTIME_S(src->i_ctime));
+       if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
+               CDEBUG(D_INODE, "valid "LPX64", new time %lu/%lu\n",
+                       valid, LTIME_S(src->i_mtime),
+                       LTIME_S(src->i_ctime));
 
         if (valid & OBD_MD_FLATIME) {
                 dst->o_atime = LTIME_S(src->i_atime);
@@ -115,7 +115,7 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
 }
 EXPORT_SYMBOL(obdo_from_inode);
 
-void obdo_cpy_md(struct obdo *dst, const struct obdo *src, u32 valid)
+void obdo_cpy_md(struct obdo *dst, const struct obdo *src, u64 valid)
 {
         CDEBUG(D_INODE, "src obdo "DOSTID" valid "LPX64", dst obdo "DOSTID"\n",
                POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi));
index 73b1fad..f533e48 100644 (file)
@@ -823,7 +823,7 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext,
        int nr_pages = ext->oe_nr_pages;
        int lost_grant = 0;
        int blocksize = cli->cl_import->imp_obd->obd_osfs.os_bsize ? : 4096;
-       __u64 last_off = 0;
+       loff_t last_off = 0;
        int last_count = -1;
        ENTRY;
 
@@ -2284,7 +2284,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
        pgoff_t index;
        unsigned int tmp;
        unsigned int grants = 0;
-       int    brw_flags = OBD_BRW_ASYNC;
+       u32    brw_flags = OBD_BRW_ASYNC;
        int    cmd = OBD_BRW_WRITE;
        int    need_release = 0;
        int    rc = 0;
index 18bc755..cd4962f 100644 (file)
@@ -428,7 +428,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
                     enum cl_req_type crt, int brw_flags);
 int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops);
 int osc_set_async_flags(struct osc_object *obj, struct osc_page *opg,
-                       obd_flag async_flags);
+                       u32 async_flags);
 int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
                        struct page *page, loff_t offset);
 int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
index 1f43cd1..5e16aad 100644 (file)
@@ -59,7 +59,7 @@ struct osc_async_page {
        struct list_head        oap_pending_item;
        struct list_head        oap_rpc_item;
 
-        obd_off                 oap_obj_off;
+       loff_t                  oap_obj_off;
         unsigned                oap_page_off;
         enum async_flags        oap_async_flags;
 
@@ -194,7 +194,7 @@ extern struct kmem_cache *osc_quota_kmem;
 struct osc_quota_info {
        /** linkage for quota hash table */
        struct hlist_node oqi_hash;
-       obd_uid           oqi_id;
+       u32               oqi_id;
 };
 
 struct osc_async_args {
@@ -204,7 +204,7 @@ struct osc_async_args {
 int osc_quota_setup(struct obd_device *obd);
 int osc_quota_cleanup(struct obd_device *obd);
 int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
-                    obd_flag valid, obd_flag flags);
+                   u64 valid, u32 flags);
 int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[]);
 int osc_quotactl(struct obd_device *unused, struct obd_export *exp,
                  struct obd_quotactl *oqctl);
index de25635..5fa3e8f 100644 (file)
@@ -803,7 +803,7 @@ static void osc_req_completion(const struct lu_env *env,
 static void osc_req_attr_set(const struct lu_env *env,
                             const struct cl_req_slice *slice,
                             const struct cl_object *obj,
-                            struct cl_req_attr *attr, obd_valid flags)
+                            struct cl_req_attr *attr, u64 flags)
 {
        struct lov_oinfo *oinfo;
        struct cl_req    *clerq;
index 08eb661..f17c4e9 100644 (file)
@@ -256,7 +256,7 @@ static int osc_page_print(const struct lu_env *env,
 
        return (*printer)(env, cookie, LUSTRE_OSC_NAME"-page@%p %lu: "
                          "1< %#x %d %u %s %s > "
-                         "2< "LPU64" %u %u %#x %#x | %p %p %p > "
+                         "2< "LPD64" %u %u %#x %#x | %p %p %p > "
                          "3< %s %p %d %lu %d > "
                          "4< %d %d %d %lu %s | %s %s %s %s > "
                          "5< %s %s %s %s | %d %s | %d %s %s>\n",
@@ -905,7 +905,7 @@ out:
 static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
                                            int factor)
 {
-       obd_count page_count = desc->bd_iov_count;
+       int page_count = desc->bd_iov_count;
        void *zone = NULL;
        int count = 0;
        int i;
index efc3b48..7ba8864 100644 (file)
@@ -31,7 +31,7 @@
 #include <obd.h>
 #include "osc_internal.h"
 
-static inline struct osc_quota_info *osc_oqi_alloc(obd_uid id)
+static inline struct osc_quota_info *osc_oqi_alloc(u32 id)
 {
        struct osc_quota_info *oqi;
 
@@ -72,7 +72,7 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[])
                                                : OBD_FL_NO_GRPQUOTA)
 
 int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
-                    obd_flag valid, obd_flag flags)
+                   u64 valid, u32 flags)
 {
        int type;
        int rc = 0;
@@ -147,10 +147,10 @@ static int
 oqi_keycmp(const void *key, struct hlist_node *hnode)
 {
        struct osc_quota_info *oqi;
-       obd_uid uid;
+       u32 uid;
 
        LASSERT(key != NULL);
-       uid = *((obd_uid*)key);
+       uid = *((u32 *)key);
        oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash);
 
        return uid == oqi->oqi_id;
index 4e3a10c..31ecfcf 100644 (file)
@@ -56,7 +56,7 @@ struct osc_brw_async_args {
        struct obdo              *aa_oa;
        int                       aa_requested_nob;
        int                       aa_nio_count;
-       obd_count                 aa_page_count;
+       u32                       aa_page_count;
        int                       aa_resends;
        struct brw_page **aa_ppga;
        struct client_obd        *aa_cli;
@@ -92,7 +92,7 @@ struct osc_enqueue_args {
        unsigned int            oa_agl:1;
 };
 
-static void osc_release_ppga(struct brw_page **ppga, obd_count count);
+static void osc_release_ppga(struct brw_page **ppga, size_t count);
 static int brw_interpret(const struct lu_env *env, struct ptlrpc_request *req,
                         void *data, int rc);
 
@@ -655,9 +655,9 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp,
 static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
                                 long writing_bytes)
 {
-        obd_flag bits = OBD_MD_FLBLOCKS|OBD_MD_FLGRANT;
+       u64 bits = OBD_MD_FLBLOCKS | OBD_MD_FLGRANT;
 
-        LASSERT(!(oa->o_valid & bits));
+       LASSERT(!(oa->o_valid & bits));
 
        oa->o_valid |= bits;
        spin_lock(&cli->cl_loi_list_lock);
@@ -709,7 +709,7 @@ void osc_update_next_shrink(struct client_obd *cli)
                cli->cl_next_shrink_grant);
 }
 
-static void __osc_update_grant(struct client_obd *cli, obd_size grant)
+static void __osc_update_grant(struct client_obd *cli, u64 grant)
 {
        spin_lock(&cli->cl_loi_list_lock);
        cli->cl_avail_grant += grant;
@@ -725,8 +725,9 @@ static void osc_update_grant(struct client_obd *cli, struct ost_body *body)
 }
 
 static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp,
-                              obd_count keylen, void *key, obd_count vallen,
-                              void *val, struct ptlrpc_request_set *set);
+                             u32 keylen, void *key,
+                             u32 vallen, void *val,
+                             struct ptlrpc_request_set *set);
 
 static int osc_shrink_grant_interpret(const struct lu_env *env,
                                       struct ptlrpc_request *req,
@@ -929,7 +930,7 @@ static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd)
  * beyond the end of a stripe file; i.e. lustre is reading a sparse file
  * via the LOV, and it _knows_ it's reading inside the file, it's just that
  * this stripe never got written at or beyond this stripe offset yet. */
-static void handle_short_read(int nob_read, obd_count page_count,
+static void handle_short_read(int nob_read, size_t page_count,
                               struct brw_page **pga)
 {
         char *ptr;
@@ -965,8 +966,8 @@ static void handle_short_read(int nob_read, obd_count page_count,
 }
 
 static int check_write_rcs(struct ptlrpc_request *req,
-                           int requested_nob, int niocount,
-                           obd_count page_count, struct brw_page **pga)
+                          int requested_nob, int niocount,
+                          size_t page_count, struct brw_page **pga)
 {
         int     i;
         __u32   *remote_rcs;
@@ -1020,11 +1021,11 @@ static inline int can_merge_pages(struct brw_page *p1, struct brw_page *p2)
         return (p1->off + p1->count == p2->off);
 }
 
-static obd_count osc_checksum_bulk(int nob, obd_count pg_count,
-                                  struct brw_page **pga, int opc,
-                                  cksum_type_t cksum_type)
+static u32 osc_checksum_bulk(int nob, size_t pg_count,
+                            struct brw_page **pga, int opc,
+                            cksum_type_t cksum_type)
 {
-       __u32                           cksum;
+       u32                             cksum;
        int                             i = 0;
        struct cfs_crypto_hash_desc     *hdesc;
        unsigned int                    bufsize;
@@ -1076,11 +1077,11 @@ static obd_count osc_checksum_bulk(int nob, obd_count pg_count,
 }
 
 static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa,
-                                struct lov_stripe_md *lsm, obd_count page_count,
-                                struct brw_page **pga,
-                                struct ptlrpc_request **reqp,
-                                struct obd_capa *ocapa, int reserve,
-                                int resend)
+                               struct lov_stripe_md *lsm, u32 page_count,
+                               struct brw_page **pga,
+                               struct ptlrpc_request **reqp,
+                               struct obd_capa *ocapa, int reserve,
+                               int resend)
 {
         struct ptlrpc_request   *req;
         struct ptlrpc_bulk_desc *desc;
@@ -1283,9 +1284,9 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa,
 }
 
 static int check_write_checksum(struct obdo *oa, const lnet_process_id_t *peer,
-                                __u32 client_cksum, __u32 server_cksum, int nob,
-                                obd_count page_count, struct brw_page **pga,
-                                cksum_type_t client_cksum_type)
+                               __u32 client_cksum, __u32 server_cksum, int nob,
+                               size_t page_count, struct brw_page **pga,
+                               cksum_type_t client_cksum_type)
 {
         __u32 new_cksum;
         char *msg;
@@ -1582,7 +1583,7 @@ static void sort_brw_pages(struct brw_page **array, int num)
         } while (stride > 1);
 }
 
-static void osc_release_ppga(struct brw_page **ppga, obd_count count)
+static void osc_release_ppga(struct brw_page **ppga, size_t count)
 {
         LASSERT(ppga != NULL);
         OBD_FREE(ppga, sizeof(*ppga) * count);
@@ -1749,8 +1750,8 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
        enum cl_req_type                crt = (cmd & OBD_BRW_WRITE) ? CRT_WRITE :
                                                                      CRT_READ;
        struct cl_req_attr              *crattr = NULL;
-       obd_off                         starting_offset = OBD_OBJECT_EOF;
-       obd_off                         ending_offset = 0;
+       loff_t                          starting_offset = OBD_OBJECT_EOF;
+       loff_t                          ending_offset = 0;
        int                             mpflag = 0;
        int                             mem_tight = 0;
        int                             page_count = 0;
@@ -1769,7 +1770,8 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
                list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) {
                        ++page_count;
                        list_add_tail(&oap->oap_rpc_item, &rpc_list);
-                       if (starting_offset > oap->oap_obj_off)
+                       if (starting_offset == OBD_OBJECT_EOF ||
+                           starting_offset > oap->oap_obj_off)
                                starting_offset = oap->oap_obj_off;
                        else
                                LASSERT(oap->oap_page_off == 0);
@@ -2470,8 +2472,9 @@ out:
 }
 
 static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp,
-                              obd_count keylen, void *key, obd_count vallen,
-                              void *val, struct ptlrpc_request_set *set)
+                             u32 keylen, void *key,
+                             u32 vallen, void *val,
+                             struct ptlrpc_request_set *set)
 {
         struct ptlrpc_request *req;
         struct obd_device     *obd = exp->exp_obd;
index 7c450de..7d84e56 100644 (file)
@@ -264,7 +264,7 @@ struct osp_thread_info {
        struct lu_attr           osi_attr;
        struct ost_id            osi_oi;
        struct ost_id            osi_oi2;
-       obd_id                   osi_id;
+       u64                      osi_id;
        loff_t                   osi_off;
        union {
                struct llog_rec_hdr             osi_hdr;
@@ -306,17 +306,19 @@ static inline bool is_only_remote_trans(struct thandle *th)
 static inline void osp_objid_buf_prep(struct lu_buf *buf, loff_t *off,
                                      __u32 *id, int index)
 {
+       /* Note: through id is only 32 bits, it will also write 64 bits
+        * for oid to keep compatibility with the previous version. */
        buf->lb_buf = (void *)id;
-       buf->lb_len = sizeof(obd_id);
-       *off = sizeof(obd_id) * index;
+       buf->lb_len = sizeof(u64);
+       *off = sizeof(u64) * index;
 }
 
 static inline void osp_objseq_buf_prep(struct lu_buf *buf, loff_t *off,
                                       __u64 *seq, int index)
 {
        buf->lb_buf = (void *)seq;
-       buf->lb_len = sizeof(obd_id);
-       *off = sizeof(obd_id) * index;
+       buf->lb_len = sizeof(u64);
+       *off = sizeof(u64) * index;
 }
 
 static inline void osp_buf_prep(struct lu_buf *lb, void *buf, int buf_len)
@@ -517,7 +519,7 @@ typedef int (*osp_async_request_interpreter_t)(const struct lu_env *env,
                                               void *data, int index, int rc);
 
 /* osp_dev.c */
-void osp_update_last_id(struct osp_device *d, obd_id objid);
+void osp_update_last_id(struct osp_device *d, u64 objid);
 extern struct llog_operations osp_mds_ost_orig_logops;
 
 /* osp_trans.c */
index a377c4d..29c7b52 100644 (file)
@@ -354,16 +354,15 @@ int osp_write_last_oid_seq_files(struct lu_env *env, struct osp_device *osp,
        int                   rc;
        ENTRY;
 
-       /* Note: through f_oid is only 32bits, it will also write
-        * 64 bits for oid to keep compatiblity with the previous
-        * version. */
+       /* Note: through f_oid is only 32 bits, it will also write 64 bits
+        * for oid to keep compatibility with the previous version. */
        lb_oid->lb_buf = &fid->f_oid;
-       lb_oid->lb_len = sizeof(obd_id);
-       oid_off = sizeof(obd_id) * osp->opd_index;
+       lb_oid->lb_len = sizeof(u64);
+       oid_off = sizeof(u64) * osp->opd_index;
 
        lb_oseq->lb_buf = &fid->f_seq;
-       lb_oseq->lb_len = sizeof(obd_id);
-       oseq_off = sizeof(obd_id) * osp->opd_index;
+       lb_oseq->lb_len = sizeof(u64);
+       oseq_off = sizeof(u64) * osp->opd_index;
 
        th = dt_trans_create(env, osp->opd_storage);
        if (IS_ERR(th))
index 267574a..f081081 100644 (file)
@@ -2281,9 +2281,9 @@ void dump_rniobuf(struct niobuf_remote *nb)
 
 void dump_obdo(struct obdo *oa)
 {
-       __u32 valid = oa->o_valid;
+       u64 valid = oa->o_valid;
 
-       CDEBUG(D_RPCTRACE, "obdo: o_valid = %08x\n", valid);
+       CDEBUG(D_RPCTRACE, "obdo: o_valid = "LPX64"\n", valid);
        if (valid & OBD_MD_FLID)
                CDEBUG(D_RPCTRACE, "obdo: id = "DOSTID"\n", POSTID(&oa->o_oi));
        if (valid & OBD_MD_FLFID)