]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: change block_size -> chunk_size for _pad_zero* methods
authorSage Weil <sage@redhat.com>
Thu, 12 May 2016 17:28:09 +0000 (13:28 -0400)
committerSage Weil <sage@redhat.com>
Wed, 1 Jun 2016 15:38:47 +0000 (11:38 -0400)
The granularity is not the same as block_size.. depends on what the caller
wants.  Use a more generic name.

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

index e5d632b7c146c59324148460d3d2d5fd6348f6f6..bd04d00c7ef4ddb13185cf9cdddc056b86d8009d 100644 (file)
@@ -5061,21 +5061,21 @@ void BlueStore::_pad_zeros(
   TransContext *txc,
   OnodeRef o,
   bufferlist *bl, uint64_t *offset, uint64_t *length,
-  uint64_t block_size)
+  uint64_t chunk_size)
 {
   dout(40) << "before:\n";
   bl->hexdump(*_dout);
   *_dout << dendl;
   // front
-  size_t front_pad = *offset % block_size;
+  size_t front_pad = *offset % chunk_size;
   size_t back_pad = 0;
   if (front_pad) {
-    size_t front_copy = MIN(block_size - front_pad, *length);
-    bufferptr z = buffer::create_page_aligned(block_size);
+    size_t front_copy = MIN(chunk_size - front_pad, *length);
+    bufferptr z = buffer::create_page_aligned(chunk_size);
     memset(z.c_str(), 0, front_pad);
     memcpy(z.c_str() + front_pad, bl->get_contiguous(0, front_copy), front_copy);
-    if (front_copy + front_pad < block_size) {
-      back_pad = block_size - (*length + front_pad);
+    if (front_copy + front_pad < chunk_size) {
+      back_pad = chunk_size - (*length + front_pad);
       memset(z.c_str() + front_pad + *length, 0, back_pad);
     }
     bufferlist old, t;
@@ -5089,12 +5089,12 @@ void BlueStore::_pad_zeros(
 
   // back
   uint64_t end = *offset + *length;
-  unsigned back_copy = end % block_size;
+  unsigned back_copy = end % chunk_size;
   if (back_copy) {
     assert(back_pad == 0);
-    back_pad = block_size - back_copy;
+    back_pad = chunk_size - back_copy;
     assert(back_copy <= *length);
-    bufferptr tail(block_size);
+    bufferptr tail(chunk_size);
     memcpy(tail.c_str(), bl->get_contiguous(*length - back_copy, back_copy),
           back_copy);
     memset(tail.c_str() + back_copy, 0, back_pad);
@@ -5123,19 +5123,19 @@ void BlueStore::_pad_zeros(
 void BlueStore::_pad_zeros_head(
   OnodeRef o,
   bufferlist *bl, uint64_t *offset, uint64_t *length,
-  uint64_t block_size)
+  uint64_t chunk_size)
 {
   dout(40) << "before:\n";
   bl->hexdump(*_dout);
   *_dout << dendl;
-  size_t front_pad = *offset % block_size;
+  size_t front_pad = *offset % chunk_size;
   assert(front_pad);  // or we wouldn't have been called
-  size_t front_copy = MIN(block_size - front_pad, *length);
+  size_t front_copy = MIN(chunk_size - front_pad, *length);
   bufferptr z;
-  if (front_copy + front_pad < block_size)
+  if (front_copy + front_pad < chunk_size)
     z = buffer::create(front_copy + front_pad);
   else
-    z = buffer::create_page_aligned(block_size);
+    z = buffer::create_page_aligned(chunk_size);
   memset(z.c_str(), 0, front_pad);
   memcpy(z.c_str() + front_pad, bl->get_contiguous(0, front_copy), front_copy);
   bufferlist old, t;
@@ -5159,7 +5159,7 @@ void BlueStore::_pad_zeros_tail(
   TransContext *txc,
   OnodeRef o,
   bufferlist *bl, uint64_t offset, uint64_t *length,
-  uint64_t block_size)
+  uint64_t chunk_size)
 {
   dout(40) << "before:\n";
   bl->hexdump(*_dout);
@@ -5167,16 +5167,16 @@ void BlueStore::_pad_zeros_tail(
 
   // back
   uint64_t end = offset + *length;
-  unsigned back_copy = end % block_size;
+  unsigned back_copy = end % chunk_size;
   assert(back_copy);  // or we wouldn't have been called
   uint64_t tail_len;
   if (back_copy <= *length) {
     // we start at or before the block boundary
-    tail_len = block_size;
+    tail_len = chunk_size;
   } else {
     // we start partway into the tail block
     back_copy = *length;
-    tail_len = block_size - (offset % block_size);
+    tail_len = chunk_size - (offset % chunk_size);
   }
   uint64_t back_pad = tail_len - back_copy;
   bufferptr tail(tail_len);
@@ -5188,7 +5188,7 @@ void BlueStore::_pad_zeros_tail(
   bl->substr_of(old, 0, *length - back_copy);
   bl->append(tail);
   *length += back_pad;
-  if (tail_len == block_size &&
+  if (tail_len == chunk_size &&
       end >= o->onode.size && g_conf->bluestore_cache_tails) {
     o->tail_bl.clear();
     o->tail_bl.append(tail, 0, back_copy);
index 15a40e3adc8b699f31bc9a0fb5bf2ecbcbcabe90..6aa260ee4140fc7c39ccb034434efc53696a828d 100644 (file)
@@ -913,14 +913,14 @@ private:
   void _do_read_all_overlays(bluestore_wal_op_t& wo);
   void _pad_zeros(TransContext *txc,
                  OnodeRef o, bufferlist *bl, uint64_t *offset, uint64_t *length,
-                 uint64_t block_size);
+                 uint64_t chunk_size);
   void _pad_zeros_head(OnodeRef o, bufferlist *bl,
                       uint64_t *offset, uint64_t *length,
-                      uint64_t block_size);
+                      uint64_t chunk_size);
   void _pad_zeros_tail(TransContext *txc,
                       OnodeRef o, bufferlist *bl,
                       uint64_t offset, uint64_t *length,
-                      uint64_t block_size);
+                      uint64_t chunk_size);
   int _do_allocate(TransContext *txc,
                   CollectionRef& c,
                   OnodeRef o,