From patchwork Wed Apr 27 10:02:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 735661 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3RD5c4X010374 for ; Wed, 27 Apr 2011 13:06:01 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3RA31X7014752; Wed, 27 Apr 2011 06:03:01 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3RA30XF026388 for ; Wed, 27 Apr 2011 06:03:00 -0400 Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.16]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3RA2t4S018309; Wed, 27 Apr 2011 06:02:55 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3RA2lCf002514; Wed, 27 Apr 2011 06:02:47 -0400 Received: from hch by bombadil.infradead.org with local (Exim 4.72 #1 (Red Hat Linux)) id 1QF1a2-0005tH-LH; Wed, 27 Apr 2011 10:02:46 +0000 Date: Wed, 27 Apr 2011 06:02:46 -0400 From: Christoph Hellwig To: device-mapper development Message-ID: <20110427100246.GA22521@infradead.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html X-RedHat-Spam-Score: -5.01 (RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.16 X-loop: dm-devel@redhat.com Cc: ejt@redhat.com Subject: [dm-devel] [PATCH] dm-thinp: fix REQ_FLUSH semantics X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 27 Apr 2011 13:06:02 +0000 (UTC) REQ_FLUSH means the metadata needs to be flushed before the data payload (if there is one), not after it. And yes, this means the typical REQ_FUA|REQ_FLUSH requests imply two flushes. Signed-off-by: Christoph Hellwig --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/drivers/md/dm-thin-prov.c =================================================================== --- linux-2.6.orig/drivers/md/dm-thin-prov.c 2011-04-27 11:45:50.957995412 +0200 +++ linux-2.6/drivers/md/dm-thin-prov.c 2011-04-27 11:45:56.954629592 +0200 @@ -229,6 +229,14 @@ static void do_bios(struct thinp_c *tc, block_t thinp_block, pool_block; while ((bio = bio_list_pop(bios))) { + if (bio->bi_rw & REQ_FLUSH) { + r = commit(tc); + if (r < 0) { + bio_io_error(bio); + continue; + } + } + thinp_block = _sector_to_block(tc, bio->bi_sector); r = thinp_metadata_lookup(tc->tpm, thinp_block, 1, &pool_block); if (r == -ENODATA) { @@ -258,7 +266,7 @@ static void do_bios(struct thinp_c *tc, * whether the overhead of tracking pending blocks * is worth it though. */ - if ((bio->bi_rw & (REQ_FUA | REQ_FLUSH))) { + if (bio->bi_rw & REQ_FUA) { r = commit(tc); if (r < 0) { bio_io_error(bio);