Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752600AbdHHIsb (ORCPT ); Tue, 8 Aug 2017 04:48:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45306 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752170AbdHHIs2 (ORCPT ); Tue, 8 Aug 2017 04:48:28 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 07201356F0 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ming.lei@redhat.com From: Ming Lei To: Jens Axboe , Christoph Hellwig , Huang Ying , Andrew Morton , Alexander Viro Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Ming Lei , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH v3 13/49] btrfs: comment on direct access bvec table Date: Tue, 8 Aug 2017 16:45:12 +0800 Message-Id: <20170808084548.18963-14-ming.lei@redhat.com> In-Reply-To: <20170808084548.18963-1-ming.lei@redhat.com> References: <20170808084548.18963-1-ming.lei@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 08 Aug 2017 08:48:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1797 Lines: 58 Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Acked: David Sterba Signed-off-by: Ming Lei --- fs/btrfs/compression.c | 4 ++++ fs/btrfs/inode.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index d2ef9ac2a630..f795d0a6d176 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -542,6 +542,10 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, /* we need the actual starting offset of this extent in the file */ read_lock(&em_tree->lock); + /* + * It is still safe to retrieve the 1st page of the bio + * in this way after supporting multipage bvec. + */ em = lookup_extent_mapping(em_tree, page_offset(bio->bi_io_vec->bv_page), PAGE_SIZE); diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5cf320ee7ea0..084ed99dd308 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8051,6 +8051,12 @@ static void btrfs_retry_endio_nocsum(struct bio *bio) if (bio->bi_status) goto end; + /* + * WARNING: + * + * With multipage bvec, the following way of direct access to + * bvec table is only safe if the bio includes single page. + */ ASSERT(bio->bi_vcnt == 1); io_tree = &BTRFS_I(inode)->io_tree; failure_tree = &BTRFS_I(inode)->io_failure_tree; @@ -8143,6 +8149,12 @@ static void btrfs_retry_endio(struct bio *bio) uptodate = 1; + /* + * WARNING: + * + * With multipage bvec, the following way of direct access to + * bvec table is only safe if the bio includes single page. + */ ASSERT(bio->bi_vcnt == 1); ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(done->inode)); -- 2.9.4