Whamcloud - gitweb
LU-4629 osc: remove constant checks 48/9348/5
authorDmitry Eremin <dmitry.eremin@intel.com>
Fri, 21 Feb 2014 16:01:28 +0000 (20:01 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 6 May 2014 03:28:57 +0000 (03:28 +0000)
Comparison of unsigned value against 0 is always true or false

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ib03cd9e401d006cce5a8a2f49220458941d2ef19
Reviewed-on: http://review.whamcloud.com/9348
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/liblustre/rw.c
lustre/osc/osc_cache.c
lustre/utils/gss/svcgssd_proc.c

index 54c6eaf..6c175b6 100644 (file)
@@ -182,18 +182,17 @@ static int llu_file_rwx(struct inode *ino,
                         struct ioctx *ioctx,
                         int read)
 {
                         struct ioctx *ioctx,
                         int read)
 {
-        struct llu_io_session *session;
-        ssize_t cc;
-        int cmd = read ? OBD_BRW_READ : OBD_BRW_WRITE;
-        ENTRY;
+       struct llu_io_session *session;
+       ssize_t cc;
+       int cmd = read ? OBD_BRW_READ : OBD_BRW_WRITE;
+       ENTRY;
 
 
-        LASSERT(ioctx->ioctx_xtvlen >= 0);
-        LASSERT(ioctx->ioctx_iovlen >= 0);
+       LASSERT(ioctx->ioctx_iovlen > 0);
 
 
-        liblustre_wait_event(0);
+       liblustre_wait_event(0);
 
 
-        if (!ioctx->ioctx_xtvlen)
-                RETURN(0);
+       if (ioctx->ioctx_xtvlen == 0)
+               RETURN(0);
 
         /* XXX consider other types later */
         if (S_ISDIR(llu_i2stat(ino)->st_mode))
 
         /* XXX consider other types later */
         if (S_ISDIR(llu_i2stat(ino)->st_mode))
index 75f58fe..7c47536 100644 (file)
@@ -1788,9 +1788,9 @@ static void osc_process_ar(struct osc_async_rc *ar, __u64 xid,
  * involved in the bulk transfer are no longer considered unstable. */
 void osc_dec_unstable_pages(struct ptlrpc_request *req)
 {
  * involved in the bulk transfer are no longer considered unstable. */
 void osc_dec_unstable_pages(struct ptlrpc_request *req)
 {
-       struct ptlrpc_bulk_desc *desc       = req->rq_bulk;
-       struct client_obd       *cli        = &req->rq_import->imp_obd->u.cli;
-       obd_count                page_count = desc->bd_iov_count;
+       struct ptlrpc_bulk_desc *desc       = req->rq_bulk;
+       struct client_obd       *cli        = &req->rq_import->imp_obd->u.cli;
+       int                      page_count = desc->bd_iov_count;
        int i;
 
        /* No unstable page tracking */
        int i;
 
        /* No unstable page tracking */
@@ -1817,9 +1817,9 @@ void osc_dec_unstable_pages(struct ptlrpc_request *req)
 /* "unstable" page accounting. See: osc_dec_unstable_pages. */
 void osc_inc_unstable_pages(struct ptlrpc_request *req)
 {
 /* "unstable" page accounting. See: osc_dec_unstable_pages. */
 void osc_inc_unstable_pages(struct ptlrpc_request *req)
 {
-       struct ptlrpc_bulk_desc *desc = req->rq_bulk;
-       struct client_obd       *cli  = &req->rq_import->imp_obd->u.cli;
-       obd_count                page_count = desc->bd_iov_count;
+       struct ptlrpc_bulk_desc *desc       = req->rq_bulk;
+       struct client_obd       *cli        = &req->rq_import->imp_obd->u.cli;
+       int                      page_count = desc->bd_iov_count;
        int i;
 
        /* No unstable page tracking */
        int i;
 
        /* No unstable page tracking */
index 6a1fe4e..22f2f17 100644 (file)
@@ -487,6 +487,7 @@ handle_nullreq(FILE *f) {
        gss_cred_id_t           svc_cred;
        u_int32_t               maj_stat = GSS_S_FAILURE, min_stat = 0;
        u_int32_t               ignore_min_stat;
        gss_cred_id_t           svc_cred;
        u_int32_t               maj_stat = GSS_S_FAILURE, min_stat = 0;
        u_int32_t               ignore_min_stat;
+       int                     get_len;
        struct svc_cred         cred;
        static char             *lbuf = NULL;
        static int              lbuflen = 0;
        struct svc_cred         cred;
        static char             *lbuf = NULL;
        static int              lbuflen = 0;
@@ -508,21 +509,27 @@ handle_nullreq(FILE *f) {
        printerr(2, "handling req: svc %u, nid %016llx, idx %llx\n",
                 lustre_svc, nid, handle_seq);
 
        printerr(2, "handling req: svc %u, nid %016llx, idx %llx\n",
                 lustre_svc, nid, handle_seq);
 
-       in_handle.length = (size_t) qword_get(&cp, in_handle.value,
-                                             sizeof(in_handle_buf));
-       printerr(3, "in_handle: \n");
-       print_hexl(3, in_handle.value, in_handle.length);
+       get_len = qword_get(&cp, in_handle.value, sizeof(in_handle_buf));
+       if (get_len < 0) {
+               printerr(0, "WARNING: handle_nullreq: "
+                           "failed parsing request\n");
+               goto out_err;
+       }
+       in_handle.length = (size_t)get_len;
 
 
-       in_tok.length = (size_t) qword_get(&cp, in_tok.value,
-                                          sizeof(in_tok_buf));
-       printerr(3, "in_tok: \n");
-       print_hexl(3, in_tok.value, in_tok.length);
+       printerr(3, "in_handle:\n");
+       print_hexl(3, in_handle.value, in_handle.length);
 
 
-       if (in_tok.length < 0) {
+       get_len = qword_get(&cp, in_tok.value, sizeof(in_tok_buf));
+       if (get_len < 0) {
                printerr(0, "WARNING: handle_nullreq: "
                            "failed parsing request\n");
                goto out_err;
        }
                printerr(0, "WARNING: handle_nullreq: "
                            "failed parsing request\n");
                goto out_err;
        }
+       in_tok.length = (size_t)get_len;
+
+       printerr(3, "in_tok:\n");
+       print_hexl(3, in_tok.value, in_tok.length);
 
        if (in_handle.length != 0) { /* CONTINUE_INIT case */
                if (in_handle.length != sizeof(ctx)) {
 
        if (in_handle.length != 0) { /* CONTINUE_INIT case */
                if (in_handle.length != sizeof(ctx)) {