From patchwork Wed Nov 24 09:30:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 382D8C433EF for ; Wed, 24 Nov 2021 09:30:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235158AbhKXJeF (ORCPT ); Wed, 24 Nov 2021 04:34:05 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhKXJeF (ORCPT ); Wed, 24 Nov 2021 04:34:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746255; x=1669282255; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=c4gGog+LgsDNgxi4alHY9QYk/10w4SZ+umwubWCDLxE=; b=DSkLGtiA9vWTVspzkzV7YGBTVOnvG28oRfNFM+X6GPGi+SoVB3p3wu0k 5VzozkqzK5wB6IDJwg1GYlFQzEUVn8tOanAt6Z7Rds5kvyt6OTCyFmTbb BfU14vygf5xfMffE2cS2SBDJ4SzbOEwmh48m1UvgyyjkyRDsOI/ZnuISf JiRtBA29kWXWDgqqdPlTcXXdF64+Ie2Ldo7cHVFkPZURl4dkmODVEg1u1 p67vr1QpMlGYoC0YUMZSK+e5WwhprtYgQmgClQfJ9yHJXWI6DiKmbP5TY rsoXJtdJYvL2CLwYKR1rv99OdqjRAZg0xyb0CcwRVPFgWXbXVya/mW3CC g==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499352" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:30:55 +0800 IronPort-SDR: 9QLnV5qxdyv3ibS31JhKgjOcbK63Ytx9GLD2xDlAnHuf+UcBklHKQctujh591TnDq5HCz2r3tj nAt1ZGLieeYZSkJCNL0O5owWQ3YTC+TjOb+drZ0b5BA8rsgSMjTqgbWzFn0DEUXsO+obta2W4F QiGUr7WpEQt0BK20xVKn9lYXT6GZkOKNCm/fI17hUVENZdUunrCmg5CFt/u8Nggq76f4Cf+/m7 NVeVME7hNy7lR7DWEQvu5Xkw0PfJIF0pqtLujEvt6ItzVRtasm4cUwEPegTKKTl+XkB79xBSZZ T5uJ43Wv19jcExKIcwOUgV8/ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:48 -0800 IronPort-SDR: wXj1wx3DobyRrzdb/WQYhpHSxnpEdn0bT5tgFh/RJVAWCsIPZKQqo9oSM57wRAZlbUio8JwEKb pAEjixSTP75+vmfrV4lpOSiWCHStqa5zy9wMeohABo8eK9HdUx5ofBciqNWGDiUs2/brM2O2AV 3fAPZSlVABuhVtKgYeXUS5RYtSUd5XReREzIHOXXy81Ann4n/ylEyn6Wpyp9pclggoTZFXUPik qhAl8Jfk09KDclvo2161+JY2Lzl78vg03Z+SUSENGxEm7Wpnv/ukccQBi2UZaJUWC2IXwQ0l5X DAk= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:30:54 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 01/21] btrfs: zoned: encapsulate inode locking for zoned relocation Date: Wed, 24 Nov 2021 01:30:27 -0800 Message-Id: <72f9609c598815e757de1ea275511149ce861246.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Encapsulate the inode lock needed for serializing the data relocation writes on a zoned filesystem into a helper. This streamlines the code reading flow and hides special casing for zoned filesystems. Signed-off-by: Johannes Thumshirn --- fs/btrfs/extent_io.c | 8 ++------ fs/btrfs/zoned.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index b289d26aca0d5..1654c611d2002 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -5170,8 +5170,6 @@ int extent_writepages(struct address_space *mapping, struct writeback_control *wbc) { struct inode *inode = mapping->host; - const bool data_reloc = btrfs_is_data_reloc_root(BTRFS_I(inode)->root); - const bool zoned = btrfs_is_zoned(BTRFS_I(inode)->root->fs_info); int ret = 0; struct extent_page_data epd = { .bio_ctrl = { 0 }, @@ -5183,11 +5181,9 @@ int extent_writepages(struct address_space *mapping, * Allow only a single thread to do the reloc work in zoned mode to * protect the write pointer updates. */ - if (data_reloc && zoned) - btrfs_inode_lock(inode, 0); + btrfs_zoned_data_reloc_lock(inode); ret = extent_write_cache_pages(mapping, wbc, &epd); - if (data_reloc && zoned) - btrfs_inode_unlock(inode, 0); + btrfs_zoned_data_reloc_unlock(inode); ASSERT(ret <= 0); if (ret < 0) { end_write_bio(&epd, ret); diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index 4344f48183898..e3eaf03a34222 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -8,6 +8,7 @@ #include "volumes.h" #include "disk-io.h" #include "block-group.h" +#include "btrfs_inode.h" /* * Block groups with more than this value (percents) of unusable space will be @@ -354,4 +355,20 @@ static inline void btrfs_clear_treelog_bg(struct btrfs_block_group *bg) spin_unlock(&fs_info->treelog_bg_lock); } +static inline void btrfs_zoned_data_reloc_lock(struct inode *inode) +{ + struct btrfs_root *root = BTRFS_I(inode)->root; + + if (btrfs_is_data_reloc_root(root) && btrfs_is_zoned(root->fs_info)) + btrfs_inode_lock(inode, 0); +} + +static inline void btrfs_zoned_data_reloc_unlock(struct inode *inode) +{ + struct btrfs_root *root = BTRFS_I(inode)->root; + + if (btrfs_is_data_reloc_root(root) && btrfs_is_zoned(root->fs_info)) + btrfs_inode_unlock(inode, 0); +} + #endif From patchwork Wed Nov 24 09:30:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4737C433F5 for ; Wed, 24 Nov 2021 09:30:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235246AbhKXJeH (ORCPT ); Wed, 24 Nov 2021 04:34:07 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhKXJeG (ORCPT ); Wed, 24 Nov 2021 04:34:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746257; x=1669282257; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PMU6EJmLjXKKmmJRhCUmEwvGBf//yUwO4HKPwmD/JMo=; b=Sw8fo7ibR/KA4F4wF+vOCdJ8Puko63C8f4X7yF97Fr7Ac+SXNYIt9C8C ZK1uK+YxGK6K1+lSymE2SdnlkaY/yZXdCJxersfw8aXoeKJ7nwbh0Goyh VsLu7zhv1ZBnfq+vE+nmqgAXyLfggdUpf+an58PgTSUhkSiYzlkdwa8h4 4M2kpuZWdNYx8pkFmt8424Y6oE8MlKyGurElmwzHwzMpBwThVRZY8wZKm 7wxEn4Ywjgs2nDNIG4aZDXNcNJCIlMvje6EcSFISeAaFa2OsmYtaSh4Fn LpRRaynmPeoXznFZQm49I5YRE/mWsLCz7FVrFZlkkP45/mx47bQh5eimH A==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499355" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:30:57 +0800 IronPort-SDR: WiL5LIGgvKFKrxQ/WsGUhbWWSQCP4LjtTVEZ3p/Gqva3bIoiV8fWP5QrZaAnB+zrkQakT6/Cb3 oHAjWaM3qlsFy5jscffV88+Gn8GZhfECnkCelP4xn1Nwav4iOTtvujOXY4YwANoLzfhdBaFO+b Zi+2/RPxqdnO9My64A1g+y1RLI+v1fry9bViILcU3Zeb3qIo4KnFo9m5CrNp8U5vvFstgM8Mvv +GCnpAcaOn9/m96aawNUVTrKV8rVpvkFVf5uOSe8QoYh0lQSD7ltmYv0V2bHAPYsnyx3mWiUMu sEEEkxxHM67aLjv3oqBlENO4 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:50 -0800 IronPort-SDR: Kv415UFHO1i7ijLJAtZskQvu4lvxzHSe18+SkskmH+OY3em/Cqmt/CmB7htgMWL/TTTDYgJPcv 9HBAaBEs0vKBDSd4LJb/bLJQWxfl4GkpPsC/8cAXfEaVYks7QzKKdpJaAOVVma+kAar2O8D/P/ GOxW/1t2qW6f8dqg+8sqPRwpsHFn0RjBHy1Vonja8qTGalQZGbzjdCj4MEPU2eckbr7aFMH+Fq X5P5EP0kCXL/j9gaRU0ncfW8Kqk699UyW++shq9SLkcCjoiMtbBRpiQFyJycG6FyYgxS7zjFKK x4g= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:30:56 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 02/21] btrfs: zoned: simplify btrfs_check_meta_write_pointer Date: Wed, 24 Nov 2021 01:30:28 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org btrfs_check_meta_write_pointer() will always be called with a NULL 'cache_ret' argument. As there's no need to check if we have a valid block_group passed in remove these checks. Signed-off-by: Johannes Thumshirn --- fs/btrfs/zoned.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 0921dbbba84d2..b0ab38a2e776e 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1640,29 +1640,19 @@ bool btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info, if (!btrfs_is_zoned(fs_info)) return true; - cache = *cache_ret; + cache = btrfs_lookup_block_group(fs_info, eb->start); + if (!cache) + return true; - if (cache && (eb->start < cache->start || - cache->start + cache->length <= eb->start)) { + if (cache->meta_write_pointer != eb->start) { btrfs_put_block_group(cache); cache = NULL; - *cache_ret = NULL; + ret = false; + } else { + cache->meta_write_pointer = eb->start + eb->len; } - if (!cache) - cache = btrfs_lookup_block_group(fs_info, eb->start); - - if (cache) { - if (cache->meta_write_pointer != eb->start) { - btrfs_put_block_group(cache); - cache = NULL; - ret = false; - } else { - cache->meta_write_pointer = eb->start + eb->len; - } - - *cache_ret = cache; - } + *cache_ret = cache; return ret; } From patchwork Wed Nov 24 09:30:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0412AC433FE for ; Wed, 24 Nov 2021 09:31:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235362AbhKXJeI (ORCPT ); Wed, 24 Nov 2021 04:34:08 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhKXJeH (ORCPT ); Wed, 24 Nov 2021 04:34:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746258; x=1669282258; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QAF8tCKrfsF1dlOZtQHqLv9haS/aSIkxMYONzDacDjc=; b=IwTebhQb/xcSQv1xcTUEPvzpxa/UCHVmCXx7tnHB/M2BGfVl9RgiktOc 6TIwi/LvIC4PHv/Dasi2rCxnP1I3yZXlWHX+e++0WDCyaltgy63E3QjQK TCwZLZaripnzN0GozaUKHJMpU6PST1f5nb6XChfzxj7IHTmnaHFGWRR1I bITOHYIt5dFXo3IslmKPugzSkEXhjxJ9Oz/FV2TTFCMXuxGyfgtt6Sves 70y4qg3LQlIq3REVwEqt0OIZX0A727zFJOp15TrW5yr0wV5cKUUjc0UD6 he+KJM2cUmDYnn7GKEyS/8xCz0Fgve3KfQPollyb5K7PUZhm5zg1jTHlq A==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499358" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:30:58 +0800 IronPort-SDR: Kh/ngzCpIo856t3PNg7nYO3stiG4aoRqiLjlQpiHnbIpD4uGeEslAXXpUmNvTbUd+jdfnGwpCL yWpFMhKmlsuvlR12JjiL3OiROuMaagdeVni1swQkSlOTpWIaIEDs069SwLmEJUzIvhECqO4LYR xFfENTnpsS33lZcxhMX9xHjLZSTvHId9pA3V6g2GFtySxQuc8NbKyUn+2x53bJNCV4F2Yf3MlL O8xuJ4Q5j7JR+Jc93e6PcMdmcU7r5KON/poBDvVl/Lj8KHma2foGhbYNZ3Hb6Tb0QKTbh+0F2K hFKYBF+8aOy5oHpPGN/2jaBJ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:51 -0800 IronPort-SDR: 9MdZC8rD0A0mBW943ngvwNij7PPjn2lzpa52K7uV2QN0tjokX4KHFK0R28sOzW8LrMG4TtJCcj 8Rf2QqGWTQYBPvuryX+M7ia8ZCOmFYy5DTfjt4wwpsy2BbKhyN6qVN22kSZzZ3Wppv1rOS51VE PPd/33DZqUYZQSGNxeWH1q+zbXsXwPKVrOFr52NW9apLh4DDctkRohuoJeYgjJwF6lpMpqFrpx mTOxJEhJ1r14EjQoqXiyyP4vwDFlbB4+HOJJUEhhfFogR/8yxyhx12K3Fr99+0j2Xzj45VM//3 zL8= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:30:58 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 03/21] btrfs: zoned: sink zone check into btrfs_repair_one_zone Date: Wed, 24 Nov 2021 01:30:29 -0800 Message-Id: <8c38c2f9d1bee46ded4ec491e16398f2f5764200.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Sink zone check into btrfs_repair_one_zone() so we don't need to do it in all callers. Also as btrfs_repair_one_zone() doesn't return a sensible error, just make it a void function. Signed-off-by: Johannes Thumshirn --- fs/btrfs/extent_io.c | 3 +-- fs/btrfs/scrub.c | 4 ++-- fs/btrfs/volumes.c | 13 ++++++++----- fs/btrfs/volumes.h | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 1654c611d2002..96c2e40887772 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2314,8 +2314,7 @@ static int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start, ASSERT(!(fs_info->sb->s_flags & SB_RDONLY)); BUG_ON(!mirror_num); - if (btrfs_is_zoned(fs_info)) - return btrfs_repair_one_zone(fs_info, logical); + btrfs_repair_one_zone(fs_info, logical); bio = btrfs_bio_alloc(1); bio->bi_iter.bi_size = 0; diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index d175c5ab11349..30bb304bb5e9a 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -852,8 +852,8 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) have_csum = sblock_to_check->pagev[0]->have_csum; dev = sblock_to_check->pagev[0]->dev; - if (btrfs_is_zoned(fs_info) && !sctx->is_dev_replace) - return btrfs_repair_one_zone(fs_info, logical); + if (!sctx->is_dev_replace) + btrfs_repair_one_zone(fs_info, logical); /* * We must use GFP_NOFS because the scrub task might be waiting for a diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index ae1a4f2a8af64..d0615256dacc3 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -8329,23 +8329,26 @@ static int relocating_repair_kthread(void *data) return ret; } -int btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical) +void btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical) { struct btrfs_block_group *cache; + if (!btrfs_is_zoned(fs_info)) + return; + /* Do not attempt to repair in degraded state */ if (btrfs_test_opt(fs_info, DEGRADED)) - return 0; + return; cache = btrfs_lookup_block_group(fs_info, logical); if (!cache) - return 0; + return; spin_lock(&cache->lock); if (cache->relocating_repair) { spin_unlock(&cache->lock); btrfs_put_block_group(cache); - return 0; + return; } cache->relocating_repair = 1; spin_unlock(&cache->lock); @@ -8353,5 +8356,5 @@ int btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical) kthread_run(relocating_repair_kthread, cache, "btrfs-relocating-repair"); - return 0; + return; } diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 3b81306807493..ab30cf4236fa3 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -637,6 +637,6 @@ enum btrfs_raid_types __attribute_const__ btrfs_bg_flags_to_raid_index(u64 flags int btrfs_bg_type_to_factor(u64 flags); const char *btrfs_bg_type_to_raid_name(u64 flags); int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info); -int btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical); +void btrfs_repair_one_zone(struct btrfs_fs_info *fs_info, u64 logical); #endif From patchwork Wed Nov 24 09:30:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11EDCC433EF for ; Wed, 24 Nov 2021 09:31:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235557AbhKXJeJ (ORCPT ); Wed, 24 Nov 2021 04:34:09 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhKXJeI (ORCPT ); Wed, 24 Nov 2021 04:34:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746259; x=1669282259; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ba1cYXeJ5eNvMFKRNhE4V7FpScaXD3HUwsG3d9Zvg8k=; b=fTRs4uYLzRpjLXHuDHXAFnxEv2tr0gYo2PU51ukEmflznCFnzQRcbwHW onXoFLMOoEDYVyS0pJDTG9bstvSeNcHfT4IRw5scikfegMNGkhLqvKDdu s66d8zYayjaGbbPzC4l/zw7db2AMrf2SC92dV8ZGr9hDTWISmX2nQqM31 6fVvsuH1yhnPRvtnG1b6UsmgSxis+2L5Nmmo7SENw72I8netZogvx2iy+ TdNRHLkM97mOBJpZVUwvOCQoVQiY92ARqungjg3XklRYQR7KNQWRn4qAi kQAWgOOPNFiZ3CvtCx6FB7/v/w1p5hpYewrzJotkRLWsEcj5JuSVdPexL w==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499361" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:30:59 +0800 IronPort-SDR: QL3hBgZZHceiRjNx8+kem9EOaaoVcclLVMdyARtzFEOBh3sI8YUgskwSKE+1HyatshVr5yzgx3 TiyQSO/gq9Gv++H4NwYn/B2A0aZml11dXLauC+YG6zFxRHLpzNnCDWcJcyLHUv6reXQ027n2/W +kUAsADXX0wa1G73hP8fCuax4CeQFZzSGMVQVEIdXZmh4ryCu+IJ3k8sgpDEOqlBfx3bCc0KaC CqRafjt692GOXZ3ZVsd+p58ns8XOohai4JZ64MbwRxJCzPk5C19tjbkFMS0egE+NCsjv8jFi5q psvSVk7OqQM44aqKcVhOoWHE Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:52 -0800 IronPort-SDR: NfN0awGI2Sir1TwT++cXkeL7vTZldSOxR8ZK3qI9SQz3IeOImFTpBgcWBsdgXQARo1dxCat+EQ D4piMedvI76HEDbJ/ghSBbKs6cxC8dpqEagRQfKzvdp4Kh4l+12vvlyVneKsBaCUPNQtw9WYhM 5s2m5dguBEPGuYrFmCJjhA5w1oa/6MW9W45AQRyK1zelUoDUPgOfqHMWcyqnO6ZzVNl5/mhUpu ZDh0AdxpY6cRdAQ2/KYws2BdDfpIZnKKewSlzavI1lran1/PRdSsdQxXumk98zbYXnnDoa3pKV KSc= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:30:59 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 04/21] btrfs: zoned: it's pointless to check for REQ_OP_ZONE_APPEND and btrfs_is_zoned Date: Wed, 24 Nov 2021 01:30:30 -0800 Message-Id: <2a77d18e249ace733422771b05d48a883c4e5b07.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org REQ_OP_ZONE_APPEND can only work on zoned devices, so it is redundant to check if the filesystem is zoned when REQ_OP_ZONE_APPEND is set as the bio's bio_op. Signed-off-by: Johannes Thumshirn --- fs/btrfs/extent_io.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 96c2e40887772..d5eb31306c448 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3282,8 +3282,7 @@ static int calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl, else bio_ctrl->len_to_stripe_boundary = (u32)geom.len; - if (!btrfs_is_zoned(fs_info) || - bio_op(bio_ctrl->bio) != REQ_OP_ZONE_APPEND) { + if (bio_op(bio_ctrl->bio) != REQ_OP_ZONE_APPEND) { bio_ctrl->len_to_oe_boundary = U32_MAX; return 0; } @@ -3338,7 +3337,7 @@ static int alloc_new_bio(struct btrfs_inode *inode, bio_set_dev(bio, bdev); wbc_init_bio(wbc, bio); } - if (btrfs_is_zoned(fs_info) && bio_op(bio) == REQ_OP_ZONE_APPEND) { + if (bio_op(bio) == REQ_OP_ZONE_APPEND) { struct btrfs_device *device; device = btrfs_zoned_get_device(fs_info, disk_bytenr, From patchwork Wed Nov 24 09:30:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43048C4332F for ; Wed, 24 Nov 2021 09:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235668AbhKXJeK (ORCPT ); Wed, 24 Nov 2021 04:34:10 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhKXJeK (ORCPT ); Wed, 24 Nov 2021 04:34:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746260; x=1669282260; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R/Lph/a8nHCftXszb+5s0kPt/bO6HgxadgO6TWN0U6o=; b=OrzeFTCP0MtiPtZCBWZLWqffIIgax5t53LDue4t0EuYGsg2fXVAwhNVM yjG4FBemKfKA91g54JW2b4V9wvll2o4Wge1KW0+Q46Drs16mmtssQbg/N eGiiyrV5ba8BacKjpq4OPhqLgepqVmrmjU4cV54BFvRD7AeoJAwA9oC7+ n1ur1sbwVAkZqV8g2fi5xTwGM1l04jhSX6FBwhlXROhvhuzoZZ0GvGwq/ JPvSdD5YKO6my7DTI3j27RDd79V2BFF39odG9IjtAcbFD2BZR85XzrBk0 x0ngVu2yJzvnOPwZJyD7STlaEl9/Wnkp2hSOEqqV2Wrz9nXp5hXLZunbJ A==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499363" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:00 +0800 IronPort-SDR: jIgxKFzzpatc7RW32LoR55m0n6MPDn9SiUXNgW6+tBYp0zak1guN6tEJq1MDcbaFdVx7w2dWq5 5WKKeKP8FPpqEkDDg4QWL4e/cGrekwB1n7Di2Sh0uMMpSMrOK10jexJuUx3yWCO8hH3MHC1uKG 2bcdxWdhReaovElpqaAYfpcMSBTYqXw91fqBSqA0MW1HqhYpoo3C6CBw/4VRrw7yNs88A10wDD zkUpbaTL6NCsEmi7sobwsMURtbDRlNPh/dI5FpmZ3yD0JVVkWsodwqnpTqUD+xBFcrHSuzy8rq Y+QvWKRl2pgPH+Z+KXg9SLFs Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:53 -0800 IronPort-SDR: Cd30PMbst6NJqB0cYEjYryC2ukR0JwX2jD++B5S5u963IOLE+mcYLmd4DysrWiZU5szCuD7ge8 JGdHTIGLmJ5Y2AtkTyd3KTIUzyQ07lseea9+Sz7FKbeOw3cp1l13msdaU5NllKVwBhgTnkkfEJ lAYYOduHKrvAGSCEQyL7DjNDoxkJjZwtwlSJxwjNyFMtzXOJYuND4w2ve3MsDqA+igETC7VLsv iaKXC4ZHCsiYuR7XTXOb/epSZZ8UW1+Mj1NWIE/7uXDmrDM50B18GTBEbsFwx8A9hQTmBckYNu UzA= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:00 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 05/21] btrfs: zoned: move compatible fs flags check to zoned code Date: Wed, 24 Nov 2021 01:30:31 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org check_fsflags_compatible() is only used in zoned filesystems, so move it to zoned code. Signed-off-by: Johannes Thumshirn --- fs/btrfs/ioctl.c | 12 ++---------- fs/btrfs/zoned.h | 9 +++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 05c77a1979a9f..d7f710e57890e 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -49,6 +49,7 @@ #include "delalloc-space.h" #include "block-group.h" #include "subpage.h" +#include "zoned.h" #ifdef CONFIG_64BIT /* If we have a 32-bit userspace and 64-bit kernel, then the UAPI @@ -192,15 +193,6 @@ static int check_fsflags(unsigned int old_flags, unsigned int flags) return 0; } -static int check_fsflags_compatible(struct btrfs_fs_info *fs_info, - unsigned int flags) -{ - if (btrfs_is_zoned(fs_info) && (flags & FS_NOCOW_FL)) - return -EPERM; - - return 0; -} - /* * Set flags/xflags from the internal inode flags. The remaining items of * fsxattr are zeroed. @@ -238,7 +230,7 @@ int btrfs_fileattr_set(struct user_namespace *mnt_userns, if (ret) return ret; - ret = check_fsflags_compatible(fs_info, fsflags); + ret = btrfs_zoned_check_fsflags_compatible(fs_info, fsflags); if (ret) return ret; diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index e3eaf03a34222..8e8f36c1d28a4 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -371,4 +371,13 @@ static inline void btrfs_zoned_data_reloc_unlock(struct inode *inode) btrfs_inode_unlock(inode, 0); } +static inline int btrfs_zoned_check_fsflags_compatible( + struct btrfs_fs_info *fs_info, + unsigned int flags) +{ + if (btrfs_is_zoned(fs_info) && (flags & FS_NOCOW_FL)) + return -EPERM; + + return 0; +} #endif From patchwork Wed Nov 24 09:30:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B24D3C433EF for ; Wed, 24 Nov 2021 09:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235717AbhKXJeM (ORCPT ); Wed, 24 Nov 2021 04:34:12 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhKXJeL (ORCPT ); Wed, 24 Nov 2021 04:34:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746262; x=1669282262; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=clz0LjFMhfffqOoOspmRUz9Up0K3CBqv5S3kMZP40Y4=; b=pawJ+7MP0EafhTVgzkixEPzmXgOzS+jZum0VOYfARJ6IkYIhXyBiPHjS WG5BUAssU95TpVx1s1XG7Okc26tAKzvbgrY2ydF4582qZ2cRJHpUm2TvK 4hqxaBeTydlUaP1UqDR+vBeWm3JQk/zks9T4rR1SgHAGWTrEemF+Qytfm FC5L2Ns3LW0CLG1bNhTf/btFh8cedrfBQzwgLUVYAT02R6WBrezo7YXjb TwkLgDI8UQg94WotAaoKUOgvv29eq0UcM2VAQkwJb20Qms963o9zAR/VN 19p7aEAoRsbzyVRiLh6qpjqhLOAFaWvWgOQfg7mvkrtYtJzfEtuqe8xG1 A==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499366" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:02 +0800 IronPort-SDR: 4nn4mynbNcFtVsm1US+oKyjw6DI9snua3ui3a2XZhjS6L2YDWH5Q5GGcQiyfUjPiuPiwd/gdQp JQYOg7t7CkvnHXiju5h/W9bql59GbEPon6mSR+RXjo2QGzWk5rxa767dz9Dic4wOg1fC0JSX08 jvw9piccq9dcQUv8B81vwgUfhH+9Nxc0gED1vk9LI7o7za23j/NzSEAEifyx4qZZGqyb84w22x F+y7EHClFNM5rgSCn9P1oZDHVeAQw7i/KUEto6vlsczpacAWjN3Ys6C6AvZGpPzJuEZd08uru0 3Q081h9RlQ7oEeC/DCXSHUmC Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:55 -0800 IronPort-SDR: XY7KbriBlM553W8tCot7rlqn/PKrp4G72bwwfHwxWm3qANfatkBPLSfOHjwYi3rRJtl4Yd+2tv iMyPf4mjPfA8JUW9nboXdIKBc9lEzzZsuMbBWiqHgxUMY+PorqnAaRzakapTP/yKk1KEG+/7EQ elGM14mABNiAuQcDOFxjYDEuXc8j9N5jkjDrI6YxfBNY1oXrLWhUBSOaXfG5pkZzLR8mecOuBu 3YrV6tRxcXNsJCyT6oH4p/o0ZaoY6VKijirImxuwoW8p+KljKT4JaWuMefUtsOxhHYXuzdiFaA 1Jw= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:01 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 06/21] btrfs: zoned: move mark_block_group_to_copy to zoned code Date: Wed, 24 Nov 2021 01:30:32 -0800 Message-Id: <7515f0e28e89b7c2266bfcc021f9639dd45ae898.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org mark_block_group_to_copy() is only used in zoned filesystems, so move the code to zoned code. Signed-off-by: Johannes Thumshirn --- fs/btrfs/dev-replace.c | 126 +---------------------------------------- fs/btrfs/zoned.c | 124 ++++++++++++++++++++++++++++++++++++++++ fs/btrfs/zoned.h | 8 +++ 3 files changed, 133 insertions(+), 125 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 66fa61cb3f235..7572d80bff2ac 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -460,130 +460,6 @@ static char* btrfs_dev_name(struct btrfs_device *device) return rcu_str_deref(device->name); } -static int mark_block_group_to_copy(struct btrfs_fs_info *fs_info, - struct btrfs_device *src_dev) -{ - struct btrfs_path *path; - struct btrfs_key key; - struct btrfs_key found_key; - struct btrfs_root *root = fs_info->dev_root; - struct btrfs_dev_extent *dev_extent = NULL; - struct btrfs_block_group *cache; - struct btrfs_trans_handle *trans; - int ret = 0; - u64 chunk_offset; - - /* Do not use "to_copy" on non zoned filesystem for now */ - if (!btrfs_is_zoned(fs_info)) - return 0; - - mutex_lock(&fs_info->chunk_mutex); - - /* Ensure we don't have pending new block group */ - spin_lock(&fs_info->trans_lock); - while (fs_info->running_transaction && - !list_empty(&fs_info->running_transaction->dev_update_list)) { - spin_unlock(&fs_info->trans_lock); - mutex_unlock(&fs_info->chunk_mutex); - trans = btrfs_attach_transaction(root); - if (IS_ERR(trans)) { - ret = PTR_ERR(trans); - mutex_lock(&fs_info->chunk_mutex); - if (ret == -ENOENT) { - spin_lock(&fs_info->trans_lock); - continue; - } else { - goto unlock; - } - } - - ret = btrfs_commit_transaction(trans); - mutex_lock(&fs_info->chunk_mutex); - if (ret) - goto unlock; - - spin_lock(&fs_info->trans_lock); - } - spin_unlock(&fs_info->trans_lock); - - path = btrfs_alloc_path(); - if (!path) { - ret = -ENOMEM; - goto unlock; - } - - path->reada = READA_FORWARD; - path->search_commit_root = 1; - path->skip_locking = 1; - - key.objectid = src_dev->devid; - key.type = BTRFS_DEV_EXTENT_KEY; - key.offset = 0; - - ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); - if (ret < 0) - goto free_path; - if (ret > 0) { - if (path->slots[0] >= - btrfs_header_nritems(path->nodes[0])) { - ret = btrfs_next_leaf(root, path); - if (ret < 0) - goto free_path; - if (ret > 0) { - ret = 0; - goto free_path; - } - } else { - ret = 0; - } - } - - while (1) { - struct extent_buffer *leaf = path->nodes[0]; - int slot = path->slots[0]; - - btrfs_item_key_to_cpu(leaf, &found_key, slot); - - if (found_key.objectid != src_dev->devid) - break; - - if (found_key.type != BTRFS_DEV_EXTENT_KEY) - break; - - if (found_key.offset < key.offset) - break; - - dev_extent = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent); - - chunk_offset = btrfs_dev_extent_chunk_offset(leaf, dev_extent); - - cache = btrfs_lookup_block_group(fs_info, chunk_offset); - if (!cache) - goto skip; - - spin_lock(&cache->lock); - cache->to_copy = 1; - spin_unlock(&cache->lock); - - btrfs_put_block_group(cache); - -skip: - ret = btrfs_next_item(root, path); - if (ret != 0) { - if (ret > 0) - ret = 0; - break; - } - } - -free_path: - btrfs_free_path(path); -unlock: - mutex_unlock(&fs_info->chunk_mutex); - - return ret; -} - bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, struct btrfs_block_group *cache, u64 physical) @@ -680,7 +556,7 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, if (ret) return ret; - ret = mark_block_group_to_copy(fs_info, src_device); + ret = btrfs_mark_block_group_to_copy(fs_info, src_device); if (ret) return ret; diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index b0ab38a2e776e..73bfe30691b01 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2035,3 +2035,127 @@ void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info) } mutex_unlock(&fs_devices->device_list_mutex); } + +int btrfs_mark_block_group_to_copy(struct btrfs_fs_info *fs_info, + struct btrfs_device *src_dev) +{ + struct btrfs_path *path; + struct btrfs_key key; + struct btrfs_key found_key; + struct btrfs_root *root = fs_info->dev_root; + struct btrfs_dev_extent *dev_extent = NULL; + struct btrfs_block_group *cache; + struct btrfs_trans_handle *trans; + int ret = 0; + u64 chunk_offset; + + /* Do not use "to_copy" on non zoned filesystem for now */ + if (!btrfs_is_zoned(fs_info)) + return 0; + + mutex_lock(&fs_info->chunk_mutex); + + /* Ensure we don't have pending new block group */ + spin_lock(&fs_info->trans_lock); + while (fs_info->running_transaction && + !list_empty(&fs_info->running_transaction->dev_update_list)) { + spin_unlock(&fs_info->trans_lock); + mutex_unlock(&fs_info->chunk_mutex); + trans = btrfs_attach_transaction(root); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + mutex_lock(&fs_info->chunk_mutex); + if (ret == -ENOENT) { + spin_lock(&fs_info->trans_lock); + continue; + } else { + goto unlock; + } + } + + ret = btrfs_commit_transaction(trans); + mutex_lock(&fs_info->chunk_mutex); + if (ret) + goto unlock; + + spin_lock(&fs_info->trans_lock); + } + spin_unlock(&fs_info->trans_lock); + + path = btrfs_alloc_path(); + if (!path) { + ret = -ENOMEM; + goto unlock; + } + + path->reada = READA_FORWARD; + path->search_commit_root = 1; + path->skip_locking = 1; + + key.objectid = src_dev->devid; + key.type = BTRFS_DEV_EXTENT_KEY; + key.offset = 0; + + ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); + if (ret < 0) + goto free_path; + if (ret > 0) { + if (path->slots[0] >= + btrfs_header_nritems(path->nodes[0])) { + ret = btrfs_next_leaf(root, path); + if (ret < 0) + goto free_path; + if (ret > 0) { + ret = 0; + goto free_path; + } + } else { + ret = 0; + } + } + + while (1) { + struct extent_buffer *leaf = path->nodes[0]; + int slot = path->slots[0]; + + btrfs_item_key_to_cpu(leaf, &found_key, slot); + + if (found_key.objectid != src_dev->devid) + break; + + if (found_key.type != BTRFS_DEV_EXTENT_KEY) + break; + + if (found_key.offset < key.offset) + break; + + dev_extent = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent); + + chunk_offset = btrfs_dev_extent_chunk_offset(leaf, dev_extent); + + cache = btrfs_lookup_block_group(fs_info, chunk_offset); + if (!cache) + goto skip; + + spin_lock(&cache->lock); + cache->to_copy = 1; + spin_unlock(&cache->lock); + + btrfs_put_block_group(cache); + +skip: + ret = btrfs_next_item(root, path); + if (ret != 0) { + if (ret > 0) + ret = 0; + break; + } + } + +free_path: + btrfs_free_path(path); +unlock: + mutex_unlock(&fs_info->chunk_mutex); + + return ret; +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index 8e8f36c1d28a4..e2309e3b3d7b8 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -79,6 +79,8 @@ void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 length); void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg); void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info); +int btrfs_mark_block_group_to_copy(struct btrfs_fs_info *fs_info, + struct btrfs_device *src_dev); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -237,6 +239,12 @@ static inline void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, static inline void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg) { } static inline void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info) { } + +static inline int btrfs_mark_block_group_to_copy(struct btrfs_fs_info *fs_info, + struct btrfs_device *src_dev) +{ + return 0; +} #endif static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos) From patchwork Wed Nov 24 09:30:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAC77C433F5 for ; Wed, 24 Nov 2021 09:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235809AbhKXJeN (ORCPT ); Wed, 24 Nov 2021 04:34:13 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhKXJeM (ORCPT ); Wed, 24 Nov 2021 04:34:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746263; x=1669282263; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j4KoR74MjkwRH5xZ9AXequZ8I+gK/dyc8cRi2WBWtNo=; b=l/Hip4ZVBt6ZRtv/AQ62RSKyZq22LVxb7bGvFpBU7LZWotFgoWid33fI vXOddaujwdS5DAGL7OOrqKYV866g89EY4OKz2m/hGamtDe5wd9JnrzZwC jKFvYbkteQuW5fuWwJkxt/kdGwfP0tZnJPc5uh38LRvSxjIooItJZdz7M PNgou9Wa8n0VxxBm1G2RU94rwouZzNcJ9ox9VjzaG8GqBZKbrFf3U3cwA FdeMaTYKZ7CI+dwgDWt13U4URiHwdI6EEZWBERiid55IbphnZKXh4/VPk m8JoR82AX7gfljFY+oEwtapB7ZvtA6xWf5DJVq3Jd2uAE3P/zBTizWkvi Q==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499373" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:03 +0800 IronPort-SDR: fJKVASBYmolHy3T+UUF40eLE7yZ3o67/Q4XxQYd40KLjIyu+sipsy2Ji65xHViuOGkdi8zEidJ JIMrCqQCAh0THZVtCm8vmJzLU89Oy0B4U1fL6P2tc7faI2gVqK+prMbo1LH6fcgatGkZDa+oXJ szTWP42YYgXhg2ozYT5cJQFXLEoperIJ0fiAOdWB3MhIM4dNVA6ry+zmYXaIB+/fVRf0K+Kjb+ 6TEwkWIQKqqY+zv9U7I9fqaU+NJGV6k6hYdF2RUcsc8mcDfg7p0J8gjtjEQjZtPDwhk95YiGLj FalUIro7JWpyJf2zFS6zKNGY Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:56 -0800 IronPort-SDR: sKpmhFJoNAih5OgKe0uH6ahqgcQyUWGc/JorgXJGqpbAXsty3JVVwIdp6kynLnMnREHK7cJLtM esTrNNZgIY3Amj5Mumgr6saKmLIZDnqL9tm8yi7dlPVr1vV6I5WSuJ6mWRV0yK0JIu0dNcpwsZ Wuh5eCw0zm6uyzkXmMq8CyF3b4TAakpovj9FslXsNO3PCf7LH7QtOLUKB/o3I9PVFVqh9GAuWh x6gpyaUt7llwSzyoXlVsWpJ5dG/QFrPbrPALNurb1eMGVo+i555n7+BRVoDYDZKF5QwzNHywQM 8FE= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:03 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 07/21] btrfs: zoned: move btrfs_finish_block_group_to_copy to zoned code Date: Wed, 24 Nov 2021 01:30:33 -0800 Message-Id: <1482f3cd38ca134c23c8969a27191a828fc2f64d.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org btrfs_finish_block_group_to_copy is only used in a zoned filesystem so move the code to zoned code. Signed-off-by: Johannes Thumshirn --- fs/btrfs/dev-replace.c | 55 ------------------------------------------ fs/btrfs/dev-replace.h | 3 --- fs/btrfs/zoned.c | 55 ++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/zoned.h | 10 ++++++++ 4 files changed, 65 insertions(+), 58 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 7572d80bff2ac..1fcc5d57e96ef 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -460,61 +460,6 @@ static char* btrfs_dev_name(struct btrfs_device *device) return rcu_str_deref(device->name); } -bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, - struct btrfs_block_group *cache, - u64 physical) -{ - struct btrfs_fs_info *fs_info = cache->fs_info; - struct extent_map *em; - struct map_lookup *map; - u64 chunk_offset = cache->start; - int num_extents, cur_extent; - int i; - - /* Do not use "to_copy" on non zoned filesystem for now */ - if (!btrfs_is_zoned(fs_info)) - return true; - - spin_lock(&cache->lock); - if (cache->removed) { - spin_unlock(&cache->lock); - return true; - } - spin_unlock(&cache->lock); - - em = btrfs_get_chunk_map(fs_info, chunk_offset, 1); - ASSERT(!IS_ERR(em)); - map = em->map_lookup; - - num_extents = cur_extent = 0; - for (i = 0; i < map->num_stripes; i++) { - /* We have more device extent to copy */ - if (srcdev != map->stripes[i].dev) - continue; - - num_extents++; - if (physical == map->stripes[i].physical) - cur_extent = i; - } - - free_extent_map(em); - - if (num_extents > 1 && cur_extent < num_extents - 1) { - /* - * Has more stripes on this device. Keep this block group - * readonly until we finish all the stripes. - */ - return false; - } - - /* Last stripe on this device */ - spin_lock(&cache->lock); - cache->to_copy = 0; - spin_unlock(&cache->lock); - - return true; -} - static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, const char *tgtdev_name, u64 srcdevid, const char *srcdev_name, int read_src) diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h index 3911049a5f231..60b70dacc299b 100644 --- a/fs/btrfs/dev-replace.h +++ b/fs/btrfs/dev-replace.h @@ -18,8 +18,5 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info); void btrfs_dev_replace_suspend_for_unmount(struct btrfs_fs_info *fs_info); int btrfs_resume_dev_replace_async(struct btrfs_fs_info *fs_info); int __pure btrfs_dev_replace_is_ongoing(struct btrfs_dev_replace *dev_replace); -bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, - struct btrfs_block_group *cache, - u64 physical); #endif diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 73bfe30691b01..893d025069275 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2159,3 +2159,58 @@ int btrfs_mark_block_group_to_copy(struct btrfs_fs_info *fs_info, return ret; } + +bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, + struct btrfs_block_group *cache, + u64 physical) +{ + struct btrfs_fs_info *fs_info = cache->fs_info; + struct extent_map *em; + struct map_lookup *map; + u64 chunk_offset = cache->start; + int num_extents, cur_extent; + int i; + + /* Do not use "to_copy" on non zoned filesystem for now */ + if (!btrfs_is_zoned(fs_info)) + return true; + + spin_lock(&cache->lock); + if (cache->removed) { + spin_unlock(&cache->lock); + return true; + } + spin_unlock(&cache->lock); + + em = btrfs_get_chunk_map(fs_info, chunk_offset, 1); + ASSERT(!IS_ERR(em)); + map = em->map_lookup; + + num_extents = cur_extent = 0; + for (i = 0; i < map->num_stripes; i++) { + /* We have more device extent to copy */ + if (srcdev != map->stripes[i].dev) + continue; + + num_extents++; + if (physical == map->stripes[i].physical) + cur_extent = i; + } + + free_extent_map(em); + + if (num_extents > 1 && cur_extent < num_extents - 1) { + /* + * Has more stripes on this device. Keep this block group + * readonly until we finish all the stripes. + */ + return false; + } + + /* Last stripe on this device */ + spin_lock(&cache->lock); + cache->to_copy = 0; + spin_unlock(&cache->lock); + + return true; +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index e2309e3b3d7b8..bc9482cceadc4 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -81,6 +81,9 @@ void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg); void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info); int btrfs_mark_block_group_to_copy(struct btrfs_fs_info *fs_info, struct btrfs_device *src_dev); +bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, + struct btrfs_block_group *cache, + u64 physical); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -245,6 +248,13 @@ static inline int btrfs_mark_block_group_to_copy(struct btrfs_fs_info *fs_info, { return 0; } + +static inline bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, + struct btrfs_block_group *cache, + u64 physical) +{ + return true; +} #endif static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos) From patchwork Wed Nov 24 09:30:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 703DDC433EF for ; Wed, 24 Nov 2021 09:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235903AbhKXJeO (ORCPT ); Wed, 24 Nov 2021 04:34:14 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234162AbhKXJeN (ORCPT ); Wed, 24 Nov 2021 04:34:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746264; x=1669282264; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xE+TYty/OMsXJfgya3A49OLsuQBhGBt3WDaA3c96EoU=; b=pRTlXLKox74MEGinZ8XDpbX2iac3fbqXNc36PJZPmNu/VFqtGIq2kr8e 83iyeOGhJge+gXJFpT4+UkiFLSVJAv3EFFyh1t0qWrl/snS4gH9EOfstw JDRFFOFJoRLAYDlIHLCwxpGVsdEDP+iOH1ag2U3NFvzj1dBRzZv8ojQ2n 4GR3Ab4Y4RY2MGLfAKTO0MDME7akL6ahnQUpd1fHVu1x9GY3f9BUkNHPO SUCqjyMlY/t/tQ3SHQcRw/KL370S5oPZcbHRENfTCd/4FqcLZhk66Ae32 I8EJGNwc4Y3KOr7RefvjroWINiJQXLoi6XJxkVfmI6vQrTSBtqOdePdaZ w==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499379" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:04 +0800 IronPort-SDR: UCpdzJ84MDgOyxTtCrtuVHyf91BhLregw0NIyb1G21Ux3i6rt4zU9r0xWCIzLf8eSvtKcjKPoA IfvqOIi2LRslZhltrzTnX8Q4KZJETLwfhwqLKH/cE95u+4Lajw2HxDplROz+pHchymycdkGuYe MGb9Q81s0LwrhflL9SFob4XCQIyZiSPftpv9zod9JRhQLfRkQg4lsbr6Mn2Pv0ajrQyu+/3Lov 6KfTh5dPr9QpiA/5XmEvtdC66oQzJ4VHT355k2rbmxtrhrevm8xYCUVEK/kTWVEYzM070X6u2U F/J31cytNKjPLvMt+j+X+REa Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:57 -0800 IronPort-SDR: ErxljmQbX7DjuqOEB6gHf3ZAFKplY9eD7X2nlPgewWAil/rgIFgcHo/b87yKY/bJ2MerRcMKBi oe1ZTjWTrDXHyI8Qg2HcrfWrQQFT9fxRVPe79vvNMpHOy/G/w0M2Oxr3uqMzt5GmOZiqKZLiYw xvt6iGr3scEY9qHPmucIto7W6uUNNlBnC7Ais2rAILZOw2X/JocbmiEWty8hGyEovPqp1LD+8X xpBL/Nuypb+MxagfqyUcz/lSrr6WEgpoFbH3PiS7SmMBvkI9q9zMxVY2qijjvMqVjFwrdp9UWF oig= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:04 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 08/21] btrfs: zoned: move is_block_group_to_copy to zoned code Date: Wed, 24 Nov 2021 01:30:34 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org is_block_group_to_copy() is only used in a zoned filesystem, so move the code to zoned code. Signed-off-by: Johannes Thumshirn --- fs/btrfs/volumes.c | 22 ++-------------------- fs/btrfs/zoned.c | 19 +++++++++++++++++++ fs/btrfs/zoned.h | 7 +++++++ 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index d0615256dacc3..23459328d19bc 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -6171,25 +6171,6 @@ static int get_extra_mirror_from_replace(struct btrfs_fs_info *fs_info, return ret; } -static bool is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical) -{ - struct btrfs_block_group *cache; - bool ret; - - /* Non zoned filesystem does not use "to_copy" flag */ - if (!btrfs_is_zoned(fs_info)) - return false; - - cache = btrfs_lookup_block_group(fs_info, logical); - - spin_lock(&cache->lock); - ret = cache->to_copy; - spin_unlock(&cache->lock); - - btrfs_put_block_group(cache); - return ret; -} - static void handle_ops_on_dev_replace(enum btrfs_map_op op, struct btrfs_io_context **bioc_ret, struct btrfs_dev_replace *dev_replace, @@ -6210,7 +6191,8 @@ static void handle_ops_on_dev_replace(enum btrfs_map_op op, * A block group which have "to_copy" set will eventually * copied by dev-replace process. We can avoid cloning IO here. */ - if (is_block_group_to_copy(dev_replace->srcdev->fs_info, logical)) + if (btrfs_is_block_group_to_copy(dev_replace->srcdev->fs_info, + logical)) return; /* diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 893d025069275..61d1e1c67a742 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2214,3 +2214,22 @@ bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, return true; } + +bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical) +{ + struct btrfs_block_group *cache; + bool ret; + + /* Non zoned filesystem does not use "to_copy" flag */ + if (!btrfs_is_zoned(fs_info)) + return false; + + cache = btrfs_lookup_block_group(fs_info, logical); + + spin_lock(&cache->lock); + ret = cache->to_copy; + spin_unlock(&cache->lock); + + btrfs_put_block_group(cache); + return ret; +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index bc9482cceadc4..487c699f152d4 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -84,6 +84,7 @@ int btrfs_mark_block_group_to_copy(struct btrfs_fs_info *fs_info, bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, struct btrfs_block_group *cache, u64 physical); +bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -255,6 +256,12 @@ static inline bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, { return true; } + +static bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, + u64 logical) +{ + return false; +} #endif static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos) From patchwork Wed Nov 24 09:30:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA1D2C4332F for ; Wed, 24 Nov 2021 09:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236181AbhKXJeQ (ORCPT ); Wed, 24 Nov 2021 04:34:16 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235832AbhKXJeP (ORCPT ); Wed, 24 Nov 2021 04:34:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746266; x=1669282266; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x7yvu98ERR/ovrQiMkVrafuES9bRSxEkK10e5TDFVoo=; b=CVwxxmrc6+nbZha8dOFwWFUg3nmw+Nu3R6zTodTR9qvuG3MXq/4EMikF vQoShQB2IUfhz0+orSeJFxSWdU6g/w+E6Y7M1dTZyAwDu+ZvYLTcNE1kk Cg2mlwV2p8s7OIQl5v5QEAbFVhxq5HXeAh91cBNDq4o9V+LxSXXGA3mkL ihIg8d9ZEzmIZdnaYX/wzXUyQUQWckq8axrRxPVj6bLx3nTWUc8q2ahm6 F6x8r400YSm8sFbW8EXU33fjKmOzTIrpQTnwV2sOJyr11anLWx+RcOo6r waEO3ti0BlP5hqSB+QkacirtRqFkw0gOJU9qw5RuZUmSeF4yCTp3EmAzo A==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499382" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:06 +0800 IronPort-SDR: 1o4wHzPUVm1INkpbHAMsrgnGWx5vY1H8i4Ayg0XVTiLCG9qP3LrTJqG93H0vruKBSl8IgRtukq is8HIuKArf2qtoqrWKnUtY2egwgG5qk7sGnkspsiQUlM+6a1EwI1+NWQf/DAPczTRvVnWWX4ge NNH0lTvgUsOKdPwWWFidIox3sh9SnBVrbo0yL7x8Qm8caaYLR4uUBbt/zBC2/gJt5knebIBYtR 54qKz1qObkFIVZOaIdwf6qPUmDJdeTET44PTCowoNuwsleYyfRR3mWZ6Ttmo9FdiXj002RTGXn UI/HLB4oQpwdtDxWb0cj+z8E Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:05:59 -0800 IronPort-SDR: JfG9/BYsNmzqU76nrIo5G0xuEXr0NPm43ejKlyRz0g7Xy9gC5/WzXhY0FiYTsr8k/09quZ4le+ ptt0u56z4VYQo76aJldE9RSaCWuD5i9Yvpjp+Gb70DsMYuVLxvkpX7PeaAcXnfAb8+5blruUyJ 2gdnKCkCsS7D7HvlToJjs5G0xmqSvZv+YrIl2Uy5ikr6ACIYeu7JZWwrsioiWLQM+F/x3mPnUb MGKYV//EdXocKM702NgWqgxkhwtEaB9pkZhHO7dNZms9qmd2YcBNENnReojoeK1uJLOee+PZlC qAs= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:05 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 09/21] btrfs: zoned: skip zoned check if block_group is marked as copy Date: Wed, 24 Nov 2021 01:30:35 -0800 Message-Id: <9cf41680544814baa4fe3ba3424a01a47475526c.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org When enumerating chunks for scrub, we check if the block_group is marked as to copy and if yes we skip the block_group. As the to_copy logic is only used in a zoned filesystem, it's pointless to check if the filesystem is zoned. Signed-off-by: Johannes Thumshirn Reported-by: kernel test robot --- fs/btrfs/scrub.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 30bb304bb5e9a..70cf1f487748c 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3732,15 +3732,13 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, if (!cache) goto skip; - if (sctx->is_dev_replace && btrfs_is_zoned(fs_info)) { - spin_lock(&cache->lock); - if (!cache->to_copy) { - spin_unlock(&cache->lock); - btrfs_put_block_group(cache); - goto skip; - } + spin_lock(&cache->lock); + if (sctx->is_dev_replace && !cache->to_copy) { spin_unlock(&cache->lock); + btrfs_put_block_group(cache); + goto skip; } + spin_unlock(&cache->lock); /* * Make sure that while we are scrubbing the corresponding block From patchwork Wed Nov 24 09:30:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 984DBC433FE for ; Wed, 24 Nov 2021 09:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236317AbhKXJeT (ORCPT ); Wed, 24 Nov 2021 04:34:19 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235832AbhKXJeR (ORCPT ); Wed, 24 Nov 2021 04:34:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746267; x=1669282267; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7jfc/KCErquPyexUWVZVcZY6iL3KXxJrEE+HDGDRKcw=; b=CcsN2HdyHi3XDA1ZhcMDe1t2uezFmONiTY5PZ5gH0IR5l6byhUM5yUUt NmMIEDMmKwKyHGMlgUUicDwhFo4f1QQmaEn+iQkf7xecd/IRWcatOJESk UtgXsDbQP4giDxYNeX0jSEwd643feijJoWwgNVnJII1JD5isjZLLznz2r QYI9O4Srx+A04cGSWaVj404cizh/bBQ9XGhLKsAKpsDYujJhjV96H/ZKP DwopNLTflkd990kNADTOtpaErHzKol3Pp6258Bgo/VR3asDJPIEmwGiB/ zZb2VqE021yi6QHlDAV8Wth5rN5SmxFZ/7zy5jYF1GBG5OsGow+jrFHPP g==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499385" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:07 +0800 IronPort-SDR: Ji63bjVabtHiX8tEOuTJxI8G54JkTDN70n5AMgxTryBfEycMgUNaL74D0Q62rBAvu0eFZZw/7S vU69VTvYx2fq8WKpaGEq/n1JSVEpMZ/vUxKcJhLOd89YGZbNK9+6VlyzsEb/kxlUIhIP/Jc/o+ zT3CA+qeDXUk5R8tQU7uBoyR65s8Dw+XIYDVmqh+APscULxkiX1j3S2AVEnUvVDNZt2O6MVPnd hyordezCgrXXTCvF9X11NtfrAZgBg3YhaEuPuYUVpVAf8pqdnCgrfiyIfFLgb7aWR+MEqO8hWG IbD1vUmTFQOIasH5ZgZ2iL0D Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:00 -0800 IronPort-SDR: a6jYCxwZN9DSH98a23W4x/Ro1xqI7cH1Fs708RQCRrfc6i5Md52tJ4ZCXvAu6/C7ZhaUijfvVJ shAfpCBCGa8yMuuECYRKjWjGYndfnkN1QENUKFEHHgjh4e9R4VUXi/rp3NCGFry5NObto9kqug X6C2lhBmfh7FoX95Q+t4Ni6VEvksyjxcvV8iq/xYQzR+YFuTyp8HDjJOeVsUDXaP1MyeNEPIbf QBCS75LDQyrrRlmHr+r/mSjNd+APkJyNDUvaB7C6fEFIpLdhyrYHbp8bktI4FmBLR9dfUUbVKO 5mg= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:07 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 10/21] btrfs: move struct scrub_ctx to scrub.h Date: Wed, 24 Nov 2021 01:30:36 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Move 'struct scrub_ctx' to the newly created scrub.h file. This is a preparation step for moving zoned only code from scrub.c to zoned.c. Signed-off-by: Johannes Thumshirn --- fs/btrfs/scrub.c | 44 +---------------------------------------- fs/btrfs/scrub.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 43 deletions(-) create mode 100644 fs/btrfs/scrub.h diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 70cf1f487748c..a2c42ff544701 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -21,6 +21,7 @@ #include "raid56.h" #include "block-group.h" #include "zoned.h" +#include "scrub.h" /* * This is only the first step towards a full-features scrub. It reads all @@ -46,7 +47,6 @@ struct scrub_ctx; */ #define SCRUB_PAGES_PER_RD_BIO 32 /* 128k per bio */ #define SCRUB_PAGES_PER_WR_BIO 32 /* 128k per bio */ -#define SCRUB_BIOS_PER_SCTX 64 /* 8MB per device in flight */ /* * the following value times PAGE_SIZE needs to be large enough to match the @@ -151,48 +151,6 @@ struct scrub_parity { unsigned long bitmap[]; }; -struct scrub_ctx { - struct scrub_bio *bios[SCRUB_BIOS_PER_SCTX]; - struct btrfs_fs_info *fs_info; - int first_free; - int curr; - atomic_t bios_in_flight; - atomic_t workers_pending; - spinlock_t list_lock; - wait_queue_head_t list_wait; - struct list_head csum_list; - atomic_t cancel_req; - int readonly; - int pages_per_rd_bio; - - /* State of IO submission throttling affecting the associated device */ - ktime_t throttle_deadline; - u64 throttle_sent; - - int is_dev_replace; - u64 write_pointer; - - struct scrub_bio *wr_curr_bio; - struct mutex wr_lock; - int pages_per_wr_bio; /* <= SCRUB_PAGES_PER_WR_BIO */ - struct btrfs_device *wr_tgtdev; - bool flush_all_writes; - - /* - * statistics - */ - struct btrfs_scrub_progress stat; - spinlock_t stat_lock; - - /* - * Use a ref counter to avoid use-after-free issues. Scrub workers - * decrement bios_in_flight and workers_pending and then do a wakeup - * on the list_wait wait queue. We must ensure the main scrub task - * doesn't free the scrub context before or while the workers are - * doing the wakeup() call. - */ - refcount_t refs; -}; struct scrub_warning { struct btrfs_path *path; diff --git a/fs/btrfs/scrub.h b/fs/btrfs/scrub.h new file mode 100644 index 0000000000000..3eb8c8905c902 --- /dev/null +++ b/fs/btrfs/scrub.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef BTRFS_SCRUB_H +#define BTRFS_SCRUB_H + +#define SCRUB_BIOS_PER_SCTX 64 /* 8MB per device in flight */ + +struct scrub_ctx { + struct scrub_bio *bios[SCRUB_BIOS_PER_SCTX]; + struct btrfs_fs_info *fs_info; + int first_free; + int curr; + atomic_t bios_in_flight; + atomic_t workers_pending; + spinlock_t list_lock; + wait_queue_head_t list_wait; + struct list_head csum_list; + atomic_t cancel_req; + int readonly; + int pages_per_rd_bio; + + /* State of IO submission throttling affecting the associated device */ + ktime_t throttle_deadline; + u64 throttle_sent; + + int is_dev_replace; + u64 write_pointer; + + struct scrub_bio *wr_curr_bio; + struct mutex wr_lock; + int pages_per_wr_bio; /* <= SCRUB_PAGES_PER_WR_BIO */ + struct btrfs_device *wr_tgtdev; + bool flush_all_writes; + + /* + * statistics + */ + struct btrfs_scrub_progress stat; + spinlock_t stat_lock; + + /* + * Use a ref counter to avoid use-after-free issues. Scrub workers + * decrement bios_in_flight and workers_pending and then do a wakeup + * on the list_wait wait queue. We must ensure the main scrub task + * doesn't free the scrub context before or while the workers are + * doing the wakeup() call. + */ + refcount_t refs; +}; + +#endif /* BTRFS_SCRUB_H */ From patchwork Wed Nov 24 09:30:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7695AC433F5 for ; Wed, 24 Nov 2021 09:31:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236250AbhKXJeU (ORCPT ); Wed, 24 Nov 2021 04:34:20 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32168 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236285AbhKXJeT (ORCPT ); Wed, 24 Nov 2021 04:34:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746269; x=1669282269; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O4hY8jbfXQslKD7lX4Qh0KbUxOhO6E5hGGNMbQHxGUQ=; b=Eu2QFUjR2SVVVPVFdzyXBOZCmk7aa+xwHqhCn5CJq/h9oJwjh5VHu2CU KN+hFgn1IhItC77jZsSyT6HzdsK2r2GkQ6W30yb7UrfxOc5CSgiHMYoIa Dzf9w136c5aOQhdNPA4vAyM793FheXjjZoHdHFM0LjgLO+EDqC/B/9W4l OLfTwJqlv/qx39LaCgjFrxl8A7gqUP3CG2V6RCWYTl0dNlchN/WXLvIt3 v5QdtBRvHmA8KqdQGAwf7MPkBl7MREj8cGxwxxMN0u9+oFByWc1f4Q3Sa 6Jil+kokTIjx8viyg5MtWnBN1BPbA3EKXXUTuzelZDUuEQtGR5/Ha1l3j g==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499387" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:09 +0800 IronPort-SDR: 1E/GV8aSGVBZfnv6gHvlR1bI8XmCSLKbtFPOjFw4TERGeel9zdTVuKNkdqZCX0A4/LYDdBB6xk MCh2XA8lX3M3ukHJj9znC7Rq0x5sYW5krzdSdvW2S873lrn+EQ1BM7hJ4vTpDwSMX1D0p9GasI SkNp/kR1BMqUMs8xd2+8T8HtUfy5oflPFw2hsnoo5kYfIOHXVrryQnQFAoYEs6r2blHs0K+fyV Y+4PsamOEPEGNHop/CcbV0mKtYgg8hVJ9MNlOqP40gR28iT5bVJlO4vRAyc9PZfhtL7wzdCLbB yWArx0FEFaHYhBur847KspUl Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:02 -0800 IronPort-SDR: MnbnYvE1Zz25BbAA72agQmUPq5oYmavyxKqbJUt1GpCw50YrVCEgJywIfXUgSM1wWyTA1t45JQ MblegT+w6QnB+smR9mdchLXalmX9dp9jiy6CEnvvL8aAmw3CbKs3y7pYHQvhKpj/d0ST0e6ORn 5el0CDoGPTEbtBYxvVbYH4qcvkNy4TalRce9Dv6yEG6yS70Y/U9ECOh2u88eawspNNGMAX+JpE VBGRUuouPQ2prxlXFvlLysam4NbgSP3tVJlrytH0e/LvWz33j0pJTzClB4m5attPZ2EQP79c+v 5lA= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:08 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 11/21] btrfs: zoned: move fill_writer_pointer_gap to zoned code Date: Wed, 24 Nov 2021 01:30:37 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org fill_writer_pointer_gap() is only used in a zoned filesystem, so move it to zoned code. Signed-off-by: Johannes Thumshirn --- fs/btrfs/scrub.c | 23 +---------------------- fs/btrfs/zoned.c | 23 +++++++++++++++++++++++ fs/btrfs/zoned.h | 6 ++++++ 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index a2c42ff544701..64728ca585c52 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1576,27 +1576,6 @@ static int scrub_write_page_to_dev_replace(struct scrub_block *sblock, return scrub_add_page_to_wr_bio(sblock->sctx, spage); } -static int fill_writer_pointer_gap(struct scrub_ctx *sctx, u64 physical) -{ - int ret = 0; - u64 length; - - if (!btrfs_is_zoned(sctx->fs_info)) - return 0; - - if (!btrfs_dev_is_sequential(sctx->wr_tgtdev, physical)) - return 0; - - if (sctx->write_pointer < physical) { - length = physical - sctx->write_pointer; - - ret = btrfs_zoned_issue_zeroout(sctx->wr_tgtdev, - sctx->write_pointer, length); - if (!ret) - sctx->write_pointer = physical; - } - return ret; -} static int scrub_add_page_to_wr_bio(struct scrub_ctx *sctx, struct scrub_page *spage) @@ -1621,7 +1600,7 @@ static int scrub_add_page_to_wr_bio(struct scrub_ctx *sctx, if (sbio->page_count == 0) { struct bio *bio; - ret = fill_writer_pointer_gap(sctx, + ret = btrfs_fill_writer_pointer_gap(sctx, spage->physical_for_dev_replace); if (ret) { mutex_unlock(&sctx->wr_lock); diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 61d1e1c67a742..8493093aea849 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -15,6 +15,7 @@ #include "transaction.h" #include "dev-replace.h" #include "space-info.h" +#include "scrub.h" /* Maximum number of zones to report per blkdev_report_zones() call */ #define BTRFS_REPORT_NR_ZONES 4096 @@ -2233,3 +2234,25 @@ bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical) btrfs_put_block_group(cache); return ret; } + +int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, u64 physical) +{ + int ret = 0; + u64 length; + + if (!btrfs_is_zoned(sctx->fs_info)) + return 0; + + if (!btrfs_dev_is_sequential(sctx->wr_tgtdev, physical)) + return 0; + + if (sctx->write_pointer < physical) { + length = physical - sctx->write_pointer; + + ret = btrfs_zoned_issue_zeroout(sctx->wr_tgtdev, + sctx->write_pointer, length); + if (!ret) + sctx->write_pointer = physical; + } + return ret; +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index 487c699f152d4..5701f659b1c39 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -85,6 +85,7 @@ bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, struct btrfs_block_group *cache, u64 physical); bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical); +int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, u64 physical); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -262,6 +263,11 @@ static bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, { return false; } +static inline int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, + u64 physical) +{ + return 0; +} #endif static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos) From patchwork Wed Nov 24 09:30:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A6EBC433EF for ; Wed, 24 Nov 2021 09:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236283AbhKXJeV (ORCPT ); Wed, 24 Nov 2021 04:34:21 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32189 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236390AbhKXJeT (ORCPT ); Wed, 24 Nov 2021 04:34:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746270; x=1669282270; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UTuGe4lBjgN0TXdQ8GTLGuagnkDOF2eeQeXaYNdBUoE=; b=qa5Oz/VTRO5M5IZx8t+NQB8EDRGia2hkDTzrdvK1UxTR+KFHsokJDm6h V63L774KEN29D204GMxXYQHNANKM/mog8Vr7jpPwZYmG19cowNCWrDG7d 3W8NN2Rdg+2nxC8ASy347fsEVqQrhVCqOAArP6JazyJacQ6ieEGTne9Pj MoteasivYdKnHNbbeKdV48wVQ4ol4VZifEU5AGzP41NLrhJONtWMSCIPr hGb6KjjqsLIbXxtW/iuX/MIdKFDcKy34aqDOKJ+0+XpIfFwciBn17j1VS yB5jsqr/BrREVc9RHxR7IpWj2m+7TWCB9KHhXpf8K1rzuvDvlUAcZTyG4 w==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499390" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:10 +0800 IronPort-SDR: wRSf1sxkWR4gV2tRO+u3X4eZd2iN79b8UmqQ18okMLyWb5eWuanZ/S6xaJmlujCXadi7PqbDyo VmUbA20hlT+eg6dM9+HBPZ8xHplNMko8S9wKxDAaz7a6BMELUI6HD6HiB8YE+aIZHUu4Ccld85 FUi5q0qhqKi4DA7xfa789OJS9ZXGk01Vo0v6IBo7Q4RfZ6l7VO7nC1p1StLEFo00kPXGagaB4c SUVnd1idlWj4d9av93zughgLgOY3fOufblxsHfE/A/pqSHWVSL0/Ud5khNjLx08iTHLgld1jNR ID5DhWUgUUHLRAl//zF6mgRh Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:03 -0800 IronPort-SDR: D/md3Uf7aeyh3PWl/xHFo/uLgUtxn48C8QBMwmoBNBsiHscJ/DMCDWKSOzfbCCT2pcQD1esR55 PciUrUMBVQqTVxgtNEWKzxR8F9psfxCHAaaYHhqwpfxvm6Vi3IWxDMz+OhPxCaUzV1DkKXsy+i UWaZDRYbEk9Ujc6HuAB9jPNXNJtmJ/CtFaGfiKcycmY3nOmDuoZd2Rqtg5OQXXjDjSSrvJM82g 7G3BfBal2FZHYOm6FWr3Rug6uZzCp7RvvnKQtkRq4V2lzneZzncAyIA1HR2Ib/du1RgZ3kxiWz b2c= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:10 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 12/21] btrfs: zoned: sync_write_pointer_for_zoned to zoned code Date: Wed, 24 Nov 2021 01:30:38 -0800 Message-Id: <86b1dd2b2353205392b92acf682d983d2f3ac9a5.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org sync_write_pointer_for_zoned() is only used on a zoned filesystem, so move it to zoned code. Signed-off-by: Johannes Thumshirn --- fs/btrfs/scrub.c | 28 +--------------------------- fs/btrfs/zoned.c | 26 ++++++++++++++++++++++++++ fs/btrfs/zoned.h | 9 +++++++++ 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 64728ca585c52..ccb74f2e75b92 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3071,32 +3071,6 @@ static void sync_replace_for_zoned(struct scrub_ctx *sctx) wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); } -static int sync_write_pointer_for_zoned(struct scrub_ctx *sctx, u64 logical, - u64 physical, u64 physical_end) -{ - struct btrfs_fs_info *fs_info = sctx->fs_info; - int ret = 0; - - if (!btrfs_is_zoned(fs_info)) - return 0; - - wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); - - mutex_lock(&sctx->wr_lock); - if (sctx->write_pointer < physical_end) { - ret = btrfs_sync_zone_write_pointer(sctx->wr_tgtdev, logical, - physical, - sctx->write_pointer); - if (ret) - btrfs_err(fs_info, - "zoned: failed to recover write pointer"); - } - mutex_unlock(&sctx->wr_lock); - btrfs_dev_clear_zone_empty(sctx->wr_tgtdev, physical); - - return ret; -} - static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, struct map_lookup *map, struct btrfs_device *scrub_dev, @@ -3502,7 +3476,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, if (sctx->is_dev_replace && ret >= 0) { int ret2; - ret2 = sync_write_pointer_for_zoned(sctx, base + offset, + ret2 = btrfs_sync_write_pointer_for_zoned(sctx, base + offset, map->stripes[num].physical, physical_end); if (ret2) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 8493093aea849..7f3e3e34fd783 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2256,3 +2256,29 @@ int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, u64 physical) } return ret; } + +int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, u64 logical, + u64 physical, u64 physical_end) +{ + struct btrfs_fs_info *fs_info = sctx->fs_info; + int ret = 0; + + if (!btrfs_is_zoned(fs_info)) + return 0; + + wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); + + mutex_lock(&sctx->wr_lock); + if (sctx->write_pointer < physical_end) { + ret = btrfs_sync_zone_write_pointer(sctx->wr_tgtdev, logical, + physical, + sctx->write_pointer); + if (ret) + btrfs_err(fs_info, + "zoned: failed to recover write pointer"); + } + mutex_unlock(&sctx->wr_lock); + btrfs_dev_clear_zone_empty(sctx->wr_tgtdev, physical); + + return ret; +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index 5701f659b1c39..db2baebab8f50 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -86,6 +86,8 @@ bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev, u64 physical); bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical); int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, u64 physical); +int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, u64 logical, + u64 physical, u64 physical_end); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -268,6 +270,13 @@ static inline int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, { return 0; } + +static inline int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, + u64 logical, u64 physical, + u64 physical_end) +{ + return 0; +} #endif static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos) From patchwork Wed Nov 24 09:30:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636457 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03DC4C433EF for ; Wed, 24 Nov 2021 09:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236593AbhKXJeW (ORCPT ); Wed, 24 Nov 2021 04:34:22 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32191 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236369AbhKXJeV (ORCPT ); Wed, 24 Nov 2021 04:34:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746272; x=1669282272; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q1glLP4sT4hMYmABYjYwYRwYuJ2+Z8WPp8SZjGs2ZSs=; b=qeF2ereZDgysx8xy3SXkGb/8aR4w99RLzS6OMT/rDA7iEGengLq691MU TqJKB5GdKXtDCE0nFD2xCr0OBFQ6WFt99h864WsHS+j9nLJTAswNr+LLk a5R1VlsWjn8ul+ngKU2Qt/shguH60bkdoXPq3YyuqCU8Oeu3DB62pM7Dp 4e2VHIdgTdQU60hzHxhQkoI2nvoqtz1sjq6d9uEkehqd+Mx/8u1BZLe9w VTU1oZKI8sgthexCorqbIlFBIkkgp3iZnSv15GxXGlRhq4b+T5P/fQnSm ks+eEKQMTZ/jz3ADlADvhB91mVZFK4diYxHQ/o+kgjxczRqM1t47/HNoP w==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499392" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:11 +0800 IronPort-SDR: jO6miHcbgQ+3MqT8d7pB5JE+OwdfnG3DcUBLuM1fyxSeSTm08gFwH0sErixuw4WdvRg9eGjDii NGHZ3fuI+QYDIsCy7CxlWknm9DnQbbAUuBFYpC2h2jy1zsJ445KMHV1JyELv4vLWvE1JsW7AVt zmlOcLgPNB9Mo+o6X2yl5iypQmERL5SY4BXY/dYfekEzZOk+51LpQqbhT/E1snIOBd6CrCA8Wi HHjwOeypLAeUyZAYEj/PspTU/6svBv5fiDNtpkA8bf7BPfC8GFMZ0MoIi/cXNyvSPSNsi+blMX cuxSqio/ZXmRMKpficDXYHyU Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:04 -0800 IronPort-SDR: k1yo4ulkPrvJuNeybE05KY7Yjcak6YOinT3hHNeBULUe0vzLFGVyQnwUjPrLPiwXguXbM+M5UV nw2UsNIUc0GUmGyqbNdXRvRbnudm41f3rJFku17+NebHrTFzLk4BJ38k9uA7NasY0Ru38Xr/3K M8iLwKrNW3dIuIWH2X7o1bvDAz8N08RvW5f00TIZJA91vIABglGNNm8LCS2oNXBGOaq/am8XvR 5jZBh9oXE4GGVc7K8XCZZaYcCAritFgQxw0/Z5v1Qb9DeoMbJhIybNxqACZmsLK3IOO1C97T1N ex4= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:11 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 13/21] btrfs: make scrub_submit and scrub_wr_submit non-static Date: Wed, 24 Nov 2021 01:30:39 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org This is a preparation for moving zoned related code out of scrub.c and into zoned.c. Signed-off-by: Johannes Thumshirn --- fs/btrfs/scrub.c | 43 +++++++++++++++++++++---------------------- fs/btrfs/scrub.h | 2 ++ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index ccb74f2e75b92..e8fa305f71a10 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -204,7 +204,6 @@ static void scrub_remap_extent(struct btrfs_fs_info *fs_info, int *extent_mirror_num); static int scrub_add_page_to_wr_bio(struct scrub_ctx *sctx, struct scrub_page *spage); -static void scrub_wr_submit(struct scrub_ctx *sctx); static void scrub_wr_bio_end_io(struct bio *bio); static void scrub_wr_bio_end_io_worker(struct btrfs_work *work); static void scrub_put_ctx(struct scrub_ctx *sctx); @@ -1626,7 +1625,7 @@ static int scrub_add_page_to_wr_bio(struct scrub_ctx *sctx, spage->physical_for_dev_replace || sbio->logical + sbio->page_count * sectorsize != spage->logical) { - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); goto again; } @@ -1638,7 +1637,7 @@ static int scrub_add_page_to_wr_bio(struct scrub_ctx *sctx, mutex_unlock(&sctx->wr_lock); return -EIO; } - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); goto again; } @@ -1646,13 +1645,13 @@ static int scrub_add_page_to_wr_bio(struct scrub_ctx *sctx, scrub_page_get(spage); sbio->page_count++; if (sbio->page_count == sctx->pages_per_wr_bio) - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); return 0; } -static void scrub_wr_submit(struct scrub_ctx *sctx) +void btrfs_scrub_wr_submit(struct scrub_ctx *sctx) { struct scrub_bio *sbio; @@ -1989,7 +1988,7 @@ static void scrub_throttle(struct scrub_ctx *sctx) sctx->throttle_deadline = 0; } -static void scrub_submit(struct scrub_ctx *sctx) +void btrfs_scrub_submit(struct scrub_ctx *sctx) { struct scrub_bio *sbio; @@ -2053,7 +2052,7 @@ static int scrub_add_page_to_rd_bio(struct scrub_ctx *sctx, sbio->logical + sbio->page_count * sectorsize != spage->logical || sbio->dev != spage->dev) { - scrub_submit(sctx); + btrfs_scrub_submit(sctx); goto again; } @@ -2065,7 +2064,7 @@ static int scrub_add_page_to_rd_bio(struct scrub_ctx *sctx, sbio->bio = NULL; return -EIO; } - scrub_submit(sctx); + btrfs_scrub_submit(sctx); goto again; } @@ -2073,7 +2072,7 @@ static int scrub_add_page_to_rd_bio(struct scrub_ctx *sctx, atomic_inc(&sblock->outstanding_pages); sbio->page_count++; if (sbio->page_count == sctx->pages_per_rd_bio) - scrub_submit(sctx); + btrfs_scrub_submit(sctx); return 0; } @@ -2125,7 +2124,7 @@ static void scrub_missing_raid56_worker(struct btrfs_work *work) if (sctx->is_dev_replace && sctx->flush_all_writes) { mutex_lock(&sctx->wr_lock); - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); } @@ -2281,7 +2280,7 @@ static int scrub_pages(struct scrub_ctx *sctx, u64 logical, u32 len, } if (flags & BTRFS_EXTENT_FLAG_SUPER) - scrub_submit(sctx); + btrfs_scrub_submit(sctx); } /* last one frees, either here or in bio completion for last page */ @@ -2335,7 +2334,7 @@ static void scrub_bio_end_io_worker(struct btrfs_work *work) if (sctx->is_dev_replace && sctx->flush_all_writes) { mutex_lock(&sctx->wr_lock); - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); } @@ -3048,9 +3047,9 @@ static noinline_for_stack int scrub_raid56_parity(struct scrub_ctx *sctx, logic_end - logic_start); } scrub_parity_put(sparity); - scrub_submit(sctx); + btrfs_scrub_submit(sctx); mutex_lock(&sctx->wr_lock); - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); btrfs_release_path(path); @@ -3063,9 +3062,9 @@ static void sync_replace_for_zoned(struct scrub_ctx *sctx) return; sctx->flush_all_writes = true; - scrub_submit(sctx); + btrfs_scrub_submit(sctx); mutex_lock(&sctx->wr_lock); - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); @@ -3233,9 +3232,9 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, if (atomic_read(&fs_info->scrub_pause_req)) { /* push queued extents */ sctx->flush_all_writes = true; - scrub_submit(sctx); + btrfs_scrub_submit(sctx); mutex_lock(&sctx->wr_lock); - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); @@ -3464,9 +3463,9 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, } out: /* push queued extents */ - scrub_submit(sctx); + btrfs_scrub_submit(sctx); mutex_lock(&sctx->wr_lock); - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); blk_finish_plug(&plug); @@ -3778,9 +3777,9 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, * changes to 0. */ sctx->flush_all_writes = true; - scrub_submit(sctx); + btrfs_scrub_submit(sctx); mutex_lock(&sctx->wr_lock); - scrub_wr_submit(sctx); + btrfs_scrub_wr_submit(sctx); mutex_unlock(&sctx->wr_lock); wait_event(sctx->list_wait, diff --git a/fs/btrfs/scrub.h b/fs/btrfs/scrub.h index 3eb8c8905c902..8d17fac108556 100644 --- a/fs/btrfs/scrub.h +++ b/fs/btrfs/scrub.h @@ -48,4 +48,6 @@ struct scrub_ctx { refcount_t refs; }; +void btrfs_scrub_submit(struct scrub_ctx *sctx); +void btrfs_scrub_wr_submit(struct scrub_ctx *sctx); #endif /* BTRFS_SCRUB_H */ From patchwork Wed Nov 24 09:30:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63DB9C433F5 for ; Wed, 24 Nov 2021 09:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236591AbhKXJe0 (ORCPT ); Wed, 24 Nov 2021 04:34:26 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32191 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236558AbhKXJeW (ORCPT ); Wed, 24 Nov 2021 04:34:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746273; x=1669282273; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3rebnCrYtXdEFqZRYOSFTiBaprzOsQ6+v75pqy+nwB8=; b=i/aopnB7lAM1+qaiQVhSqjeYM5kHVeqWp3HgDv0nhxBlIErdSCHV6fl+ uZ4TF3BTVzyNcgAm6X0+MOZv96rq+8lX/g9bH1U3ACHTqKCFC7h1LFw6b K7K+1cJ1cQKgon34aVVgP3GwAMBspcQQgXL63PId2a8xYsgDzEv5Bxmsa TttNjigcktLFPDBReKGPy6/zX42Ji6SH+TqUpuIYVfRC8y6qA0QMgoZO1 NJzxSXvUlzOKbe5wsMRrNiWBdV3tEyb4/osu0UChHUaL7zPbCGF8AeLHc xmsDYBkzVZeO1rcNVMWv5uZi2LQWMyH5afJy0INhAqcm/AV87n1nLKzWb g==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499394" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:12 +0800 IronPort-SDR: +yc8RCUsdU9+CssXlf2jSiTLUC4sxjOIMDTLGGN18EMXCVCRqNDPViZwX3XdBkzEppmxU3wdUy c7li5JnxKDb6GyRIX9RxRQxi347Mk6zOx5FSoc/mEiaMIR+0Q4gNy3HTGT1Eyw1okNNYqefQDa nrPgyf217iVq+MwrfeSV/M4RDr5T+tGewDktGHa0NmHY6aYrAeBgqKR80SjJZ02NqZUVXhVwSV ukfP8+TAvQk1T8Jln5SY5P/BO0PZXavMEibB/Mnf0lI4jeTd6743vEFKU+X1rqj975IzhdMCi1 Q+iETRSkwYS/x1ndxLO/I25Q Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:05 -0800 IronPort-SDR: YjOSS1cclQohypWXz6k1wcCX0XAx21hEvd2ojQbYWNa6FEznIoUesTq4U/5xcsvJb3Rg+56Z8j BLBVSkB5mCXsI3V2sg7ZG7nTyPcLWdJLEF6KxIiSAajk25qBuGYm/hdiYHxapl0r39OPAfCMy7 GmlAieINEYKLkt9ZWiQbF3Q5wS/pLTUf0gXwcCnNYzFoOOw9Rk8ydckr3SubXsn8Q5EAuKcfBv YMexFKYAXBaFi6Fd/1vT61sRoWhttxz1Wwcwez7KgtrB5mHR2dynGfkJb3q+vgy4d2mk0G4JFX 1rM= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:12 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 14/21] btrfs: zoned: move sync_replace_for_zoned to zoned code Date: Wed, 24 Nov 2021 01:30:40 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org sync_replace_for_zoned( is only used on a zoned filesystem, so move it to zoned code. Signed-off-by: Johannes Thumshirn --- fs/btrfs/scrub.c | 16 +--------------- fs/btrfs/zoned.c | 14 ++++++++++++++ fs/btrfs/zoned.h | 3 +++ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index e8fa305f71a10..2e3ad26d30e30 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3056,20 +3056,6 @@ static noinline_for_stack int scrub_raid56_parity(struct scrub_ctx *sctx, return ret < 0 ? ret : 0; } -static void sync_replace_for_zoned(struct scrub_ctx *sctx) -{ - if (!btrfs_is_zoned(sctx->fs_info)) - return; - - sctx->flush_all_writes = true; - btrfs_scrub_submit(sctx); - mutex_lock(&sctx->wr_lock); - btrfs_scrub_wr_submit(sctx); - mutex_unlock(&sctx->wr_lock); - - wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); -} - static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, struct map_lookup *map, struct btrfs_device *scrub_dev, @@ -3402,7 +3388,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, goto out; if (sctx->is_dev_replace) - sync_replace_for_zoned(sctx); + btrfs_sync_replace_for_zoned(sctx); if (extent_logical + extent_len < key.objectid + bytes) { diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 7f3e3e34fd783..bf0837e46592f 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2282,3 +2282,17 @@ int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, u64 logical, return ret; } + +void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx) +{ + if (!btrfs_is_zoned(sctx->fs_info)) + return; + + sctx->flush_all_writes = true; + btrfs_scrub_submit(sctx); + mutex_lock(&sctx->wr_lock); + btrfs_scrub_wr_submit(sctx); + mutex_unlock(&sctx->wr_lock); + + wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index db2baebab8f50..53bf05be143a4 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -88,6 +88,7 @@ bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical); int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, u64 physical); int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, u64 logical, u64 physical, u64 physical_end); +void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -277,6 +278,8 @@ static inline int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, { return 0; } + +static inline void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx) { } #endif static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos) From patchwork Wed Nov 24 09:30:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FD29C433EF for ; Wed, 24 Nov 2021 09:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236800AbhKXJe3 (ORCPT ); Wed, 24 Nov 2021 04:34:29 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32195 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236421AbhKXJeX (ORCPT ); Wed, 24 Nov 2021 04:34:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746274; x=1669282274; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SOWJ0uVY+RtYQtyf7nNZwH9SrwTp78cwLbJOhBMcLf0=; b=NS3t6FE5r0x6uo7RT5EP39n2b9qWgk2pMllopraY6/+P5T7qgxHikCTh ualQR5pacZeCSFVEVf0Q9lUPz9IkHKuL/YvbzbHtzY/JGjG1Nqeu7RhrN nJvkMY6JaN59OFkVkOSq/sj2f7dRoyBMnLA99nxJAUg5/an4wL7rSdAq/ eLfBR+7cVGFEWAgIRAUcmzhon1ROBnBni71QhcfuTUBiWXYYY5aT60hEd mb+jZxgerfqs5YvRKorrlZNloxsgtFQu3Ox7BVIVowXGytvwa6bOsc5AD cQmkY3kowgeK1U8p1KySpcNPcE02UcjEzjDcU6fbnWSZE5+jleDUbwNE/ Q==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499397" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:13 +0800 IronPort-SDR: kzP+UJWo127eLNxfFiVxCrS1+ZADx7hU97Xa0d2zVnFnf0ExWN6JkVis/k9ou+Z/Y4aYHeJBaq 5tSiy3pKBJFvelos+6EBx5tl3HFiTRaUF5kavhTspopAkN62nN5ff+TAl0j2s+DHP8qZ1g9dEB 9fLGlCj23UQuj5VeHNrSdZjWX5tU7XkqKtbVAzkojabkuvKghyKppR9vi4p34ro/xXVvDeJsDz eTU2QL+KzD3PmNiCgeRH+Ba4dHzR4KL8uMbQ0t6P1UIMr4BBhRb2maFQCYTdhaqkyVSDM68u9q snNSgnzZ+i7kiTRX6YoMmftN Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:06 -0800 IronPort-SDR: +6Sm69ye5U7+H1jdgPTaAZ1DwExcZgYXJ224ik98GPcN32Dyb/mP9o+eoThcz2CXCDoGEoDKif xPnRUQeI6m0U0Tu0izoa1aI6rmT50jr+XpeofqI2v2uxbTNP5lpIlIVtP3ld0eJ8qYtRwO84DF rLVIIKO8ThWB9ZfU8dQeeWuxdpabL4GmBFU6zn84KksQXf0+nFFMXng98ueEJpQwbizVBYNBTz zX3WNFSxLGfpFhKKV4n5EjzsPt+UmSO2CDWx19vx103T29BvoJ5GCtvxWl7g99jDSFwjS3yXT8 CJg= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:13 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 15/21] btrfs: zoned: move finish_extent_writes_for_zoned to zoned code Date: Wed, 24 Nov 2021 01:30:41 -0800 Message-Id: <29caf2db50aa495339a2ae3d52b3248fcc19405e.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org finish_extent_writes_for_zoned() is only used on zoned filesystems so move it to zoned code. Signed-off-by: Johannes Thumshirn --- fs/btrfs/scrub.c | 21 +-------------------- fs/btrfs/zoned.c | 19 +++++++++++++++++++ fs/btrfs/zoned.h | 8 ++++++++ 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 2e3ad26d30e30..97e19eca8da14 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3523,25 +3523,6 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx, return ret; } -static int finish_extent_writes_for_zoned(struct btrfs_root *root, - struct btrfs_block_group *cache) -{ - struct btrfs_fs_info *fs_info = cache->fs_info; - struct btrfs_trans_handle *trans; - - if (!btrfs_is_zoned(fs_info)) - return 0; - - btrfs_wait_block_group_reservations(cache); - btrfs_wait_nocow_writers(cache); - btrfs_wait_ordered_roots(fs_info, U64_MAX, cache->start, cache->length); - - trans = btrfs_join_transaction(root); - if (IS_ERR(trans)) - return PTR_ERR(trans); - return btrfs_commit_transaction(trans); -} - static noinline_for_stack int scrub_enumerate_chunks(struct scrub_ctx *sctx, struct btrfs_device *scrub_dev, u64 start, u64 end) @@ -3695,7 +3676,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, */ ret = btrfs_inc_block_group_ro(cache, sctx->is_dev_replace); if (!ret && sctx->is_dev_replace) { - ret = finish_extent_writes_for_zoned(root, cache); + ret = btrfs_finish_extent_writes_for_zoned(root, cache); if (ret) { btrfs_dec_block_group_ro(cache); scrub_pause_off(fs_info); diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index bf0837e46592f..df84840eac4c0 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -2296,3 +2296,22 @@ void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx) wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); } + +int btrfs_finish_extent_writes_for_zoned(struct btrfs_root *root, + struct btrfs_block_group *cache) +{ + struct btrfs_fs_info *fs_info = cache->fs_info; + struct btrfs_trans_handle *trans; + + if (!btrfs_is_zoned(fs_info)) + return 0; + + btrfs_wait_block_group_reservations(cache); + btrfs_wait_nocow_writers(cache); + btrfs_wait_ordered_roots(fs_info, U64_MAX, cache->start, cache->length); + + trans = btrfs_join_transaction(root); + if (IS_ERR(trans)) + return PTR_ERR(trans); + return btrfs_commit_transaction(trans); +} diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index 53bf05be143a4..83e11f7ec31e8 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -89,6 +89,8 @@ int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, u64 physical); int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, u64 logical, u64 physical, u64 physical_end); void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx); +int btrfs_finish_extent_writes_for_zoned(struct btrfs_root *root, + struct btrfs_block_group *cache); #else /* CONFIG_BLK_DEV_ZONED */ static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, struct blk_zone *zone) @@ -280,6 +282,12 @@ static inline int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, } static inline void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx) { } + +static inline int btrfs_finish_extent_writes_for_zoned(struct btrfs_root *root, + struct btrfs_block_group *cache) +{ + return 0; +} #endif static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos) From patchwork Wed Nov 24 09:30:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FA59C433F5 for ; Wed, 24 Nov 2021 09:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236624AbhKXJec (ORCPT ); Wed, 24 Nov 2021 04:34:32 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32191 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236365AbhKXJeY (ORCPT ); Wed, 24 Nov 2021 04:34:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746275; x=1669282275; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mMAauS95dagPEwAA3C5sY5b5r8u/OUswGaLfT1rzYfw=; b=Vo3TdTfpAscFdF3YMpZfHeysm0FbDt7xeIu4zkCBzR03kFdRR/QcY80p 65Qfq1awI8xih3UHfxnAt7JiO3zIDXOSSo5X/UXhtYg3u/r6EqqCW1MHz aYjtjwA1KhwkWLkhdRISFZPDw0xSK0YyK8nqY2T5y6aFX/OnhU871hI9r 3h3pWccUXA/ntRk7NoSUaic8xTqjaSyWtSLkK3AWWKFqXEik3yFYcVWe0 dYJzkVgfAAbhPDALZfLx5AubSmWELrRPGXK01cHH3qHI3B00/3mQAYzrW uFm8PLzHEA+O9oejPH1t43S+whOoJx2XquQkvclUpFHJMFYrxqIrXEnUT w==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499400" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:14 +0800 IronPort-SDR: 0Aod9BmYCC4yqS6Qm5diVgvKH/rUOfwehYJ6XGrz9ljkdPoI55n+qEk02ggeiUEsimE/HDZ4Ob DJ9/gmsYOcD9qVEO526agpjlurKL+16LVx3/KF2/8YqT0kddvryF/C2yh9LNZEbefGbX2Y+P0B oQiDtjegsx7IBfFMFH6tVYls6133K1H+xvj3iNouUALZre7x+jWj5CuBmq1p2Pv9oeL3aijfuG oFxzvFAg8I1fCQp9Mz9OfhBrc7+ombWvNEpJ408nyx5lX01SoOnEmHatXz8GktCgSVKPPmfjqG B4xtPN91MIGzf4zeOYv1/VdQ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:08 -0800 IronPort-SDR: Ejk4Fitn42JkSyaaPfW+v+9hafPCH/AVrPbDulk5Qy4hF5UV9WD73MR1/Idk1DBvScaGjFzNBP diJ+cmAXxT3kqPSrtxQQF3eWayhzihL5ryTN6rXWuaGemaKn7Sd1tV1s3/JcGmOvK7eKXEMWm4 9FJiVJ7bKZKlmjfFG0mLFNiAPv5ag/zJyhcNDD+z7XfyYftEu2OaAziWYtGYTkLXq6t93S98NC ncTZPVpcEAMSMchDl51fFbgk8hXRPu/aA+Im5XmlPBJyRwW9wO5hNj98x4fKSleQ5Pv03f9W4Z nsU= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:14 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 16/21] btrfs: move btrfs_scrub_dev() definition to scrub.h Date: Wed, 24 Nov 2021 01:30:42 -0800 Message-Id: <4344c424f8638151bc1faeae080644a7dd1f488a.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Now that we have a scrub.h move btrfs_scrub_dev()'s definition there. Signed-off-by: Johannes Thumshirn --- fs/btrfs/ctree.h | 3 --- fs/btrfs/dev-replace.c | 1 + fs/btrfs/ioctl.c | 1 + fs/btrfs/scrub.h | 3 +++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index f1dd2486dcb37..c050c47131760 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3801,9 +3801,6 @@ struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, int btrfs_should_ignore_reloc_root(struct btrfs_root *root); /* scrub.c */ -int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, - u64 end, struct btrfs_scrub_progress *progress, - int readonly, int is_dev_replace); void btrfs_scrub_pause(struct btrfs_fs_info *fs_info); void btrfs_scrub_continue(struct btrfs_fs_info *fs_info); int btrfs_scrub_cancel(struct btrfs_fs_info *info); diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 1fcc5d57e96ef..bb325334333a7 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -23,6 +23,7 @@ #include "sysfs.h" #include "zoned.h" #include "block-group.h" +#include "scrub.h" /* * Device replace overview diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index d7f710e57890e..cc2e1297ca250 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -50,6 +50,7 @@ #include "block-group.h" #include "subpage.h" #include "zoned.h" +#include "scrub.h" #ifdef CONFIG_64BIT /* If we have a 32-bit userspace and 64-bit kernel, then the UAPI diff --git a/fs/btrfs/scrub.h b/fs/btrfs/scrub.h index 8d17fac108556..9ff9d3e033b25 100644 --- a/fs/btrfs/scrub.h +++ b/fs/btrfs/scrub.h @@ -50,4 +50,7 @@ struct scrub_ctx { void btrfs_scrub_submit(struct scrub_ctx *sctx); void btrfs_scrub_wr_submit(struct scrub_ctx *sctx); +int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, + u64 end, struct btrfs_scrub_progress *progress, + int readonly, int is_dev_replace); #endif /* BTRFS_SCRUB_H */ From patchwork Wed Nov 24 09:30:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 006ABC4332F for ; Wed, 24 Nov 2021 09:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236558AbhKXJee (ORCPT ); Wed, 24 Nov 2021 04:34:34 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32204 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236565AbhKXJe0 (ORCPT ); Wed, 24 Nov 2021 04:34:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746276; x=1669282276; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JJjN+pVk4qAT40vLu1g4Mj2Be/S3g1FANYlkQQ3HPk4=; b=pHKDZm3XX9Q+g+znc113V2ZCCgmpBsGahZAYr+Gg2KktGbrGrnLtfAtB pPGYpGpPyEg0slMctaKnQLLWDwr+pUE6HTZDx+WIZR14InbOGGSoW0ZGY /cmlkqubrpTyIWorSxHO0W7d5Tz/PYC0890slvWwaWogkgwgFvPYk+RDn b3Z5AJQhEsWWkG/aiP2LfJEDHlMEar+gGPDLLofwIRk3fggfvd6M5p2KE CCVQ7PGc5/Nm1uAkTtSh0qB6JhA0COU8kupHWph6DkvOFVfVVIVPshu6z zcdbqtF+aAPjDDxxhJs0z1x+QWcv6JT6SRIMKFZPwclqgA3xE15Bw7fpz w==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499402" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:16 +0800 IronPort-SDR: tTi4SZPAIJl5R+fYX+ZOG9/TKr+4y54DiCYZaeGj9qWJjf7+KA7n9m4Vop+9aXX6C58IVO02H7 CRLW8cHnuQwnuwdjUeLGPg5lVWbv01MrIy2KqIqdqqIo6xsRQIeDNBX2ZFQjHw3yuL4H5OoyyQ KKGhTKEhce//ViRgLnub/YLAA7sdyFRepLwpf6n8Yl2A6X3KhT103P8AyfSB3zt9fLfU7Dlsn7 lRoltxkCyNDWQYyZjtQYX91mI3KjNDPoI8fnrP+j/S1kzsCmnWOx/Poo7kyMD6Md/mAA04U3Kq BzA83k6lAlyH/2WSQE5TIKVC Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:09 -0800 IronPort-SDR: HS6KV4/PwBCd4ifTo6OnFIT/C0eewYauTdojzocBcKec0ltyfNuaLrrxEvu5jiYXDcX8o2txuT tIAWxD3wwk+0HsLIVedR+rgbyeLXNwLd5p89YkocC7Ho8Kru6CQBlTMrK/PGmA3qTu/7XLqqgp Ykl4Q7XiJNJ89IDc+uscOac7IgM7tCJw2PlcS+fyemqsgpZIc/CKwA47I7pd5dEAukBhmmrBa3 v6JloVhAO25PSNgsUFXC7BOPdaYwkRrHIrwtVb/t+H3B/hpEDrEk9cfeozXJoBtNXrl37EpAeh +IQ= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:16 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 17/21] btrfs: move btrfs_scrub_pause() definition to scrub.h Date: Wed, 24 Nov 2021 01:30:43 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Now that we have a scrub.h move btrfs_scrub_pause()'s definition there. Signed-off-by: Johannes Thumshirn --- fs/btrfs/ctree.h | 1 - fs/btrfs/scrub.h | 1 + fs/btrfs/transaction.c | 1 + fs/btrfs/volumes.c | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index c050c47131760..5ab09bb0279fe 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3801,7 +3801,6 @@ struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, int btrfs_should_ignore_reloc_root(struct btrfs_root *root); /* scrub.c */ -void btrfs_scrub_pause(struct btrfs_fs_info *fs_info); void btrfs_scrub_continue(struct btrfs_fs_info *fs_info); int btrfs_scrub_cancel(struct btrfs_fs_info *info); int btrfs_scrub_cancel_dev(struct btrfs_device *dev); diff --git a/fs/btrfs/scrub.h b/fs/btrfs/scrub.h index 9ff9d3e033b25..f06e4a10a08b9 100644 --- a/fs/btrfs/scrub.h +++ b/fs/btrfs/scrub.h @@ -53,4 +53,5 @@ void btrfs_scrub_wr_submit(struct scrub_ctx *sctx); int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, u64 end, struct btrfs_scrub_progress *progress, int readonly, int is_dev_replace); +void btrfs_scrub_pause(struct btrfs_fs_info *fs_info); #endif /* BTRFS_SCRUB_H */ diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 8b6a90fafcd41..df56c6991294d 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -22,6 +22,7 @@ #include "block-group.h" #include "space-info.h" #include "zoned.h" +#include "scrub.h" #define BTRFS_ROOT_TRANS_TAG 0 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 23459328d19bc..3c31f8fd4bb3c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -33,6 +33,7 @@ #include "block-group.h" #include "discard.h" #include "zoned.h" +#include "scrub.h" const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = { [BTRFS_RAID_RAID10] = { From patchwork Wed Nov 24 09:30:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636471 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E123DC433F5 for ; Wed, 24 Nov 2021 09:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236935AbhKXJeg (ORCPT ); Wed, 24 Nov 2021 04:34:36 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32207 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236499AbhKXJe2 (ORCPT ); Wed, 24 Nov 2021 04:34:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746279; x=1669282279; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tiJDXTNh43giXrUH3Bs6opM0CpoRIaFrym75lBC+1Ms=; b=MxmTakAO+fUy1xICgTWivWDQMNkeA4xHrqrwRdrkAsvNjHr1iXOspMpV ZWvt0+x5ENTdgUZbImzo8xd9QyxP+QjAf0Dvr+K2XziJJ3fXYdqgaLVwY xclNufJbXyGr4HGrMblXUI/p/yCOMnK7LVgfPSD+r9JvPXgxxedq6N2/P BKhKLHeR7wPByEIcnweB/qIizVxh2PnNX/mQTwsipWvwBTlfpGo6QOAFo hD5mufIQLGz4XBkHoUTO3lfcunceiMAyDcBhv1ENL8ZX3eYTd3LCoKkdL zEeT2TgUd+YgLSRCIE+/L2zsCiCyIdTEEZFF5kfmVopdO3GVsIVWNyd4e w==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499405" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:17 +0800 IronPort-SDR: daaK36ItSa1oqcCtr+MfKdqGqb2vJNznnBN9J6Rx14w4MfczUOJxmrPvSCoKAW3nWd1GUZRJ7E AOPgld57e0ScorGxnjBstTNjMcmSvnEeanp0XePpPKFzYQZgWm0Mn0eJYdZ3+g8M3lw7tCC/sS +7cUiBqfS2nHuf8WhgCERqNEmc+ahsOolZ/lud1n+KdRwIiIeGXr+lHqZR9nF7BPOsxZN8q5d3 K61n52ekeOfiYlcvX7EMZS/NwYOEM991wAvANWsIDMBT06xiSY57Ew8drNrOZtStv+hpgzjia4 36b55OlxWecqRvFyagZLLnww Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:10 -0800 IronPort-SDR: K3tqY3BIQAq7r/o+f77BdBitSSTgKsiPOZUf3uqU2/GR2uHUUIKchmGZLzBCSFSmcOzJTy7ftW Q5e04ma+yUiBNFv+MNbfu/whmCihReY0aLNVwL4532xLpLmSW28oafBrk4/fGZDVTquXug1MR+ LCLGYfa/tchS1i5iq1BA/7lsPkqJ/yAUNhjn7FTfW2BdRwZnY8HQivJop/9deWx5klu8z9FNax VvYyOyDkf9KH2A+a8XxzLysvbGXmqhTHqk/mzcEFLt7Y5TWuHv2PTHq7SQmdEjA0fHIMV074+V NV8= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:17 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 18/21] btrfs: move btrfs_scrub_continue() definition to scrub.h Date: Wed, 24 Nov 2021 01:30:44 -0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Now that we have a scrub.h move btrfs_scrub_continue()'s definition there. Signed-off-by: Johannes Thumshirn --- fs/btrfs/ctree.h | 1 - fs/btrfs/scrub.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 5ab09bb0279fe..064281a700ff1 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3801,7 +3801,6 @@ struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, int btrfs_should_ignore_reloc_root(struct btrfs_root *root); /* scrub.c */ -void btrfs_scrub_continue(struct btrfs_fs_info *fs_info); int btrfs_scrub_cancel(struct btrfs_fs_info *info); int btrfs_scrub_cancel_dev(struct btrfs_device *dev); int btrfs_scrub_progress(struct btrfs_fs_info *fs_info, u64 devid, diff --git a/fs/btrfs/scrub.h b/fs/btrfs/scrub.h index f06e4a10a08b9..69da2e49732df 100644 --- a/fs/btrfs/scrub.h +++ b/fs/btrfs/scrub.h @@ -54,4 +54,5 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, u64 end, struct btrfs_scrub_progress *progress, int readonly, int is_dev_replace); void btrfs_scrub_pause(struct btrfs_fs_info *fs_info); +void btrfs_scrub_continue(struct btrfs_fs_info *fs_info); #endif /* BTRFS_SCRUB_H */ From patchwork Wed Nov 24 09:30:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0F0AC433F5 for ; Wed, 24 Nov 2021 09:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236860AbhKXJef (ORCPT ); Wed, 24 Nov 2021 04:34:35 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32204 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236684AbhKXJe2 (ORCPT ); Wed, 24 Nov 2021 04:34:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746279; x=1669282279; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G5DiJWfo13BPZMR9s6+9e4Lq+UZNL9VfxPP+u7rMMbc=; b=PB/j32WLPAHgNBlKeEf1ZJwEIsPODVzyKhVfHLLSJI+YrfT//8MMDCQ3 J70ewiBtZy4s5qgZhCTrkx5yWoOeiJFeiOJEVr3Fklz/D8EQ7eg4DrguT PO/lOEbgZU4T7eRQxAlKp9oXOCC3tWKS5oKqqlVZlbpS/FfPnbuPxLGo1 Stkk16VipI6BsHH2t1Ynz+fOAPvtL399q2RJX7UfmOOYnG1xFgCtLo9XM Pw1I4oyCFq/+BsRwjg5FR+5TjH3lV3Sp7auZhLbTsP7DpKcTo6xg7qsJ/ 4MgHdkbKLPJnKb0eH8LTeN52ugxVUQu4liAUYOr+q2uHncEI6C7COxafG A==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499407" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:18 +0800 IronPort-SDR: YeuiVJN/2Od5msLaQ662COCyc0d+X8KSzdTP9ClNExap1aFqvQoYBIqJINBjik1Rq1U7i5xNzE 7QiEynay78A1bQQ8CGz8dFGgg10f7UFdyifxQLLV49Y4cT8ZlOdiL+swANMLps6YudTumQeZqZ 6x0aSVI/F3AvjoeIjof4u9ntE8ZvkLtoPpGn3ZLkWwlYJOQ3xD9EhWrxQELX9gMWPV+/FPjuq6 T6Slo/BJUn/zEB3ZyN3nqGUr8PDtlPubulqcrkR6Jua0j6MIG7g/VsLqSaA20hXTDYpKZiV76f /Scv/MVtvNI1kqYKEm0pkQGb Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:11 -0800 IronPort-SDR: nif4NVEwDOzLSw7iy3c+rs2+QYaa2FNEyHEENGb3k40LxSIrea1AbGlcrwIAb/I/3S8JAUbOMK 0xiphiUK1KcuKxF3zBm/3EGU21OfQHjGVboiX4lAYumIy81HYw1pgk8UqkjhUZpjQRwwREWTF7 Kb8Pmc6y7B8O7Gj1YqhWUdXasYCBrovvp9CZgcDLHHot/dGQvuDC4aKvKK245KWDjOJaZdOZTe LX4aUqqp8Nkgfofl5IvoZcchHVR0c4QjZYgjhwfUyMJJa2QdQatR4ZUBu/hi7IGw6dPOfwh28j xlE= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:18 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 19/21] btrfs: move btrfs_scrub_cancel() definition to scrub.h Date: Wed, 24 Nov 2021 01:30:45 -0800 Message-Id: <920c97c926801337618f0dc11e20b464d56220e7.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Now that we have a scrub.h move btrfs_scrub_cancel()'s definition there. Signed-off-by: Johannes Thumshirn --- fs/btrfs/ctree.h | 1 - fs/btrfs/disk-io.c | 1 + fs/btrfs/scrub.h | 1 + fs/btrfs/super.c | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 064281a700ff1..7ab88e67e3510 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3801,7 +3801,6 @@ struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, int btrfs_should_ignore_reloc_root(struct btrfs_root *root); /* scrub.c */ -int btrfs_scrub_cancel(struct btrfs_fs_info *info); int btrfs_scrub_cancel_dev(struct btrfs_device *dev); int btrfs_scrub_progress(struct btrfs_fs_info *fs_info, u64 devid, struct btrfs_scrub_progress *progress); diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 9d66d48945c6a..19afbd4afc792 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -43,6 +43,7 @@ #include "space-info.h" #include "zoned.h" #include "subpage.h" +#include "scrub.h" #define BTRFS_SUPER_FLAG_SUPP (BTRFS_HEADER_FLAG_WRITTEN |\ BTRFS_HEADER_FLAG_RELOC |\ diff --git a/fs/btrfs/scrub.h b/fs/btrfs/scrub.h index 69da2e49732df..c511c310d55ea 100644 --- a/fs/btrfs/scrub.h +++ b/fs/btrfs/scrub.h @@ -55,4 +55,5 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, int readonly, int is_dev_replace); void btrfs_scrub_pause(struct btrfs_fs_info *fs_info); void btrfs_scrub_continue(struct btrfs_fs_info *fs_info); +int btrfs_scrub_cancel(struct btrfs_fs_info *info); #endif /* BTRFS_SCRUB_H */ diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index a1c54a2c787c5..aa8c62e594a84 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -49,6 +49,7 @@ #include "block-group.h" #include "discard.h" #include "qgroup.h" +#include "scrub.h" #define CREATE_TRACE_POINTS #include From patchwork Wed Nov 24 09:30:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E92E0C433FE for ; Wed, 24 Nov 2021 09:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236734AbhKXJef (ORCPT ); Wed, 24 Nov 2021 04:34:35 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32213 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236766AbhKXJe3 (ORCPT ); Wed, 24 Nov 2021 04:34:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746279; x=1669282279; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7n2C2BBZx6WRnYleJyTQgNMYaSaBfZ3Aiqc7zmh4xf4=; b=B8K6Mbi3Y65vLc4mYJshy8egPTYPdfGnXGp6ri6s0NERhjjnQTC/plCn kIMBJS/mpdI6yhdzYd0o3pPNbd86DnKumbgxnAFgRHiB5Q8s9RziG131x 1MVLnFwGXqVU6Mkn3cds/ZuPZvnF+rTVcdBoj3Pt9c2BJWDf0IGQWMTgR zz0gSyz3x1NaQKa/7RRoKuu2GAegIXqa8w0p5YNSNNhowW8dMxn0gAlha OtzZFTbVwFU+eTMQPDslSP7clOVK0NdZYAyF9CIkNvC6mZvDA6aKivpxY /M5y7fz5U+sILRZrN95yrKFvjaR5k2nL7z90QVlbalaAOg22MYfdwo5Oy g==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499408" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:19 +0800 IronPort-SDR: l3QIGd1kfpiLEkPq7lczggoJ5x1pdckmaF/V+BqK3CT8ots0f30aWnFNXnDkQ/JTMjmJrc9Yhn kOLFeos2FnQ+ZHQUch2GugHfImBpwvYITpwkWSkznxJmnW+5uGMfTQb7QG+Oqt/rmB3FXzNpC5 boijQTbexZWbinMviYaAw8SeDJM/CIl13C7pjKcXZg1i91NSODcb++waOMRWKJ5YUYeOzGaCCT YBcC66gHukKsddj7ENRhkyzc+8NRcjmZNT/TnLbh34/5wXmYZmoYnSyUjqA11qeGwklkP7RV5n ttmN4vcy/mMDTtD/FpZz4YKH Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:12 -0800 IronPort-SDR: sf8VdV726vAdXpadHsEwF61kHZU4aX5jjlMxhlDrtOOcOdpSnj4LpLcCHX7XNPwHActnnI/VjX J5ZwRuvohNtCXSYJ1UzeDcs9Fz+55I9Z1gRLbyU5E6ZFN1aE+SyMTQWl5WOFlEOtjVH2HvNA0o gQzPGAgkgc/wqprNTtyaUwNMAYPMIOQcL/UNu3NCRteyg7yL0U4PvfDlPWYu3R1l5L84o6MwFq Quyli5Fa++mLLTaWspjvSfbez86FDBhcqnD9lnCZZq6NPybSxkbQFzx4mleI+73lZA+oc4Hh2w vDo= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:19 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 20/21] btrfs: move btrfs_scrub_cancel_dev() definition to scrub.h Date: Wed, 24 Nov 2021 01:30:46 -0800 Message-Id: <4c2f33c6dd3accaa5740ce9cd3efbc3f247f3c48.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Now that we have a scrub.h move btrfs_scrub_cancel_dev()'s definition there. Signed-off-by: Johannes Thumshirn --- fs/btrfs/ctree.h | 1 - fs/btrfs/scrub.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 7ab88e67e3510..aef03199e367a 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3801,7 +3801,6 @@ struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, int btrfs_should_ignore_reloc_root(struct btrfs_root *root); /* scrub.c */ -int btrfs_scrub_cancel_dev(struct btrfs_device *dev); int btrfs_scrub_progress(struct btrfs_fs_info *fs_info, u64 devid, struct btrfs_scrub_progress *progress); static inline void btrfs_init_full_stripe_locks_tree( diff --git a/fs/btrfs/scrub.h b/fs/btrfs/scrub.h index c511c310d55ea..e6eaf22b04e14 100644 --- a/fs/btrfs/scrub.h +++ b/fs/btrfs/scrub.h @@ -56,4 +56,5 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, void btrfs_scrub_pause(struct btrfs_fs_info *fs_info); void btrfs_scrub_continue(struct btrfs_fs_info *fs_info); int btrfs_scrub_cancel(struct btrfs_fs_info *info); +int btrfs_scrub_cancel_dev(struct btrfs_device *dev); #endif /* BTRFS_SCRUB_H */ From patchwork Wed Nov 24 09:30:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12636473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB70EC433F5 for ; Wed, 24 Nov 2021 09:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236510AbhKXJei (ORCPT ); Wed, 24 Nov 2021 04:34:38 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:32204 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236382AbhKXJeb (ORCPT ); Wed, 24 Nov 2021 04:34:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1637746281; x=1669282281; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TSwy7QTI0fRTsdbXkhy9nV3Gi8Poo7wRKEZTydiY0aw=; b=I12yIKuYe9RBd6oXD2cRDvsAfsGnb5ygtAyiwUe1CjKf4UPh+ffyncjT MhVtuhGjY9PHEX+AzFfh8ROrPDvCKuDAlkXBRFIlj6vv+aZpMr5ZrrWha quaIsDzW7fOHz9L6E2fcZNv/IzJ5LXPZCAEJ+YHUs8z2zYRTsNMEn3WSk YAbLUsfkBbtNzCtG36nlMDoVJc8IGgZxrZlMIrnAKn4miDh6WOTTSn8QH 6E5nM3gR80+yQEwKYKCve5EbvsJKXSU+ExZj+1rVf3aBx8+oxR1SiBd2C MXohhPRG44NhZZ8FLFbhJU7OFU3tGuRuv4DBF+8/eVCBd5ABO8ZMHpNKE Q==; X-IronPort-AV: E=Sophos;i="5.87,260,1631548800"; d="scan'208";a="185499412" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 24 Nov 2021 17:31:21 +0800 IronPort-SDR: Zg8Pt9IqVZRQUe7OQBgd7TvSfKdEQt8UmGW1ZUKbW44lBinMUcOqrHdufIdtcH5rxfgFqt7/IC KD+mWH7Va/l9sjp1Rrujg+R6L6BFX7IauQeOySy80UxZ72xAhCWvVpWFQbf8jFFhm78zV9e8+r PoTgEszDxyxZTOJ6mUAJOY2h2rkbg3ioOtY5SfXtbkYVlUIuPqNltApcUBNeFIXlOZrt/51D9Y ZZfPzqUtF+eiw9U+XsXG4us2o0tDS5BVBmgqfAtKmKjAUXSfQJajBrAmTX9VKVoRWliicQU9OB W0WdTsfDldX62psbO78lf66i Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:06:14 -0800 IronPort-SDR: BUFpWSD6VPG8FADESup6FdXy29nQ4Q5dZQ2T/M6cxG8c4wbBpB1/YYUsgEJoVfYXpQaf2zKQ7P 9nZh03Ygs5v6Ne24ckG27GuJ5W82RrxvUr+jk42qt5MAVwe873K1Tojnwv1MJI7oyHNIyFB9MQ yY4c2nezMCWhfGrTY9I1R6C5aU7WsVDXSI9t20jPT3LM5VL3dDn/X1ZX8FRuifPaNINXd7jXSi qplfiphT/P/XjLp4DynbWJQQQ/wNmqk8prEQifOeHn8Mk7BhzyvcwNKCXN85QswqNrfkvZHp7K zZ4= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Nov 2021 01:31:21 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, Nikolay Borisov , Naohiro Aota Subject: [PATCH 21/21] btrfs: move btrfs_scrub_progress() definition to scrub.h Date: Wed, 24 Nov 2021 01:30:47 -0800 Message-Id: <6cbadf7d286d9074dab45b4f4916e7b781b61d97.1637745470.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Now that we have a scrub.h move btrfs_scrub_progress()'s definition there. Signed-off-by: Johannes Thumshirn --- fs/btrfs/ctree.h | 3 --- fs/btrfs/scrub.h | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index aef03199e367a..5cfb2ebf3a020 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3800,9 +3800,6 @@ struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, u64 bytenr); int btrfs_should_ignore_reloc_root(struct btrfs_root *root); -/* scrub.c */ -int btrfs_scrub_progress(struct btrfs_fs_info *fs_info, u64 devid, - struct btrfs_scrub_progress *progress); static inline void btrfs_init_full_stripe_locks_tree( struct btrfs_full_stripe_locks_tree *locks_root) { diff --git a/fs/btrfs/scrub.h b/fs/btrfs/scrub.h index e6eaf22b04e14..9fe4b7dee61f5 100644 --- a/fs/btrfs/scrub.h +++ b/fs/btrfs/scrub.h @@ -57,4 +57,6 @@ void btrfs_scrub_pause(struct btrfs_fs_info *fs_info); void btrfs_scrub_continue(struct btrfs_fs_info *fs_info); int btrfs_scrub_cancel(struct btrfs_fs_info *info); int btrfs_scrub_cancel_dev(struct btrfs_device *dev); +int btrfs_scrub_progress(struct btrfs_fs_info *fs_info, u64 devid, + struct btrfs_scrub_progress *progress); #endif /* BTRFS_SCRUB_H */