stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-btrfs@vger.kernel.org, stable@vger.kernel.org,
	Naohiro Aota <naohiro.aota@wdc.com>,
	David Sterba <dsterba@suse.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH for-5.15.x 5/6] btrfs: check for relocation inodes on zoned btrfs in should_nocow
Date: Thu, 18 Nov 2021 17:58:17 +0900	[thread overview]
Message-ID: <2b57613ad55081ae305f66db17dec297f84c04ca.1637225333.git.johannes.thumshirn@wdc.com> (raw)
In-Reply-To: <cover.1637225333.git.johannes.thumshirn@wdc.com>

commit 2adada886b26e998b5a624e72f0834ebfdc54cc7 upstream

Prepare for allowing preallocation for relocation inodes.

Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/inode.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 85663bccde8a..61b4651f008d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1945,7 +1945,15 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
 	const bool zoned = btrfs_is_zoned(inode->root->fs_info);
 
 	if (should_nocow(inode, start, end)) {
-		ASSERT(!zoned);
+		/*
+		 * Normally on a zoned device we're only doing COW writes, but
+		 * in case of relocation on a zoned filesystem we have taken
+		 * precaution, that we're only writing sequentially. It's safe
+		 * to use run_delalloc_nocow() here, like for  regular
+		 * preallocated inodes.
+		 */
+		ASSERT(!zoned ||
+		       (zoned && btrfs_is_data_reloc_root(inode->root)));
 		ret = run_delalloc_nocow(inode, locked_page, start, end,
 					 page_started, nr_written);
 	} else if (!inode_can_compress(inode) ||
-- 
2.32.0


  parent reply	other threads:[~2021-11-18  8:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18  8:58 [PATCH for-5.15.x 0/6] btrfs: zoned: backport of 5.16 relocation fixes Johannes Thumshirn
2021-11-18  8:58 ` [PATCH for-5.15.x 1/6] btrfs: introduce btrfs_is_data_reloc_root Johannes Thumshirn
2021-11-18  8:58 ` [PATCH for-5.15.x 2/6] btrfs: zoned: add a dedicated data relocation block group Johannes Thumshirn
2021-11-18  8:58 ` [PATCH for-5.15.x 3/6] btrfs: zoned: only allow one process to add pages to a relocation inode Johannes Thumshirn
2021-11-18  8:58 ` [PATCH for-5.15.x 4/6] btrfs: zoned: use regular writes for relocation Johannes Thumshirn
2021-11-18  8:58 ` Johannes Thumshirn [this message]
2021-11-18  8:58 ` [PATCH for-5.15.x 6/6] btrfs: zoned: allow preallocation for relocation inodes Johannes Thumshirn
2021-11-19 12:34 ` [PATCH for-5.15.x 0/6] btrfs: zoned: backport of 5.16 relocation fixes Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2b57613ad55081ae305f66db17dec297f84c04ca.1637225333.git.johannes.thumshirn@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=dsterba@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).