From: akpm@linux-foundation.org
To: akpm@linux-foundation.org, hare@suse.de, hch@lst.de,
hughd@google.com, linux-mm@kvack.org, mm-commits@vger.kernel.org,
naohiro.aota@wdc.com, torvalds@linux-foundation.org,
tytso@mit.edu, willy@infradead.org
Subject: [patch 016/158] mm, swap: disallow swapon() on zoned block devices
Date: Sat, 30 Nov 2019 17:49:56 -0800 [thread overview]
Message-ID: <20191201014956.tXC37Qp6P%akpm@linux-foundation.org> (raw)
From: Naohiro Aota <naohiro.aota@wdc.com>
Subject: mm, swap: disallow swapon() on zoned block devices
A zoned block device consists of a number of zones. Zones are either
conventional and accepting random writes or sequential and requiring that
writes be issued in LBA order from each zone write pointer position. For
the write restriction, zoned block devices are not suitable for a swap
device. Disallow swapon on them.
[akpm@linux-foundation.org: reflow and reword comment, per Christoph]
Link: http://lkml.kernel.org/r/20191015085814.637837-1-naohiro.aota@wdc.com
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: "Theodore Y. Ts'o" <tytso@mit.edu>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/swapfile.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/mm/swapfile.c~mm-swap-disallow-swapon-on-zoned-block-devices
+++ a/mm/swapfile.c
@@ -2887,6 +2887,13 @@ static int claim_swapfile(struct swap_in
error = set_blocksize(p->bdev, PAGE_SIZE);
if (error < 0)
return error;
+ /*
+ * Zoned block devices contain zones that have a sequential
+ * write only restriction. Hence zoned block devices are not
+ * suitable for swapping. Disallow them here.
+ */
+ 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;
_
reply other threads:[~2019-12-01 1:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20191201014956.tXC37Qp6P%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=willy@infradead.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