From patchwork Tue Aug 14 18:09:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10565967 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 083361057 for ; Tue, 14 Aug 2018 18:10:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED64C2A54C for ; Tue, 14 Aug 2018 18:10:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D232E2A557; Tue, 14 Aug 2018 18:10:03 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 9B7CC2A54C for ; Tue, 14 Aug 2018 18:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726044AbeHNU6U (ORCPT ); Tue, 14 Aug 2018 16:58:20 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:36726 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725915AbeHNU6T (ORCPT ); Tue, 14 Aug 2018 16:58:19 -0400 Received: by mail-pl0-f65.google.com with SMTP id e11-v6so8634374plb.3 for ; Tue, 14 Aug 2018 11:10:00 -0700 (PDT) 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; bh=G634wQNTbLgD5E75VB2L8uImu8+pzS1mdXd/vzD+0II=; b=1xMGDAMniCKUT5/7aqP0jXGCrSHpVBK+P11Sv6ZvP6cpTyUXgR4T174jFMJg0H1LuN l7LzvB4svaQHoP23IlHk6kTzlaOaoLdvCK9YhQCic5ov7o9WmiR235SlkkEgAUQnUV+w eTTdrfGHFg1pJDZVtfaRD3zOQwac+xmtMLBGQ++6/Gn6rg5y3E3ebHbdsiqJS4UDnuFZ CPDUOv9zr0vg+dlBKF1KCEvPkKrWOL9dXpqND7fnI4o9irJaRokV+5YzpAL+6myuwCNT TJ78zbAs34wPfnhcNIMs1BJJ8Je/Lx8dhYpA+rz/WwrP0jis79ai93b/fPZS6Zpbnctq mv/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=G634wQNTbLgD5E75VB2L8uImu8+pzS1mdXd/vzD+0II=; b=DCWeF6HpR6PsxjV4QCA4bgL5vUeyng5s7SdgEJP6VDC0QBCucZZ113gIt2ZbfbYY5v rCDQZPRJXcCwLdTt4VcsKp1bs7o3ScQtTLyR2SBO51FQszGgjzuOLyh0hoPwYsHRSg6q /nLTSDh8d2hAcUaDZZc9McVANEoLJ9khlp3QhBjdF/6vaoR4hG2uwBGTcAJLv5o10AeJ mphE9TJQ1h0ccdfT9VABWd6M/a4WW8bLjlqVy/ZvP2JLbABUrBN0CkURdcgZQLAW8tuK ANkeObyY3Ybg3rLwjvFUO2jw/TthWkp8DasxlKJtNMM5d4O6tf4aExH9J6yS7R7m1b1Q IU/A== X-Gm-Message-State: AOUpUlFEeKBjG3ywDtDeD7AiQxCatcZ+Fhd38Nm4I2nXXwPOPs9ahFMg GYQRKh/IgF5sZHODNSGIUzt4f/S4LpM= X-Google-Smtp-Source: AA+uWPxIH2wkbaaRVz3oiGoqQA1C2EUTwG9TT1iLNGZNRPY5mrqdHPtP0K4OA+NFpqoA7GMtxupXTw== X-Received: by 2002:a17:902:6a83:: with SMTP id n3-v6mr21408921plk.246.1534270199543; Tue, 14 Aug 2018 11:09:59 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::4:6ead]) by smtp.gmail.com with ESMTPSA id v4-v6sm20245151pgr.36.2018.08.14.11.09.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 11:09:59 -0700 (PDT) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH] Btrfs: clean up scrub is_dev_replace parameter Date: Tue, 14 Aug 2018 11:09:52 -0700 Message-Id: <340268ad4d290b780616010ae3a75347723ebf10.1534270161.git.osandov@fb.com> X-Mailer: git-send-email 2.18.0 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 From: Omar Sandoval struct scrub_ctx has an ->is_dev_replace member, so there's no point in passing around is_dev_replace where sctx is available. Signed-off-by: Omar Sandoval Reviewed-by: David Sterba --- fs/btrfs/scrub.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 6702896cdb8f..276c67c3da2e 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3342,8 +3342,7 @@ static noinline_for_stack int scrub_raid56_parity(struct scrub_ctx *sctx, static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, struct map_lookup *map, struct btrfs_device *scrub_dev, - int num, u64 base, u64 length, - int is_dev_replace) + int num, u64 base, u64 length) { struct btrfs_path *path, *ppath; struct btrfs_fs_info *fs_info = sctx->fs_info; @@ -3619,7 +3618,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, extent_physical = extent_logical - logical + physical; extent_dev = scrub_dev; extent_mirror_num = mirror_num; - if (is_dev_replace) + if (sctx->is_dev_replace) scrub_remap_extent(fs_info, extent_logical, extent_len, &extent_physical, &extent_dev, @@ -3717,8 +3716,7 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx, struct btrfs_device *scrub_dev, u64 chunk_offset, u64 length, u64 dev_offset, - struct btrfs_block_group_cache *cache, - int is_dev_replace) + struct btrfs_block_group_cache *cache) { struct btrfs_fs_info *fs_info = sctx->fs_info; struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree; @@ -3755,8 +3753,7 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx, if (map->stripes[i].dev->bdev == scrub_dev->bdev && map->stripes[i].physical == dev_offset) { ret = scrub_stripe(sctx, map, scrub_dev, i, - chunk_offset, length, - is_dev_replace); + chunk_offset, length); if (ret) goto out; } @@ -3769,8 +3766,7 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx, static noinline_for_stack int scrub_enumerate_chunks(struct scrub_ctx *sctx, - struct btrfs_device *scrub_dev, u64 start, u64 end, - int is_dev_replace) + struct btrfs_device *scrub_dev, u64 start, u64 end) { struct btrfs_dev_extent *dev_extent = NULL; struct btrfs_path *path; @@ -3864,7 +3860,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, */ scrub_pause_on(fs_info); ret = btrfs_inc_block_group_ro(fs_info, cache); - if (!ret && is_dev_replace) { + if (!ret && sctx->is_dev_replace) { /* * If we are doing a device replace wait for any tasks * that started dellaloc right before we set the block @@ -3929,7 +3925,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, dev_replace->item_needs_writeback = 1; btrfs_dev_replace_write_unlock(&fs_info->dev_replace); ret = scrub_chunk(sctx, scrub_dev, chunk_offset, length, - found_key.offset, cache, is_dev_replace); + found_key.offset, cache); /* * flush, submit all pending read and write bios, afterwards @@ -3997,7 +3993,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, btrfs_put_block_group(cache); if (ret) break; - if (is_dev_replace && + if (sctx->is_dev_replace && atomic64_read(&dev_replace->num_write_errors) > 0) { ret = -EIO; break; @@ -4231,8 +4227,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, } if (!ret) - ret = scrub_enumerate_chunks(sctx, dev, start, end, - is_dev_replace); + ret = scrub_enumerate_chunks(sctx, dev, start, end); wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); atomic_dec(&fs_info->scrubs_running);