]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix signed/unsigned warnings in preadv code
authorSage Weil <sage@redhat.com>
Fri, 19 Jun 2015 00:45:37 +0000 (17:45 -0700)
committerKefu Chai <kchai@redhat.com>
Wed, 1 Jul 2015 09:12:25 +0000 (17:12 +0800)
Fixes: #12120
Signed-off-by: Sage Weil <sage@redhat.com>
src/client/Client.cc
src/client/Client.h

index 17d191331d9180d764cf5ada788783335d0b7780..28fefb610c8626c188566723c0f928d1dec61a38 100644 (file)
@@ -7461,7 +7461,7 @@ int Client::pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset)
     return _preadv_pwritev(fd, iov, iovcnt, offset, true); 
 }
 
-int Client::_preadv_pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset, bool write)
+int Client::_preadv_pwritev(int fd, const struct iovec *iov, unsigned iovcnt, int64_t offset, bool write)
 {
     Mutex::Locker lock(client_lock);
     tout(cct) << fd << std::endl;
@@ -7475,7 +7475,7 @@ int Client::_preadv_pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t
         return -EBADF;
 #endif
     loff_t totallen = 0;
-    for (int i = 0; i < iovcnt; i++) {
+    for (unsigned i = 0; i < iovcnt; i++) {
         totallen += iov[i].iov_len;
     }
     if (write) {
@@ -7487,8 +7487,7 @@ int Client::_preadv_pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t
         int r = _read(fh, offset, totallen, &bl);
         ldout(cct, 3) << "preadv(" << fd << ", " <<  offset << ") = " << r << dendl;
         int bufoff = 0;
-        uint32_t rlen = 0;
-        for (int j = 0, resid = r; j < iovcnt && resid > 0; j++) {
+        for (unsigned j = 0, resid = r; j < iovcnt && resid > 0; j++) {
                /*
                 * This piece of code aims to handle the case that bufferlist does not have enough data 
                 * to fill in the iov 
index a1ad18c417cd74c9e8436cf6e65c8ddb2faddf43..cc9a5acdb231fdb18c9770ad8def8b24cd492b9d 100644 (file)
@@ -680,7 +680,7 @@ private:
   int _read(Fh *fh, int64_t offset, uint64_t size, bufferlist *bl);
   int _write(Fh *fh, int64_t offset, uint64_t size, const char *buf,
           const struct iovec *iov, int iovcnt);
-  int _preadv_pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset, bool write);
+  int _preadv_pwritev(int fd, const struct iovec *iov, unsigned iovcnt, int64_t offset, bool write);
   int _flush(Fh *fh);
   int _fsync(Fh *fh, bool syncdataonly);
   int _sync_fs();