]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/kstore: kill dead code 7530/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 5 Feb 2016 09:41:07 +0000 (17:41 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 5 Feb 2016 10:42:03 +0000 (18:42 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/kstore/KStore.cc
src/os/kstore/KStore.h

index 934c702c26c4da0604f2e3eb2bbb1947c5246abc..7de1b16fcf166cb63a614c44ff5abcbc81af512f 100644 (file)
@@ -2797,66 +2797,6 @@ void KStore::_dump_onode(OnodeRef o)
   }
 }
 
-void KStore::_pad_zeros(
-  OnodeRef o,
-  bufferlist *bl, uint64_t *offset, uint64_t *length,
-  uint64_t block_size)
-{
-  dout(40) << "before:\n";
-  bl->hexdump(*_dout);
-  *_dout << dendl;
-  // front
-  size_t front_pad = *offset % block_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);
-    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);
-      memset(z.c_str() + front_pad + *length, 0, back_pad);
-    }
-    bufferlist old, t;
-    old.swap(*bl);
-    t.substr_of(old, front_copy, *length - front_copy);
-    bl->append(z);
-    bl->claim_append(t);
-    *offset -= front_pad;
-    *length += front_pad + back_pad;
-  }
-
-  // back
-  uint64_t end = *offset + *length;
-  unsigned back_copy = end % block_size;
-  if (back_copy) {
-    assert(back_pad == 0);
-    back_pad = block_size - back_copy;
-    assert(back_copy <= *length);
-    bufferptr tail(block_size);
-    memcpy(tail.c_str(), bl->get_contiguous(*length - back_copy, back_copy),
-          back_copy);
-    memset(tail.c_str() + back_copy, 0, back_pad);
-    bufferlist old;
-    old.swap(*bl);
-    bl->substr_of(old, 0, *length - back_copy);
-    bl->append(tail);
-    *length += back_pad;
-    if (end > o->onode.size && g_conf->kstore_cache_tails) {
-      o->tail_bl.clear();
-      o->tail_bl.append(tail, 0, back_copy);
-      o->tail_offset = end - back_copy;
-      dout(20) << __func__ << " cached "<< back_copy << " of tail block at "
-              << o->tail_offset << dendl;
-    }
-  }
-  dout(20) << __func__ << " pad " << front_pad << " + " << back_pad
-          << " on front/back, now " << *offset << "~" << *length << dendl;
-  dout(40) << "after:\n";
-  bl->hexdump(*_dout);
-  *_dout << dendl;
-}
-
 void KStore::_do_read_stripe(OnodeRef o, uint64_t offset, bufferlist *pbl)
 {
   map<uint64_t,bufferlist>::iterator p = o->pending_stripes.find(offset);
index 13b12e84432b5b6c5b94593c1b228a14125fca56..07104362d440b89e22b445a97fd339ac82dfa9fb 100644 (file)
@@ -522,8 +522,6 @@ private:
             uint64_t offset, size_t len,
             bufferlist& bl,
             uint32_t fadvise_flags);
-  void _pad_zeros(OnodeRef o, bufferlist *bl, uint64_t *offset, uint64_t *length,
-                 uint64_t block_size);
   int _do_write(TransContext *txc,
                OnodeRef o,
                uint64_t offset, uint64_t length,