linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Naohiro Aota <naohiro.aota@wdc.com>
To: linux-mm@kvack.org
Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Naohiro Aota <naohiro.aota@wdc.com>
Subject: [PATCH] mm, swap: disallow swapon() on zoned block devices
Date: Tue, 15 Oct 2019 13:38:27 +0900	[thread overview]
Message-ID: <20191015043827.160444-1-naohiro.aota@wdc.com> (raw)

A zoned block device consists of a number of zones. Zones are
eitherconventional and accepting random writes or sequential and
requiringthat writes be issued in LBA order from each zone write
pointerposition. For the write restriction, zoned block devices are
notsuitable for a swap device. Disallow swapon on them.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 mm/swapfile.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index dab43523afdd..a9da20739017 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2887,6 +2887,8 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode)
 		error = set_blocksize(p->bdev, PAGE_SIZE);
 		if (error < 0)
 			return error;
+		if (blk_queue_is_zoned(p->bdev->bd_queue))
+			return -EINVAL;
 		p->flags |= SWP_BLKDEV;
 	} else if (S_ISREG(inode->i_mode)) {
 		p->bdev = inode->i_sb->s_bdev;
-- 
2.23.0


             reply	other threads:[~2019-10-15  4:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  4:38 Naohiro Aota [this message]
2019-10-15  7:57 ` [PATCH] mm, swap: disallow swapon() on zoned block devices Christoph Hellwig
2019-10-15  8:58 ` [PATCH v2] " Naohiro Aota
2019-10-15  9:06   ` Christoph Hellwig
2019-10-15 20:43     ` Andrew Morton
2019-10-15 11:35 ` Project idea: Swap to " Matthew Wilcox
2019-10-15 13:27   ` Theodore Y. Ts'o
2019-10-15 13:48   ` Hannes Reinecke
2019-10-15 14:50     ` Christopher Lameter
2019-10-15 15:09     ` Matthew Wilcox
2019-10-15 15:22       ` Hannes Reinecke

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=20191015043827.160444-1-naohiro.aota@wdc.com \
    --to=naohiro.aota@wdc.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.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).