]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: remove useless IOContext::num_reading 14956/head
authorSage Weil <sage@redhat.com>
Fri, 5 May 2017 18:39:18 +0000 (14:39 -0400)
committerSage Weil <sage@redhat.com>
Fri, 5 May 2017 18:39:30 +0000 (14:39 -0400)
If we are a syncrhonous read, we don't need this: we don't aio_wait for
sync reads.  If we are an aio_read, we are in the aio_running count anyway,
and there is also no purpose for this counter.

I'm a bit unsure about the NVME use of this counter; I switched it to use
num_running (pretty sure we aren't mixing reads and writes on a single
IOContext) *but* it might make more sense to switch to a private counter.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlockDevice.cc
src/os/bluestore/BlockDevice.h
src/os/bluestore/KernelDevice.cc
src/os/bluestore/NVMEDevice.cc

index 751db6d8a2c85c8b3cdac5c81ffcbcc758de0e41..cdc13ff3637425bcecd81fa4672ec9ac42be0a95 100644 (file)
@@ -34,10 +34,10 @@ void IOContext::aio_wait()
 {
   std::unique_lock<std::mutex> l(lock);
   // see _aio_thread for waker logic
-  while (num_running.load() > 0 || num_reading.load() > 0) {
+  while (num_running.load() > 0) {
     dout(10) << __func__ << " " << this
-            << " waiting for " << num_running.load() << " aios and/or "
-            << num_reading.load() << " readers to complete" << dendl;
+            << " waiting for " << num_running.load() << " aios to complete"
+            << dendl;
     cond.wait(l);
   }
   dout(20) << __func__ << " " << this << " done" << dendl;
index 3057c00e0e8d1ebde00c3753d6a817d7d36f486c..54d284061cf5394331ea8414ce051c53c6defc12 100644 (file)
@@ -43,7 +43,6 @@ struct IOContext {
   std::list<aio_t> running_aios;    ///< submitting or submitted
   std::atomic_int num_pending = {0};
   std::atomic_int num_running = {0};
-  std::atomic_int num_reading = {0};
 
   explicit IOContext(CephContext* cct, void *p)
     : cct(cct), priv(p)
index 2092d88f736338e9de7d4636edaba2a9e9a2eee0..9f4ba718c03b91f1a31eaff86914d9f25f839187 100644 (file)
@@ -629,7 +629,6 @@ int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
   assert(off + len <= size);
 
   _aio_log_start(ioc, off, len);
-  ++ioc->num_reading;
 
   bufferptr p = buffer::create_page_aligned(len);
   int r = ::pread(buffered ? fd_buffered : fd_direct,
@@ -647,7 +646,6 @@ int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
 
  out:
   _aio_log_finish(ioc, off, len);
-  --ioc->num_reading;
   return r < 0 ? r : 0;
 }
 
index 5f5264395c425b60e707c6f7528dc5dccbf31930..2ea4eec3350824e6262c94e5f73649f5f08e6cd2 100644 (file)
@@ -846,7 +846,7 @@ void io_complete(void *t, const struct spdk_nvme_cpl *completion)
       delete task;
     } else {
       task->return_code = 0;
-      if(!--ctx->num_reading) {
+      if (!--ctx->num_running) {
         task->io_wake();
       }
     }
@@ -1052,7 +1052,7 @@ int NVMEDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
   t->fill_cb = [buf, t]() {
     t->copy_to_buf(buf, 0, t->len);
   };
-  ++ioc->num_reading;
+  ++ioc->num_running;
   if(queue_id == -1)
     queue_id = ceph_gettid();
   driver->get_queue(queue_id)->queue_task(t);
@@ -1118,7 +1118,7 @@ int NVMEDevice::read_random(uint64_t off, uint64_t len, char *buf, bool buffered
   t->fill_cb = [buf, t, off, len]() {
     t->copy_to_buf(buf, off-t->offset, len);
   };
-  ++ioc.num_reading;
+  ++ioc.num_running;
   if(queue_id == -1)
     queue_id = ceph_gettid();
   driver->get_queue(queue_id)->queue_task(t);