From de9cfcaa7d12741a87696db74eed90ef9457b8d3 Mon Sep 17 00:00:00 2001 From: Haomai Wang Date: Sun, 27 Jul 2014 13:37:49 +0800 Subject: [PATCH] Only write bufferhead when it's dirty The TX state bh should be skipped because the bh should be inflight. We only need to write dirty bh. And TX and dirty state bh both should be waited until flushed. Signed-off-by: Haomai Wang --- src/osdc/ObjectCacher.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index ed18adc7e854..e7dfe18bb060 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -1621,7 +1621,10 @@ bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish) next++; BufferHead *bh = *it; waitfor_commit.insert(bh->ob); - bh_write(bh); + + if (bh->is_dirty()) + bh_write(bh); + it = next; } -- 2.47.3