From: xie xingguo Date: Fri, 5 Feb 2016 09:41:07 +0000 (+0800) Subject: os/kstore: kill dead code X-Git-Tag: v10.0.4~33^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=23d39cbc252bddb45a307ed439bf65d7432c0b10;p=ceph.git os/kstore: kill dead code Signed-off-by: xie xingguo --- diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 934c702c26c4..7de1b16fcf16 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -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::iterator p = o->pending_stripes.find(offset); diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index 13b12e84432b..07104362d440 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -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,