From patchwork Tue Sep 11 22:34:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10596433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB689112B for ; Tue, 11 Sep 2018 22:35:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAC6229C45 for ; Tue, 11 Sep 2018 22:35:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF31129DEA; Tue, 11 Sep 2018 22:35:28 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 389CC29C45 for ; Tue, 11 Sep 2018 22:35:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 602FB8E0017; Tue, 11 Sep 2018 18:35:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5D9C28E0001; Tue, 11 Sep 2018 18:35:19 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42EAA8E0017; Tue, 11 Sep 2018 18:35:19 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 0163D8E0001 for ; Tue, 11 Sep 2018 18:35:18 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id j15-v6so13409295pff.12 for ; Tue, 11 Sep 2018 15:35:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=eji+HpPcmaKQpBHrFlLfdnHI7xruaaDZ0YEYbzrJ3TE=; b=NL0a02MYgsgi5m2F71L+ZzOIaX1H++5lM5q/hYwJijhDjE1ITMwQ/HADcW4sbQrtco Y3OL7h3tNaSPNvIkkrKuqvkyOtpTrnQ06QmOMmO/6PlbckG3o30aFbqj8Zgrcx5HoaZW F3y9K32lOHw/s36ndo86hS37mpYRtp/OZpEB2mJTWPNqcsgkzEk2XoIjbzqczz9RUPoZ WIfnePwwgmpvLWJIdXpdRt8Bj1DNw1G2Wg9RnxMFVkNP4F5SupQ3x2PX2nHkXFmbiDwX J47U+q8sC9xvjEDwGmSBjL6+2w9BTIhikbKtonLjWZubmKysj3MGBTwY2Usayy0Z7GBI kdJw== X-Gm-Message-State: APzg51BhRQcV7Whkgu4WvuM7O9+sCDaMTwZJDceHGIrcaRTtDq3hwICX u2SWcYWnZw8piz8XIwI55+uzKh2tAoEr3ZrIsLHvY1XQDRaSwuE7scEUg3DvvPsCA2RAgN/wJmy QB8y0xQ6iCqo1NgXQKf5DSYHLWtQz5WVxv9J0Hv8AG/5ARx/iW0qoOTUaq2H73A5I7sR04g5hLM 2ol7Q7xnkn8uh4nN+Je75750a3yc7fS9LYSHvv7dciNoEyfTuXPyvdDTwTdwmJs/UoezdhyEEnc G1TUSdyFQR1JMqtCPKkXFri+VqpOlzqUFhYyFGdqb0tF+pF0J0x4Y0zHk8IfL2xWkx6gLfM4AVN WoeQE169thMpwjJqgdOGK2fA9IVRD1Dr0vlEb8UahJfMBPp2boFZHS3An66fOvBxKqudnV3NhJ3 T X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr31975582pfa.238.1536705318648; Tue, 11 Sep 2018 15:35:18 -0700 (PDT) X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr31975533pfa.238.1536705317751; Tue, 11 Sep 2018 15:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536705317; cv=none; d=google.com; s=arc-20160816; b=XDtkkJUVUzKY0Dolrk7e89xO3/SZB0Q2vhE9M3AvEh+iJBpJ7c9EHBb93F4sJ4ZYMh P/nPNkhzRejs4SY0qGcL2gZuR4lDMIXWx60LLN5pANiHRsvRJLQQXhvj+Mzd2aIdcgOp aH4trsWLpeX1SzDa2YxPlM79ba6YP4igjx/2aooLpHRMee06ihhu1kze9WG6Pt7pffXY Bj2xD6dUtcy8w2uH1MLFqHlDxD75vBx7NKjt10k+qhahoJqlvEnqkJXvyijZmgz96gsI T5l0G/HW7cDQ9enhGqHJtPY6yNRX4GghmUZiyQ/wh3gyRwDoqsUpmR4DscLDEJT96ETl xeaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eji+HpPcmaKQpBHrFlLfdnHI7xruaaDZ0YEYbzrJ3TE=; b=i6bytbWkJaGIvpm30HBjvsBRsCK9ltxTFgX4l4HaoAMRlxbmsA3GiD47nqqcVkcWdd B24gKReudAgcTbrIpMZCjQu3pncIm00pADFR6tUyuWFXOzbhycqod0uKOSkLR3aTJtsp /2K9YxSkS0rFhzmkmPnsHh/8KrlAG+6pFy/fdC14aQbVpvLXSY3g/auqNVXFHRGy91sz JxNCTcogb5fsdo4eHCWjClH7uVAPylMpIjS56RH/OnMoh2vk/2tCHKOoRVyNb1AG+P4w f7HirC5I6+rpOZF7ZFj20wMB/u0plvZZ1hysR8t7Cb1j0mxt2sFF9YjBJiLQicUPnz5G /Ptg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=V6JaV0kM; spf=neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of osandov@osandov.com) smtp.mailfrom=osandov@osandov.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y7-v6sor3209868pgc.197.2018.09.11.15.35.17 for (Google Transport Security); Tue, 11 Sep 2018 15:35:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of osandov@osandov.com) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=V6JaV0kM; spf=neutral (google.com: 209.85.220.65 is neither permitted nor denied by best guess record for domain of osandov@osandov.com) smtp.mailfrom=osandov@osandov.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eji+HpPcmaKQpBHrFlLfdnHI7xruaaDZ0YEYbzrJ3TE=; b=V6JaV0kMK2tUvcr/p+bxP1cESa3Nt9KfHZhwqy5KkjzNq+F58q7pT2Q342T0Z+ao4M TiAlT4ETJ4boBoLytop3fcL1qCFW5NIPsNdkzzzjXOTwYrEZCnMyfQXPzUz7n9RjiYet rg6/bcxHr4HiYoKST4ByRBzCziFOQigPWn3mBrG1cN7M5ldgph4r0ilQEbOsnvYXWQEt D5pP7KTj7H9Tf6ypifSokPSEPSM5RcSvYzmudE3hFWZpt5DZR/zQpAJknpkinkLlZyVc 1AhNajcoc4Ly/9WLDLEuYO7dUBZ6z9YY1us+CytjFxYY30xC3/KUD/vwp6L2a5SwraZB Wcvg== X-Google-Smtp-Source: ANB0VdbwL2JgvT1bTyhH/OUKtdNZ9mhxUqBIFjv/LfssMXIQieTiQV6WdOoGP9fq3XXMBky0Ff59yg== X-Received: by 2002:a63:b54:: with SMTP id a20-v6mr30884091pgl.280.1536705317160; Tue, 11 Sep 2018 15:35:17 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::7:13b4]) by smtp.gmail.com with ESMTPSA id 186-v6sm18710176pgg.56.2018.09.11.15.35.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 15:35:16 -0700 (PDT) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com, linux-mm@kvack.org Subject: [PATCH v7 5/6] Btrfs: rename get_chunk_map() and make it non-static Date: Tue, 11 Sep 2018 15:34:48 -0700 Message-Id: <898dc638c0323a2da9401f03f37db89a4df446a2.1536704650.git.osandov@fb.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval The Btrfs swap code is going to need it, so give it a btrfs_ prefix and make it non-static. Reviewed-by: Nikolay Borisov Signed-off-by: Omar Sandoval --- fs/btrfs/volumes.c | 29 ++++++++++++++++++----------- fs/btrfs/volumes.h | 2 ++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a2761395ed22..fe66b635c023 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2714,8 +2714,15 @@ static int btrfs_del_sys_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset) return ret; } -static struct extent_map *get_chunk_map(struct btrfs_fs_info *fs_info, - u64 logical, u64 length) +/** + * btrfs_get_chunk_map() - Find the mapping containing the given logical extent. + * @logical: Logical block offset in bytes. + * @length: Length of extent in bytes. + * + * Return: Chunk mapping or ERR_PTR. + */ +struct extent_map *btrfs_get_chunk_map(struct btrfs_fs_info *fs_info, + u64 logical, u64 length) { struct extent_map_tree *em_tree; struct extent_map *em; @@ -2752,7 +2759,7 @@ int btrfs_remove_chunk(struct btrfs_trans_handle *trans, u64 chunk_offset) int i, ret = 0; struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; - em = get_chunk_map(fs_info, chunk_offset, 1); + em = btrfs_get_chunk_map(fs_info, chunk_offset, 1); if (IS_ERR(em)) { /* * This is a logic error, but we don't want to just rely on the @@ -4902,7 +4909,7 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans, int i = 0; int ret = 0; - em = get_chunk_map(fs_info, chunk_offset, chunk_size); + em = btrfs_get_chunk_map(fs_info, chunk_offset, chunk_size); if (IS_ERR(em)) return PTR_ERR(em); @@ -5044,7 +5051,7 @@ int btrfs_chunk_readonly(struct btrfs_fs_info *fs_info, u64 chunk_offset) int miss_ndevs = 0; int i; - em = get_chunk_map(fs_info, chunk_offset, 1); + em = btrfs_get_chunk_map(fs_info, chunk_offset, 1); if (IS_ERR(em)) return 1; @@ -5104,7 +5111,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len) struct map_lookup *map; int ret; - em = get_chunk_map(fs_info, logical, len); + em = btrfs_get_chunk_map(fs_info, logical, len); if (IS_ERR(em)) /* * We could return errors for these cases, but that could get @@ -5150,7 +5157,7 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info, struct map_lookup *map; unsigned long len = fs_info->sectorsize; - em = get_chunk_map(fs_info, logical, len); + em = btrfs_get_chunk_map(fs_info, logical, len); if (!WARN_ON(IS_ERR(em))) { map = em->map_lookup; @@ -5167,7 +5174,7 @@ int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info, u64 logical, u64 len) struct map_lookup *map; int ret = 0; - em = get_chunk_map(fs_info, logical, len); + em = btrfs_get_chunk_map(fs_info, logical, len); if(!WARN_ON(IS_ERR(em))) { map = em->map_lookup; @@ -5326,7 +5333,7 @@ static int __btrfs_map_block_for_discard(struct btrfs_fs_info *fs_info, /* discard always return a bbio */ ASSERT(bbio_ret); - em = get_chunk_map(fs_info, logical, length); + em = btrfs_get_chunk_map(fs_info, logical, length); if (IS_ERR(em)) return PTR_ERR(em); @@ -5652,7 +5659,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, return __btrfs_map_block_for_discard(fs_info, logical, *length, bbio_ret); - em = get_chunk_map(fs_info, logical, *length); + em = btrfs_get_chunk_map(fs_info, logical, *length); if (IS_ERR(em)) return PTR_ERR(em); @@ -5951,7 +5958,7 @@ int btrfs_rmap_block(struct btrfs_fs_info *fs_info, u64 chunk_start, u64 rmap_len; int i, j, nr = 0; - em = get_chunk_map(fs_info, chunk_start, 1); + em = btrfs_get_chunk_map(fs_info, chunk_start, 1); if (IS_ERR(em)) return -EIO; diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 23e9285d88de..f4c190c2ab84 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -465,6 +465,8 @@ unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info, int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans, u64 chunk_offset, u64 chunk_size); int btrfs_remove_chunk(struct btrfs_trans_handle *trans, u64 chunk_offset); +struct extent_map *btrfs_get_chunk_map(struct btrfs_fs_info *fs_info, + u64 logical, u64 length); static inline void btrfs_dev_stat_inc(struct btrfs_device *dev, int index)