From patchwork Thu May 18 03:38:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9732421 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 5FB5D6020B for ; Thu, 18 May 2017 03:39:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 406E128797 for ; Thu, 18 May 2017 03:39:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3560428801; Thu, 18 May 2017 03:39:36 +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 D978228797 for ; Thu, 18 May 2017 03:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932223AbdERDje (ORCPT ); Wed, 17 May 2017 23:39:34 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:46077 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932172AbdERDjX (ORCPT ); Wed, 17 May 2017 23:39:23 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="18996765" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 May 2017 11:39:16 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id C2E2347E64DE; Thu, 18 May 2017 11:39:15 +0800 (CST) Received: from localhost.localdomain (10.167.226.34) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 18 May 2017 11:39:15 +0800 From: Qu Wenruo To: , Subject: [PATCH 26/32] btrfs-progs: Refactor sectorsize users in convert/main.c Date: Thu, 18 May 2017 11:38:51 +0800 Message-ID: <20170518033857.15002-27-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170518033857.15002-1-quwenruo@cn.fujitsu.com> References: <20170518033857.15002-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: C2E2347E64DE.A0E95 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com 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 Signed-off-by: Qu Wenruo --- convert/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/convert/main.c b/convert/main.c index c56382e9..bf050132 100644 --- a/convert/main.c +++ b/convert/main.c @@ -159,7 +159,7 @@ static int csum_disk_extent(struct btrfs_trans_handle *trans, struct btrfs_root *root, u64 disk_bytenr, u64 num_bytes) { - u32 blocksize = root->sectorsize; + u32 blocksize = root->fs_info->sectorsize; u64 offset; char *buffer; int ret = 0; @@ -199,12 +199,12 @@ static int create_image_file_range(struct btrfs_trans_handle *trans, int ret; u32 datacsum = convert_flags & CONVERT_FLAG_DATACSUM; - if (bytenr != round_down(bytenr, root->sectorsize)) { + if (bytenr != round_down(bytenr, root->fs_info->sectorsize)) { error("bytenr not sectorsize aligned: %llu", (unsigned long long)bytenr); return -EINVAL; } - if (len != round_down(len, root->sectorsize)) { + if (len != round_down(len, root->fs_info->sectorsize)) { error("length not sectorsize aligned: %llu", (unsigned long long)len); return -EINVAL; @@ -293,7 +293,7 @@ static int create_image_file_range(struct btrfs_trans_handle *trans, bg_cache->key.offset - bytenr); } - if (len != round_down(len, root->sectorsize)) { + if (len != round_down(len, root->fs_info->sectorsize)) { error("remaining length not sectorsize aligned: %llu", (unsigned long long)len); return -EINVAL; @@ -346,7 +346,7 @@ static int migrate_one_reserved_range(struct btrfs_trans_handle *trans, cur_off = max(cache->start, cur_off); cur_len = min(cache->start + cache->size, range_end(range)) - cur_off; - BUG_ON(cur_len < root->sectorsize); + BUG_ON(cur_len < root->fs_info->sectorsize); /* reserve extent for the data */ ret = btrfs_reserve_extent(trans, root, cur_len, 0, 0, (u64)-1, @@ -1011,7 +1011,8 @@ static int make_convert_data_block_groups(struct btrfs_trans_handle *trans, */ max_chunk_size = cfg->num_bytes / 10; max_chunk_size = min((u64)(1024 * 1024 * 1024), max_chunk_size); - max_chunk_size = round_down(max_chunk_size, extent_root->sectorsize); + max_chunk_size = round_down(max_chunk_size, + extent_root->fs_info->sectorsize); for (cache = first_cache_extent(data_chunks); cache; cache = next_cache_extent(cache)) {