From: Sage Weil Date: Mon, 21 Mar 2016 19:44:54 +0000 (-0400) Subject: os/bluestore: note txc seq for tail cache X-Git-Tag: v10.1.1~28^2~20 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5cf66693a6df98ac425901c9c53fbb2797bc46ab;p=ceph.git os/bluestore: note txc seq for tail cache We'll need this soon... Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 9045fffac23f..16464cdf419e 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -4943,6 +4943,7 @@ void BlueStore::_dump_onode(OnodeRef o, int log_level) } void BlueStore::_pad_zeros( + TransContext *txc, OnodeRef o, bufferlist *bl, uint64_t *offset, uint64_t *length, uint64_t block_size) @@ -4991,6 +4992,7 @@ void BlueStore::_pad_zeros( o->tail_bl.clear(); o->tail_bl.append(tail, 0, back_copy); o->tail_offset = end - back_copy; + o->tail_txc_seq = txc->seq; dout(20) << __func__ << " cached "<< back_copy << " of tail block at " << o->tail_offset << dendl; } @@ -5037,6 +5039,7 @@ void BlueStore::_pad_zeros_head( } void BlueStore::_pad_zeros_tail( + TransContext *txc, OnodeRef o, bufferlist *bl, uint64_t offset, uint64_t *length, uint64_t block_size) @@ -5073,6 +5076,7 @@ void BlueStore::_pad_zeros_tail( o->tail_bl.clear(); o->tail_bl.append(tail, 0, back_copy); o->tail_offset = end - back_copy; + o->tail_txc_seq = txc->seq; dout(20) << __func__ << " cached "<< back_copy << " of tail block at " << o->tail_offset << dendl; } @@ -5496,7 +5500,7 @@ int BlueStore::_do_write( offset >= o->onode.size && // past eof + (offset / block_size != (o->onode.size - 1) / block_size)) {// diff block dout(20) << __func__ << " append" << dendl; - _pad_zeros(o, &bl, &offset, &length, block_size); + _pad_zeros(txc, o, &bl, &offset, &length, block_size); assert(offset % block_size == 0); assert(length % block_size == 0); uint64_t x_off = offset - bp->first; @@ -5565,7 +5569,7 @@ int BlueStore::_do_write( offset == bp->first); bp->second.clear_flag(bluestore_extent_t::FLAG_COW_HEAD); bp->second.clear_flag(bluestore_extent_t::FLAG_UNWRITTEN); - _pad_zeros(o, &bl, &offset, &length, block_size); + _pad_zeros(txc, o, &bl, &offset, &length, block_size); uint64_t x_off = offset - bp->first; dout(20) << __func__ << " write " << offset << "~" << length << " x_off " << x_off << dendl; @@ -5609,7 +5613,7 @@ int BlueStore::_do_write( _pad_zeros_head(o, &bl, &offset, &length, block_size); } if (((offset + length) & ~block_mask) != 0 && !cow_rmw_tail) { - _pad_zeros_tail(o, &bl, offset, &length, block_size); + _pad_zeros_tail(txc, o, &bl, offset, &length, block_size); } if ((offset & ~block_mask) == 0 && (length & ~block_mask) == 0) { uint64_t x_off = offset - bp->first; @@ -5643,7 +5647,7 @@ int BlueStore::_do_write( } else if (((offset + length) & ~block_mask) && offset + length > o->onode.size) { dout(20) << __func__ << " past eof, padding out tail block" << dendl; - _pad_zeros_tail(o, &bl, offset, &length, block_size); + _pad_zeros_tail(txc, o, &bl, offset, &length, block_size); } bp->second.clear_flag(bluestore_extent_t::FLAG_COW_HEAD); bp->second.clear_flag(bluestore_extent_t::FLAG_COW_TAIL); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index d21dc05ed194..ffd48fc639cf 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -136,7 +136,8 @@ public: std::condition_variable flush_cond; ///< wait here for unapplied txns set flush_txns; ///< committing or wal txns - uint64_t tail_offset; + uint64_t tail_offset = 0; + uint64_t tail_txc_seq = 0; bufferlist tail_bl; Onode(const ghobject_t& o, const string& k) @@ -842,12 +843,14 @@ private: int _do_write_overlays(TransContext *txc, CollectionRef& c, OnodeRef o, uint64_t offset, uint64_t length); void _do_read_all_overlays(bluestore_wal_op_t& wo); - void _pad_zeros(OnodeRef o, bufferlist *bl, uint64_t *offset, uint64_t *length, + void _pad_zeros(TransContext *txc, + OnodeRef o, bufferlist *bl, uint64_t *offset, uint64_t *length, uint64_t block_size); void _pad_zeros_head(OnodeRef o, bufferlist *bl, uint64_t *offset, uint64_t *length, uint64_t block_size); - void _pad_zeros_tail(OnodeRef o, bufferlist *bl, + void _pad_zeros_tail(TransContext *txc, + OnodeRef o, bufferlist *bl, uint64_t offset, uint64_t *length, uint64_t block_size); int _do_allocate(TransContext *txc,