From patchwork Mon Jun 26 12:09:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9809241 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E20B460209 for ; Mon, 26 Jun 2017 12:15:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6C1928536 for ; Mon, 26 Jun 2017 12:15:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8B2F28584; Mon, 26 Jun 2017 12:15:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D15528536 for ; Mon, 26 Jun 2017 12:15:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752584AbdFZMPd (ORCPT ); Mon, 26 Jun 2017 08:15:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48730 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751485AbdFZMP2 (ORCPT ); Mon, 26 Jun 2017 08:15:28 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 610D3C059727; Mon, 26 Jun 2017 12:15:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 610D3C059727 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ming.lei@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 610D3C059727 Received: from localhost (ovpn-12-86.pek2.redhat.com [10.72.12.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A35F7EA5A; Mon, 26 Jun 2017 12:15:05 +0000 (UTC) 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 v2 15/51] btrfs: comment on direct access bvec table Date: Mon, 26 Jun 2017 20:09:58 +0800 Message-Id: <20170626121034.3051-16-ming.lei@redhat.com> In-Reply-To: <20170626121034.3051-1-ming.lei@redhat.com> References: <20170626121034.3051-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 26 Jun 2017 12:15:17 +0000 (UTC) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org 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 2c0b7b57fcd5..5972f74354ca 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -541,6 +541,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 4ab02b34f029..7e725d84917b 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8055,6 +8055,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; @@ -8146,6 +8152,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));