summaryrefslogtreecommitdiff
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2024-04-18 01:26:54 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2024-05-03 00:23:30 +0300
commit798cb7f9aec35460c383eab57b9fa474d999a2eb (patch)
treefdd00b34c35fe91115fc67745307c1cbf0ad8767 /mm/swapfile.c
parent3a52c03d1ece8f480d6a6c35d92f7c1c6215d2a6 (diff)
downloadlinux-798cb7f9aec35460c383eab57b9fa474d999a2eb.tar.xz
swapon(2)/swapoff(2): don't bother with block size
once upon a time that used to matter; these days we do swap IO for swap devices at the level that doesn't give a damn about block size, buffer_head or anything of that sort - just attach the page to bio, set the location and size (the latter to PAGE_SIZE) and feed into queue. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 4919423cce76..304f74d039f3 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2417,7 +2417,6 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
struct inode *inode;
struct filename *pathname;
int err, found = 0;
- unsigned int old_block_size;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -2529,7 +2528,6 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
}
swap_file = p->swap_file;
- old_block_size = p->old_block_size;
p->swap_file = NULL;
p->max = 0;
swap_map = p->swap_map;
@@ -2553,7 +2551,6 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
inode = mapping->host;
if (p->bdev_file) {
- set_blocksize(p->bdev, old_block_size);
fput(p->bdev_file);
p->bdev_file = NULL;
}
@@ -2782,21 +2779,15 @@ static struct swap_info_struct *alloc_swap_info(void)
static int claim_swapfile(struct swap_info_struct *p, struct inode *inode)
{
- int error;
-
if (S_ISBLK(inode->i_mode)) {
p->bdev_file = bdev_file_open_by_dev(inode->i_rdev,
BLK_OPEN_READ | BLK_OPEN_WRITE, p, NULL);
if (IS_ERR(p->bdev_file)) {
- error = PTR_ERR(p->bdev_file);
+ int error = PTR_ERR(p->bdev_file);
p->bdev_file = NULL;
return error;
}
p->bdev = file_bdev(p->bdev_file);
- p->old_block_size = block_size(p->bdev);
- 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
@@ -3235,7 +3226,6 @@ bad_swap:
free_percpu(p->cluster_next_cpu);
p->cluster_next_cpu = NULL;
if (p->bdev_file) {
- set_blocksize(p->bdev, p->old_block_size);
fput(p->bdev_file);
p->bdev_file = NULL;
}