From patchwork Fri Sep 7 07:39:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10591799 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 C299913AC for ; Fri, 7 Sep 2018 07:39:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5E5F2A630 for ; Fri, 7 Sep 2018 07:39:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA1692A64E; Fri, 7 Sep 2018 07:39:53 +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=unavailable 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 2F26A2A630 for ; Fri, 7 Sep 2018 07:39:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B5CA6B7D33; Fri, 7 Sep 2018 03:39:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3675C6B7D34; Fri, 7 Sep 2018 03:39:43 -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 147E26B7D35; Fri, 7 Sep 2018 03:39:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id C28C56B7D33 for ; Fri, 7 Sep 2018 03:39:42 -0400 (EDT) Received: by mail-pf1-f200.google.com with SMTP id x19-v6so7171569pfh.15 for ; Fri, 07 Sep 2018 00:39:42 -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=vODlK4PZBBKEJgi4ubv0xa/RKomiq2V+t41JD1y5z/4=; b=Po2NGKU85Rs6lsHBkNuKobs1CcXvEOrPHWdyku5+WA+kTkcjfR5BAY9fXGZHfm7Skc 5YsRnmbo7giOLbkCk7fVV94unvnsmBWe8naKuQq5cnrqe0KV98kHtWzH4LlcIIBJ19u+ bCi3Y3Tt6F+OuDQ7kb4Sf/tm+muxxAaoTlnjEKqCvCh1ZZIMJIGXbh7kwZeY6+9YqPcU DMuVj2GBDqdo2q63W58hR1cBO0e8dUz1MWIwwpwrBKZXQdCXC+WpwAlBa0tvPtjLSbvy Jvaro5RlELHIK4fNH8qL6MDcQA1SbEtE3q7wN/hbhtT5k77KI6EqT4vz2D1G6Rt7n29K kDpA== X-Gm-Message-State: APzg51BsWZ0tAUZW+QVq8A6S+FbhkCG7CnM4uCDAVjXG2Fs+dGbHglKc uuHu7UrAaQvNEGTrs8Ru1lu6Y7ITmeO/RXi0oZmMGR/EqsgR9pE0bIP87WZl/ta3HoQ1n4FxXUp GYPHjf6tq4ViXnt4bZdGZ+pp0vt8cBYREoQkXLjl69fzb9qfp2+IYsuiA/MNCFb0uTuZO3mKXDP +0YvMt5LdjhBALzNBFGENfgArZgdM7Q+Zosk/Aa1yde0TVY5Tg90fBWoswFww2tz3VpRR8P134E AXFbAetKpEbR9hPSFyXe7OVxS54OYGvmCfofvbdyajYj8F1UPFNd5aDCW1xZilLI9FFVVYsyfAR GqlgIZdrkzuCWPQJ0d9dNxYUqytRYcpx+YIlkg6xOS7mPMzvXdI1UjBvMbrSJGRYVq4HkvQtK7U d X-Received: by 2002:a65:4289:: with SMTP id j9-v6mr6887774pgp.284.1536305982450; Fri, 07 Sep 2018 00:39:42 -0700 (PDT) X-Received: by 2002:a65:4289:: with SMTP id j9-v6mr6887736pgp.284.1536305981622; Fri, 07 Sep 2018 00:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536305981; cv=none; d=google.com; s=arc-20160816; b=XmSKp2SIG5mWwFJnCW7gRrEXARiR4BeUykl8yyqYQqLut3xlHOIkZM2XkBod+gSfx8 GkvagsR6AhEjnCMb9XUFz43xaogXAbBCEJqtnAYMJ9O+ddnhBBphqxp/8rPML0cs+YCH QIR/66pJixe2NGZd7pqgJAGvDvjOc1jJSH6pAiT90sKZ2LmmlpMUwdH73ZoAF+5IVFAd gT3CFJWu3DfUIH4hBfHdPxkmUiKO/szf1U9ZzwymETRbp+KLyfYRg0FQ6yQXEG8on9Hf WLsXRohO5D7FyShflSst+xAsNgAllFNBDms/BVvzwBbwiQGtW2PwiMqQb8BaeVdbdsQS Q7qA== 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=vODlK4PZBBKEJgi4ubv0xa/RKomiq2V+t41JD1y5z/4=; b=WUDc8hw/vatQydv5OiPvuHNykB4tk+Hr+R2yoEClEa3FX/YNTPTz7MZbFB9nW6s+Ia /ThSwnQGYkNI+jZElP5IvORz9R2AGw0wCUKJcVtikS8hwc+KWxdLl/BX0Yo4Ulh+jmDp rNk0sJyzVqNqf8DDj0+IuFWcgCBFunKxucmttcM8Gcsn1AeYi/wiI98AcdbhN7aK/YN0 gKWEZKcevV6QmLvcC4hTk3Ia4cYwnd2xmuFIvVir+WFQbpC9V1Oaelp9sjTBCMSSmaeY gwrNoSVX2LHf3mnY2pxTTKunCHSvfp+HVL5NjfBWRn6+O95qfUVerzexHkkfQQtebWoL 4R+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=nr1btmiW; 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 d4-v6sor1637967pla.118.2018.09.07.00.39.41 for (Google Transport Security); Fri, 07 Sep 2018 00:39:41 -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=nr1btmiW; 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=vODlK4PZBBKEJgi4ubv0xa/RKomiq2V+t41JD1y5z/4=; b=nr1btmiWU7s7pNSc57k45VCUIfg0bxRLVqLCmi7TOBwggGIDfGToKTcJLXK/be4MXe 7pZ36/mIGl7LLi7H6MwBVCKC6LkAstvK3ltC+Q6Q/w7mfzSuErEtIEZNaoaJM0nVe5RN G431CKiK5vJwFxm4aHcjgC566OgZIhpZHKwnrYdjvPdjnHjsF7isYNCtm4yjEG7xf1wv HhMq06dSWD+jDvJ/1uQPi7v46rlj3GuG4robNCFuh/pCZT5gbBTbwFr2eh8CVtHy3oSI VoQfEk0/lc514oqgA8g5x42gIHsQYvIB+P9dCno99NbTYlkNr1OuCJQ4aD0K99c6EeRe QxKQ== X-Google-Smtp-Source: ANB0VdZo9evVYUnPJ98lxgj6rDfr8L/ivwBG+aqa6gQF66fKsKXH8+tWhzTNTjNznm1IJt+l9CROmA== X-Received: by 2002:a17:902:b702:: with SMTP id d2-v6mr6724508pls.12.1536305981074; Fri, 07 Sep 2018 00:39:41 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:180::1:904c]) by smtp.gmail.com with ESMTPSA id i65-v6sm16276914pfk.43.2018.09.07.00.39.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 00:39:40 -0700 (PDT) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com, linux-mm@kvack.org Subject: [PATCH v6 5/6] Btrfs: rename get_chunk_map() and make it non-static Date: Fri, 7 Sep 2018 00:39:19 -0700 Message-Id: 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. Signed-off-by: Omar Sandoval Reviewed-by: Nikolay Borisov --- fs/btrfs/volumes.c | 22 +++++++++++----------- fs/btrfs/volumes.h | 9 +++++++++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 207e36b70d9b..514932c47bcd 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2714,8 +2714,8 @@ 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) +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 +2752,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 @@ -4897,7 +4897,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); @@ -5039,7 +5039,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; @@ -5099,7 +5099,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 @@ -5145,7 +5145,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; @@ -5162,7 +5162,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; @@ -5321,7 +5321,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); @@ -5647,7 +5647,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); @@ -5946,7 +5946,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..d68c8a05a774 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -465,6 +465,15 @@ 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); +/** + * 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); static inline void btrfs_dev_stat_inc(struct btrfs_device *dev, int index)