Whamcloud - gitweb
LU-5417 lustre: fix comparison between signed and unsigned 27/11327/2
authorDmitry Eremin <dmitry.eremin@intel.com>
Mon, 4 Aug 2014 17:24:41 +0000 (21:24 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 12 Aug 2014 16:06:18 +0000 (16:06 +0000)
Cleanup in general headers.
* use size_t in cfs_size_round*()
* make unsigned index and len in lustre_cfg_*() and object_update_*()
* make iteration variable the same type as comparing value
* make unsigned pages counters
* fix printf formats

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: I9af487f0c8e04825adfce94ae11fe0a64c71c2e5
Reviewed-on: http://review.whamcloud.com/11327
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
13 files changed:
libcfs/include/libcfs/libcfs_private.h
lustre/include/lprocfs_status.h
lustre/include/lustre_cfg.h
lustre/include/lustre_disk.h
lustre/include/lustre_fid.h
lustre/include/lustre_ioctl.h
lustre/include/lustre_lmv.h
lustre/include/lustre_net.h
lustre/include/lustre_update.h
lustre/include/obd.h
lustre/osc/osc_request.c
lustre/ptlrpc/pack_generic.c
lustre/target/out_handler.c

index d9e7ad4..8245c5b 100644 (file)
@@ -599,30 +599,30 @@ struct libcfs_device_userstate
 
 #define MKSTR(ptr) ((ptr))? (ptr) : ""
 
 
 #define MKSTR(ptr) ((ptr))? (ptr) : ""
 
-static inline int cfs_size_round4 (int val)
+static inline size_t cfs_size_round4(size_t val)
 {
         return (val + 3) & (~0x3);
 }
 
 #ifndef HAVE_CFS_SIZE_ROUND
 {
         return (val + 3) & (~0x3);
 }
 
 #ifndef HAVE_CFS_SIZE_ROUND
-static inline int cfs_size_round (int val)
+static inline size_t cfs_size_round(size_t val)
 {
         return (val + 7) & (~0x7);
 }
 #define HAVE_CFS_SIZE_ROUND
 #endif
 
 {
         return (val + 7) & (~0x7);
 }
 #define HAVE_CFS_SIZE_ROUND
 #endif
 
-static inline int cfs_size_round16(int val)
+static inline size_t cfs_size_round16(size_t val)
 {
         return (val + 0xf) & (~0xf);
 }
 
 {
         return (val + 0xf) & (~0xf);
 }
 
-static inline int cfs_size_round32(int val)
+static inline size_t cfs_size_round32(size_t val)
 {
         return (val + 0x1f) & (~0x1f);
 }
 
 {
         return (val + 0x1f) & (~0x1f);
 }
 
-static inline int cfs_size_round0(int val)
+static inline size_t cfs_size_round0(size_t val)
 {
         if (!val)
                 return 0;
 {
         if (!val)
                 return 0;
@@ -631,11 +631,11 @@ static inline int cfs_size_round0(int val)
 
 static inline size_t cfs_round_strlen(char *fset)
 {
 
 static inline size_t cfs_round_strlen(char *fset)
 {
-        return (size_t)cfs_size_round((int)strlen(fset) + 1);
+       return cfs_size_round(strlen(fset) + 1);
 }
 
 /* roundup \a val to power2 */
 }
 
 /* roundup \a val to power2 */
-static inline unsigned int cfs_power2_roundup(unsigned int val)
+static inline size_t cfs_power2_roundup(size_t val)
 {
        if (val != LOWEST_BIT_SET(val)) { /* not a power of 2 already */
                do {
 {
        if (val != LOWEST_BIT_SET(val)) { /* not a power of 2 already */
                do {
index e9a8d41..3deb990 100644 (file)
@@ -557,7 +557,7 @@ static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
                                             int idx,
                                             enum lprocfs_fields_flags field)
 {
                                             int idx,
                                             enum lprocfs_fields_flags field)
 {
-       int           i;
+       unsigned int  i;
        unsigned int  num_cpu;
        unsigned long flags     = 0;
        __u64         ret       = 0;
        unsigned int  num_cpu;
        unsigned long flags     = 0;
        __u64         ret       = 0;
index 0cb0a1e..29292df 100644 (file)
@@ -169,13 +169,12 @@ static inline void lustre_cfg_bufs_reset(struct lustre_cfg_bufs *bufs, char *nam
                 lustre_cfg_bufs_set_string(bufs, 0, name);
 }
 
                 lustre_cfg_bufs_set_string(bufs, 0, name);
 }
 
-static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, int index)
+static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, __u32 index)
 {
 {
-        int i;
-        int offset;
-        int bufcount;
-        LASSERT (lcfg != NULL);
-        LASSERT (index >= 0);
+       __u32 i;
+       size_t offset;
+       __u32 bufcount;
+       LASSERT (lcfg != NULL);
 
         bufcount = lcfg->lcfg_bufcount;
         if (index >= bufcount)
 
         bufcount = lcfg->lcfg_bufcount;
         if (index >= bufcount)
@@ -190,7 +189,7 @@ static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, int index)
 static inline void lustre_cfg_bufs_init(struct lustre_cfg_bufs *bufs,
                                         struct lustre_cfg *lcfg)
 {
 static inline void lustre_cfg_bufs_init(struct lustre_cfg_bufs *bufs,
                                         struct lustre_cfg *lcfg)
 {
-        int i;
+       __u32 i;
         bufs->lcfg_bufcount = lcfg->lcfg_bufcount;
         for (i = 0; i < bufs->lcfg_bufcount; i++) {
                 bufs->lcfg_buflen[i] = lcfg->lcfg_buflens[i];
         bufs->lcfg_bufcount = lcfg->lcfg_bufcount;
         for (i = 0; i < bufs->lcfg_bufcount; i++) {
                 bufs->lcfg_buflen[i] = lcfg->lcfg_buflens[i];
@@ -198,7 +197,7 @@ static inline void lustre_cfg_bufs_init(struct lustre_cfg_bufs *bufs,
         }
 }
 
         }
 }
 
-static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index)
+static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, __u32 index)
 {
        char *s;
 
 {
        char *s;
 
@@ -214,7 +213,7 @@ static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index)
         * of data.  Try to use the padding first though.
         */
        if (s[lcfg->lcfg_buflens[index] - 1] != '\0') {
         * of data.  Try to use the padding first though.
         */
        if (s[lcfg->lcfg_buflens[index] - 1] != '\0') {
-               int last = min((int)lcfg->lcfg_buflens[index],
+               size_t last = min((size_t)lcfg->lcfg_buflens[index],
                               cfs_size_round(lcfg->lcfg_buflens[index]) - 1);
                char lost = s[last];
                s[last] = '\0';
                               cfs_size_round(lcfg->lcfg_buflens[index]) - 1);
                char lost = s[last];
                s[last] = '\0';
@@ -226,10 +225,10 @@ static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index)
        return s;
 }
 
        return s;
 }
 
-static inline int lustre_cfg_len(__u32 bufcount, __u32 *buflens)
+static inline __u32 lustre_cfg_len(__u32 bufcount, __u32 *buflens)
 {
 {
-        int i;
-        int len;
+       __u32 i;
+       __u32 len;
         ENTRY;
 
         len = LCFG_HDR_SIZE(bufcount);
         ENTRY;
 
         len = LCFG_HDR_SIZE(bufcount);
@@ -246,7 +245,7 @@ static inline void lustre_cfg_init(struct lustre_cfg *lcfg, int cmd,
                                   struct lustre_cfg_bufs *bufs)
 {
        char *ptr;
                                   struct lustre_cfg_bufs *bufs)
 {
        char *ptr;
-       int i;
+       __u32 i;
 
        lcfg->lcfg_version = LUSTRE_CFG_VERSION;
        lcfg->lcfg_command = cmd;
 
        lcfg->lcfg_version = LUSTRE_CFG_VERSION;
        lcfg->lcfg_command = cmd;
@@ -284,7 +283,7 @@ static inline void lustre_cfg_free(struct lustre_cfg *lcfg)
         return;
 }
 
         return;
 }
 
-static inline int lustre_cfg_sanity_check(void *buf, int len)
+static inline int lustre_cfg_sanity_check(void *buf, size_t len)
 {
         struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
         ENTRY;
 {
         struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
         ENTRY;
index 8df2204..114f556 100644 (file)
@@ -364,7 +364,7 @@ struct lsd_client_data {
 static inline void check_lcd(char *obd_name, int index,
                              struct lsd_client_data *lcd)
 {
 static inline void check_lcd(char *obd_name, int index,
                              struct lsd_client_data *lcd)
 {
-        int length = sizeof(lcd->lcd_uuid);
+       size_t length = sizeof(lcd->lcd_uuid);
         if (strnlen((char*)lcd->lcd_uuid, length) == length) {
                 lcd->lcd_uuid[length - 1] = '\0';
 
         if (strnlen((char*)lcd->lcd_uuid, length) == length) {
                 lcd->lcd_uuid[length - 1] = '\0';
 
index 769dee5..f37c5a8 100644 (file)
@@ -768,7 +768,7 @@ range_be_to_cpu(struct lu_seq_range *dst, const struct lu_seq_range *src)
 static inline void range_array_cpu_to_le(struct lu_seq_range_array *dst,
                                         const struct lu_seq_range_array *src)
 {
 static inline void range_array_cpu_to_le(struct lu_seq_range_array *dst,
                                         const struct lu_seq_range_array *src)
 {
-       int i;
+       __u32 i;
 
        for (i = 0; i < src->lsra_count; i++)
                range_cpu_to_le(&dst->lsra_lsr[i], &src->lsra_lsr[i]);
 
        for (i = 0; i < src->lsra_count; i++)
                range_cpu_to_le(&dst->lsra_lsr[i], &src->lsra_lsr[i]);
@@ -779,7 +779,7 @@ static inline void range_array_cpu_to_le(struct lu_seq_range_array *dst,
 static inline void range_array_le_to_cpu(struct lu_seq_range_array *dst,
                                         const struct lu_seq_range_array *src)
 {
 static inline void range_array_le_to_cpu(struct lu_seq_range_array *dst,
                                         const struct lu_seq_range_array *src)
 {
-       int i;
+       __u32 i;
 
        dst->lsra_count = le32_to_cpu(src->lsra_count);
        for (i = 0; i < dst->lsra_count; i++)
 
        dst->lsra_count = le32_to_cpu(src->lsra_count);
        for (i = 0; i < dst->lsra_count; i++)
index dc48ad0..737c144 100644 (file)
@@ -112,9 +112,9 @@ struct obd_ioctl_hdr {
        __u32           ioc_version;
 };
 
        __u32           ioc_version;
 };
 
-static inline int obd_ioctl_packlen(struct obd_ioctl_data *data)
+static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data)
 {
 {
-       int len = cfs_size_round(sizeof(*data));
+       __u32 len = cfs_size_round(sizeof(*data));
 
        len += cfs_size_round(data->ioc_inllen1);
        len += cfs_size_round(data->ioc_inllen2);
 
        len += cfs_size_round(data->ioc_inllen1);
        len += cfs_size_round(data->ioc_inllen2);
@@ -205,7 +205,7 @@ static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
 int obd_ioctl_getdata(char **buf, int *len, void *arg);
 int obd_ioctl_popdata(void *arg, void *data, int len);
 
 int obd_ioctl_getdata(char **buf, int *len, void *arg);
 int obd_ioctl_popdata(void *arg, void *data, int len);
 
-static inline void obd_ioctl_freedata(char *buf, int len)
+static inline void obd_ioctl_freedata(char *buf, size_t len)
 {
        ENTRY;
 
 {
        ENTRY;
 
index 687bbfc..5843f8f 100644 (file)
@@ -55,7 +55,7 @@ struct lmv_stripe_md {
 static inline bool
 lsm_md_eq(const struct lmv_stripe_md *lsm1, const struct lmv_stripe_md *lsm2)
 {
 static inline bool
 lsm_md_eq(const struct lmv_stripe_md *lsm1, const struct lmv_stripe_md *lsm2)
 {
-       int idx;
+       __u32 idx;
 
        if (lsm1->lsm_md_magic != lsm2->lsm_md_magic ||
            lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count ||
 
        if (lsm1->lsm_md_magic != lsm2->lsm_md_magic ||
            lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count ||
@@ -92,7 +92,7 @@ int lmvea_load_shards(const struct lu_env *env, struct dt_object *obj,
 static inline void lmv1_le_to_cpu(struct lmv_mds_md_v1 *lmv_dst,
                                  const struct lmv_mds_md_v1 *lmv_src)
 {
 static inline void lmv1_le_to_cpu(struct lmv_mds_md_v1 *lmv_dst,
                                  const struct lmv_mds_md_v1 *lmv_src)
 {
-       int i;
+       __u32 i;
 
        lmv_dst->lmv_magic = le32_to_cpu(lmv_src->lmv_magic);
        lmv_dst->lmv_stripe_count = le32_to_cpu(lmv_src->lmv_stripe_count);
 
        lmv_dst->lmv_magic = le32_to_cpu(lmv_src->lmv_magic);
        lmv_dst->lmv_stripe_count = le32_to_cpu(lmv_src->lmv_stripe_count);
index e71b65b..4f2546f 100644 (file)
@@ -2097,7 +2097,7 @@ static inline bool ptlrpc_nrs_req_can_move(struct ptlrpc_request *req)
 /**
  * Returns 1 if request buffer at offset \a index was already swabbed
  */
 /**
  * Returns 1 if request buffer at offset \a index was already swabbed
  */
-static inline int lustre_req_swabbed(struct ptlrpc_request *req, int index)
+static inline int lustre_req_swabbed(struct ptlrpc_request *req, size_t index)
 {
         LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
         return req->rq_req_swab_mask & (1 << index);
 {
         LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
         return req->rq_req_swab_mask & (1 << index);
@@ -2106,7 +2106,7 @@ static inline int lustre_req_swabbed(struct ptlrpc_request *req, int index)
 /**
  * Returns 1 if request reply buffer at offset \a index was already swabbed
  */
 /**
  * Returns 1 if request reply buffer at offset \a index was already swabbed
  */
-static inline int lustre_rep_swabbed(struct ptlrpc_request *req, int index)
+static inline int lustre_rep_swabbed(struct ptlrpc_request *req, size_t index)
 {
         LASSERT(index < sizeof(req->rq_rep_swab_mask) * 8);
         return req->rq_rep_swab_mask & (1 << index);
 {
         LASSERT(index < sizeof(req->rq_rep_swab_mask) * 8);
         return req->rq_rep_swab_mask & (1 << index);
@@ -2131,7 +2131,8 @@ static inline int ptlrpc_rep_need_swab(struct ptlrpc_request *req)
 /**
  * Mark request buffer at offset \a index that it was already swabbed
  */
 /**
  * Mark request buffer at offset \a index that it was already swabbed
  */
-static inline void lustre_set_req_swabbed(struct ptlrpc_request *req, int index)
+static inline void lustre_set_req_swabbed(struct ptlrpc_request *req,
+                                         size_t index)
 {
         LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
         LASSERT((req->rq_req_swab_mask & (1 << index)) == 0);
 {
         LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
         LASSERT((req->rq_req_swab_mask & (1 << index)) == 0);
@@ -2141,7 +2142,8 @@ static inline void lustre_set_req_swabbed(struct ptlrpc_request *req, int index)
 /**
  * Mark request reply buffer at offset \a index that it was already swabbed
  */
 /**
  * Mark request reply buffer at offset \a index that it was already swabbed
  */
-static inline void lustre_set_rep_swabbed(struct ptlrpc_request *req, int index)
+static inline void lustre_set_rep_swabbed(struct ptlrpc_request *req,
+                                         size_t index)
 {
         LASSERT(index < sizeof(req->rq_rep_swab_mask) * 8);
         LASSERT((req->rq_rep_swab_mask & (1 << index)) == 0);
 {
         LASSERT(index < sizeof(req->rq_rep_swab_mask) * 8);
         LASSERT((req->rq_rep_swab_mask & (1 << index)) == 0);
index b65e00d..e09fe3f 100644 (file)
@@ -60,7 +60,7 @@ object_update_size(const struct object_update *update)
 {
        const struct    object_update_param *param;
        unsigned long   size;
 {
        const struct    object_update_param *param;
        unsigned long   size;
-       int             i;
+       size_t          i;
 
        size = offsetof(struct object_update, ou_params[0]);
        for (i = 0; i < update->ou_params_count; i++) {
 
        size = offsetof(struct object_update, ou_params[0]);
        for (i = 0; i < update->ou_params_count; i++) {
@@ -72,11 +72,11 @@ object_update_size(const struct object_update *update)
 }
 
 static inline void
 }
 
 static inline void
-*object_update_param_get(const struct object_update *update, int index,
-                        int *size)
+*object_update_param_get(const struct object_update *update, size_t index,
+                        size_t *size)
 {
        const struct    object_update_param *param;
 {
        const struct    object_update_param *param;
-       int             i;
+       size_t          i;
 
        if (index >= update->ou_params_count)
                return NULL;
 
        if (index >= update->ou_params_count)
                return NULL;
@@ -98,8 +98,8 @@ static inline void
 static inline unsigned long
 object_update_request_size(const struct object_update_request *our)
 {
 static inline unsigned long
 object_update_request_size(const struct object_update_request *our)
 {
-       unsigned long size;
-       int        i = 0;
+       unsigned long   size;
+       size_t          i = 0;
 
        size = offsetof(struct object_update_request, ourq_updates[0]);
        for (i = 0; i < our->ourq_count; i++) {
 
        size = offsetof(struct object_update_request, ourq_updates[0]);
        for (i = 0; i < our->ourq_count; i++) {
@@ -113,10 +113,10 @@ object_update_request_size(const struct object_update_request *our)
 
 static inline struct object_update
 *object_update_request_get(const struct object_update_request *our,
 
 static inline struct object_update
 *object_update_request_get(const struct object_update_request *our,
-                          int index, int *size)
+                          size_t index, size_t *size)
 {
        void    *ptr;
 {
        void    *ptr;
-       int     i;
+       size_t  i;
 
        if (index >= our->ourq_count)
                return NULL;
 
        if (index >= our->ourq_count)
                return NULL;
@@ -133,7 +133,7 @@ static inline struct object_update
 }
 
 static inline void
 }
 
 static inline void
-object_update_reply_init(struct object_update_reply *reply, int count)
+object_update_reply_init(struct object_update_reply *reply, size_t count)
 {
        reply->ourp_magic = UPDATE_REPLY_MAGIC;
        reply->ourp_count = count;
 {
        reply->ourp_magic = UPDATE_REPLY_MAGIC;
        reply->ourp_count = count;
@@ -141,11 +141,11 @@ object_update_reply_init(struct object_update_reply *reply, int count)
 
 static inline struct object_update_result
 *object_update_result_get(const struct object_update_reply *reply,
 
 static inline struct object_update_result
 *object_update_result_get(const struct object_update_reply *reply,
-                         int index, int *size)
+                         size_t index, size_t *size)
 {
        char *ptr;
 {
        char *ptr;
-       int count = reply->ourp_count;
-       int i;
+       size_t count = reply->ourp_count;
+       size_t i;
 
        if (index >= count)
                return NULL;
 
        if (index >= count)
                return NULL;
@@ -166,7 +166,7 @@ static inline struct object_update_result
 
 static inline void
 object_update_result_insert(struct object_update_reply *reply,
 
 static inline void
 object_update_result_insert(struct object_update_reply *reply,
-                           void *data, int data_len, int index,
+                           void *data, size_t data_len, size_t index,
                            int rc)
 {
        struct object_update_result *update_result;
                            int rc)
 {
        struct object_update_result *update_result;
@@ -190,11 +190,11 @@ object_update_result_insert(struct object_update_reply *reply,
 
 static inline int
 object_update_result_data_get(const struct object_update_reply *reply,
 
 static inline int
 object_update_result_data_get(const struct object_update_reply *reply,
-                             struct lu_buf *lbuf, int index)
+                             struct lu_buf *lbuf, size_t index)
 {
        struct object_update_result *update_result;
 {
        struct object_update_result *update_result;
-       int  size = 0;
-       int  result;
+       size_t size = 0;
+       int    result;
 
        LASSERT(lbuf != NULL);
        update_result = object_update_result_get(reply, index, &size);
 
        LASSERT(lbuf != NULL);
        update_result = object_update_result_get(reply, index, &size);
index 9e36e97..486340d 100644 (file)
@@ -240,11 +240,11 @@ struct client_obd {
         struct sptlrpc_flavor    cl_flvr_mgc;   /* fixed flavor of mgc->mgs */
 
        /* the grant values are protected by loi_list_lock below */
         struct sptlrpc_flavor    cl_flvr_mgc;   /* fixed flavor of mgc->mgs */
 
        /* the grant values are protected by loi_list_lock below */
-       long                     cl_dirty_pages;      /* all _dirty_ in pages */
-       long                     cl_dirty_max_pages;  /* allowed w/o rpc */
-       long                     cl_dirty_transit;    /* dirty synchronous */
-       long                     cl_avail_grant;   /* bytes of credit for ost */
-       long                     cl_lost_grant;    /* lost credits (trunc) */
+       unsigned long            cl_dirty_pages;      /* all _dirty_ in pages */
+       unsigned long            cl_dirty_max_pages;  /* allowed w/o rpc */
+       unsigned long            cl_dirty_transit;    /* dirty synchronous */
+       unsigned long            cl_avail_grant;   /* bytes of credit for ost */
+       unsigned long            cl_lost_grant;    /* lost credits (trunc) */
 
        /* since we allocate grant by blocks, we don't know how many grant will
         * be used to add a page into cache. As a solution, we reserve maximum
 
        /* since we allocate grant by blocks, we don't know how many grant will
         * be used to add a page into cache. As a solution, we reserve maximum
@@ -287,13 +287,13 @@ struct client_obd {
        struct list_head        cl_loi_hp_ready_list;
        struct list_head        cl_loi_write_list;
        struct list_head        cl_loi_read_list;
        struct list_head        cl_loi_hp_ready_list;
        struct list_head        cl_loi_write_list;
        struct list_head        cl_loi_read_list;
-       int                     cl_r_in_flight;
-       int                     cl_w_in_flight;
+       __u32                   cl_r_in_flight;
+       __u32                   cl_w_in_flight;
        /* just a sum of the loi/lop pending numbers to be exported by /proc */
        atomic_t                cl_pending_w_pages;
        atomic_t                cl_pending_r_pages;
        __u32                   cl_max_pages_per_rpc;
        /* just a sum of the loi/lop pending numbers to be exported by /proc */
        atomic_t                cl_pending_w_pages;
        atomic_t                cl_pending_r_pages;
        __u32                   cl_max_pages_per_rpc;
-       int                     cl_max_rpcs_in_flight;
+       __u32                   cl_max_rpcs_in_flight;
        struct obd_histogram    cl_read_rpc_hist;
        struct obd_histogram    cl_write_rpc_hist;
        struct obd_histogram    cl_read_page_hist;
        struct obd_histogram    cl_read_rpc_hist;
        struct obd_histogram    cl_write_rpc_hist;
        struct obd_histogram    cl_read_page_hist;
@@ -1297,8 +1297,8 @@ static inline void client_adjust_max_dirty(struct client_obd *cli)
                cli->cl_dirty_max_pages = (OSC_MAX_DIRTY_DEFAULT * 1024 * 1024)
                                                        >> PAGE_CACHE_SHIFT;
        else {
                cli->cl_dirty_max_pages = (OSC_MAX_DIRTY_DEFAULT * 1024 * 1024)
                                                        >> PAGE_CACHE_SHIFT;
        else {
-               long dirty_max = cli->cl_max_rpcs_in_flight *
-                                               cli->cl_max_pages_per_rpc;
+               unsigned long dirty_max = cli->cl_max_rpcs_in_flight *
+                                         cli->cl_max_pages_per_rpc;
 
                if (dirty_max > cli->cl_dirty_max_pages)
                        cli->cl_dirty_max_pages = dirty_max;
 
                if (dirty_max > cli->cl_dirty_max_pages)
                        cli->cl_dirty_max_pages = dirty_max;
index fe8c77b..cd84b54 100644 (file)
@@ -832,7 +832,7 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
                       cli->cl_dirty_pages, cli->cl_dirty_max_pages);
                oa->o_undirty = 0;
        } else {
                       cli->cl_dirty_pages, cli->cl_dirty_max_pages);
                oa->o_undirty = 0;
        } else {
-               long max_in_flight = (cli->cl_max_pages_per_rpc <<
+               unsigned long max_in_flight = (cli->cl_max_pages_per_rpc <<
                                      PAGE_CACHE_SHIFT) *
                                     (cli->cl_max_rpcs_in_flight + 1);
                oa->o_undirty = max(cli->cl_dirty_max_pages << PAGE_CACHE_SHIFT,
                                      PAGE_CACHE_SHIFT) *
                                     (cli->cl_max_rpcs_in_flight + 1);
                oa->o_undirty = max(cli->cl_dirty_max_pages << PAGE_CACHE_SHIFT,
@@ -2045,7 +2045,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
        }
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
        }
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
-       DEBUG_REQ(D_INODE, req, "%d pages, aa %p. now %dr/%dw in flight",
+       DEBUG_REQ(D_INODE, req, "%d pages, aa %p. now %ur/%uw in flight",
                  page_count, aa, cli->cl_r_in_flight,
                  cli->cl_w_in_flight);
 
                  page_count, aa, cli->cl_r_in_flight,
                  cli->cl_w_in_flight);
 
index 03515ca..0383616 100644 (file)
@@ -1930,7 +1930,7 @@ EXPORT_SYMBOL(lustre_swab_mgs_target_info);
 
 void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *entry)
 {
 
 void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *entry)
 {
-        int i;
+       __u8 i;
 
         __swab64s(&entry->mne_version);
         __swab32s(&entry->mne_instance);
 
         __swab64s(&entry->mne_version);
         __swab32s(&entry->mne_instance);
@@ -2032,7 +2032,7 @@ void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent)
 
 void lustre_swab_fiemap(struct ll_user_fiemap *fiemap)
 {
 
 void lustre_swab_fiemap(struct ll_user_fiemap *fiemap)
 {
-        int i;
+       __u32 i;
 
         __swab64s(&fiemap->fm_start);
         __swab64s(&fiemap->fm_length);
 
         __swab64s(&fiemap->fm_start);
         __swab64s(&fiemap->fm_length);
@@ -2571,7 +2571,7 @@ EXPORT_SYMBOL(lustre_swab_hsm_request);
 void lustre_swab_object_update(struct object_update *ou)
 {
        struct object_update_param *param;
 void lustre_swab_object_update(struct object_update *ou)
 {
        struct object_update_param *param;
-       int     i;
+       size_t  i;
 
        __swab16s(&ou->ou_type);
        __swab16s(&ou->ou_params_count);
 
        __swab16s(&ou->ou_type);
        __swab16s(&ou->ou_params_count);
@@ -2593,7 +2593,7 @@ EXPORT_SYMBOL(lustre_swab_object_update);
 
 void lustre_swab_object_update_request(struct object_update_request *our)
 {
 
 void lustre_swab_object_update_request(struct object_update_request *our)
 {
-       int i;
+       size_t i;
        __swab32s(&our->ourq_magic);
        __swab16s(&our->ourq_count);
        __swab16s(&our->ourq_padding);
        __swab32s(&our->ourq_magic);
        __swab16s(&our->ourq_count);
        __swab16s(&our->ourq_padding);
@@ -2618,7 +2618,7 @@ EXPORT_SYMBOL(lustre_swab_object_update_result);
 
 void lustre_swab_object_update_reply(struct object_update_reply *our)
 {
 
 void lustre_swab_object_update_reply(struct object_update_reply *our)
 {
-       int i;
+       size_t i;
 
        __swab32s(&our->ourp_magic);
        __swab16s(&our->ourp_count);
 
        __swab32s(&our->ourp_magic);
        __swab16s(&our->ourp_count);
index 78e55f4..51bdd93 100644 (file)
@@ -250,7 +250,7 @@ static int out_create(struct tgt_session_info *tsi)
        struct lu_attr          *attr = &tti->tti_attr;
        struct lu_fid           *fid = NULL;
        struct obdo             *wobdo;
        struct lu_attr          *attr = &tti->tti_attr;
        struct lu_fid           *fid = NULL;
        struct obdo             *wobdo;
-       int                     size;
+       size_t                  size;
        int                     rc;
 
        ENTRY;
        int                     rc;
 
        ENTRY;
@@ -269,8 +269,6 @@ static int out_create(struct tgt_session_info *tsi)
 
        dof->dof_type = dt_mode_to_dft(attr->la_mode);
        if (update->ou_params_count > 1) {
 
        dof->dof_type = dt_mode_to_dft(attr->la_mode);
        if (update->ou_params_count > 1) {
-               int size;
-
                fid = object_update_param_get(update, 1, &size);
                if (fid == NULL || size != sizeof(*fid)) {
                        CERROR("%s: invalid fid: rc = %d\n",
                fid = object_update_param_get(update, 1, &size);
                if (fid == NULL || size != sizeof(*fid)) {
                        CERROR("%s: invalid fid: rc = %d\n",
@@ -364,7 +362,7 @@ static int out_attr_set(struct tgt_session_info *tsi)
        struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
        struct obdo             *lobdo = &tti->tti_u.update.tti_obdo;
        struct obdo             *wobdo;
        struct dt_object        *obj = tti->tti_u.update.tti_dt_object;
        struct obdo             *lobdo = &tti->tti_u.update.tti_obdo;
        struct obdo             *wobdo;
-       int                      size;
+       size_t                   size;
        int                      rc;
 
        ENTRY;
        int                      rc;
 
        ENTRY;
@@ -622,9 +620,9 @@ static int out_xattr_set(struct tgt_session_info *tsi)
        char                    *name;
        char                    *buf;
        __u32                   *tmp;
        char                    *name;
        char                    *buf;
        __u32                   *tmp;
-       int                      buf_len = 0;
+       size_t                   buf_len = 0;
        int                      flag;
        int                      flag;
-       int                      size = 0;
+       size_t                   size = 0;
        int                      rc;
        ENTRY;
 
        int                      rc;
        ENTRY;
 
@@ -647,7 +645,7 @@ static int out_xattr_set(struct tgt_session_info *tsi)
 
        tmp = object_update_param_get(update, 2, &size);
        if (tmp == NULL || size != sizeof(*tmp)) {
 
        tmp = object_update_param_get(update, 2, &size);
        if (tmp == NULL || size != sizeof(*tmp)) {
-               CERROR("%s: emptry or wrong size %d flag: rc = %d\n",
+               CERROR("%s: emptry or wrong size %zd flag: rc = %d\n",
                       tgt_name(tsi->tsi_tgt), size, -EPROTO);
                RETURN(err_serious(-EPROTO));
        }
                       tgt_name(tsi->tsi_tgt), size, -EPROTO);
                RETURN(err_serious(-EPROTO));
        }
@@ -1005,7 +1003,7 @@ static int out_index_insert(struct tgt_session_info *tsi)
        char                    *name;
        __u32                   *ptype;
        int                      rc     = 0;
        char                    *name;
        __u32                   *ptype;
        int                      rc     = 0;
-       int                      size;
+       size_t                   size;
        ENTRY;
 
        name = object_update_param_get(update, 0, NULL);
        ENTRY;
 
        name = object_update_param_get(update, 0, NULL);
@@ -1264,8 +1262,8 @@ static int out_write(struct tgt_session_info *tsi)
        struct lu_buf           *lbuf = &tti->tti_buf;
        char                    *buf;
        __u64                   *tmp;
        struct lu_buf           *lbuf = &tti->tti_buf;
        char                    *buf;
        __u64                   *tmp;
-       int                     size = 0;
-       int                     buf_len = 0;
+       size_t                  size = 0;
+       size_t                  buf_len = 0;
        loff_t                  pos;
        int                      rc;
        ENTRY;
        loff_t                  pos;
        int                      rc;
        ENTRY;
@@ -1281,7 +1279,7 @@ static int out_write(struct tgt_session_info *tsi)
 
        tmp = object_update_param_get(update, 1, &size);
        if (tmp == NULL || size != sizeof(*tmp)) {
 
        tmp = object_update_param_get(update, 1, &size);
        if (tmp == NULL || size != sizeof(*tmp)) {
-               CERROR("%s: empty or wrong size %d pos: rc = %d\n",
+               CERROR("%s: empty or wrong size %zd pos: rc = %d\n",
                       tgt_name(tsi->tsi_tgt), size, -EPROTO);
                RETURN(err_serious(-EPROTO));
        }
                       tgt_name(tsi->tsi_tgt), size, -EPROTO);
                RETURN(err_serious(-EPROTO));
        }