* [PATCH 02/17] proc: replace __get_free_page() with kmalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
A few functions in fs/proc/base.c use __get_free_page() to allocate a
temporary buffer.
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() with kmalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/proc/base.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index d9acfa89c894..e129dc509b79 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -261,7 +261,7 @@ static ssize_t get_mm_proctitle(struct mm_struct *mm, char __user *buf,
if (pos >= PAGE_SIZE)
return 0;
- page = (char *)__get_free_page(GFP_KERNEL);
+ page = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!page)
return -ENOMEM;
@@ -284,7 +284,7 @@ static ssize_t get_mm_proctitle(struct mm_struct *mm, char __user *buf,
ret = len;
}
}
- free_page((unsigned long)page);
+ kfree(page);
return ret;
}
@@ -347,7 +347,7 @@ static ssize_t get_mm_cmdline(struct mm_struct *mm, char __user *buf,
if (count > arg_end - pos)
count = arg_end - pos;
- page = (char *)__get_free_page(GFP_KERNEL);
+ page = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!page)
return -ENOMEM;
@@ -371,7 +371,7 @@ static ssize_t get_mm_cmdline(struct mm_struct *mm, char __user *buf,
count -= got;
}
- free_page((unsigned long)page);
+ kfree(page);
return len;
}
@@ -908,7 +908,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
if (!mm)
return 0;
- page = (char *)__get_free_page(GFP_KERNEL);
+ page = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!page)
return -ENOMEM;
@@ -949,7 +949,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
mmput(mm);
free:
- free_page((unsigned long) page);
+ kfree(page);
return copied;
}
@@ -1016,7 +1016,7 @@ static ssize_t environ_read(struct file *file, char __user *buf,
if (!mm || !mm->env_end)
return 0;
- page = (char *)__get_free_page(GFP_KERNEL);
+ page = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!page)
return -ENOMEM;
@@ -1062,7 +1062,7 @@ static ssize_t environ_read(struct file *file, char __user *buf,
mmput(mm);
free:
- free_page((unsigned long) page);
+ kfree(page);
return ret;
}
--
2.53.0
^ permalink raw reply related
* [PATCH 03/17] ocfs2/dlm: replace __get_free_page() with kmalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
A few places in ocsfs2 allocate temporary buffers with __get_free_page() or
get_zeroed_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() and get_zeroed_page() with kmalloc() and
kzalloc() respectively.
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/ocfs2/dlm/dlmdebug.c | 24 +++++++++---------------
fs/ocfs2/dlm/dlmdomain.c | 8 +++++---
fs/ocfs2/dlm/dlmmaster.c | 5 ++---
fs/ocfs2/dlm/dlmrecovery.c | 4 ++--
4 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
index fe4fdd09bae3..6ca8b3b68eef 100644
--- a/fs/ocfs2/dlm/dlmdebug.c
+++ b/fs/ocfs2/dlm/dlmdebug.c
@@ -260,10 +260,10 @@ void dlm_print_one_mle(struct dlm_master_list_entry *mle)
{
char *buf;
- buf = (char *) get_zeroed_page(GFP_ATOMIC);
+ buf = kzalloc(PAGE_SIZE, GFP_ATOMIC);
if (buf) {
dump_mle(mle, buf, PAGE_SIZE - 1);
- free_page((unsigned long)buf);
+ kfree(buf);
}
}
@@ -280,7 +280,7 @@ static struct dentry *dlm_debugfs_root;
/* begin - utils funcs */
static int debug_release(struct inode *inode, struct file *file)
{
- free_page((unsigned long)file->private_data);
+ kfree(file->private_data);
return 0;
}
@@ -327,17 +327,15 @@ static int debug_purgelist_open(struct inode *inode, struct file *file)
struct dlm_ctxt *dlm = inode->i_private;
char *buf = NULL;
- buf = (char *) get_zeroed_page(GFP_NOFS);
+ buf = kzalloc(PAGE_SIZE, GFP_NOFS);
if (!buf)
- goto bail;
+ return -ENOMEM;
i_size_write(inode, debug_purgelist_print(dlm, buf, PAGE_SIZE - 1));
file->private_data = buf;
return 0;
-bail:
- return -ENOMEM;
}
static const struct file_operations debug_purgelist_fops = {
@@ -384,17 +382,15 @@ static int debug_mle_open(struct inode *inode, struct file *file)
struct dlm_ctxt *dlm = inode->i_private;
char *buf = NULL;
- buf = (char *) get_zeroed_page(GFP_NOFS);
+ buf = kzalloc(PAGE_SIZE, GFP_NOFS);
if (!buf)
- goto bail;
+ return -ENOMEM;
i_size_write(inode, debug_mle_print(dlm, buf, PAGE_SIZE - 1));
file->private_data = buf;
return 0;
-bail:
- return -ENOMEM;
}
static const struct file_operations debug_mle_fops = {
@@ -775,17 +771,15 @@ static int debug_state_open(struct inode *inode, struct file *file)
struct dlm_ctxt *dlm = inode->i_private;
char *buf = NULL;
- buf = (char *) get_zeroed_page(GFP_NOFS);
+ buf = kzalloc(PAGE_SIZE, GFP_NOFS);
if (!buf)
- goto bail;
+ return -ENOMEM;
i_size_write(inode, debug_state_print(dlm, buf, PAGE_SIZE - 1));
file->private_data = buf;
return 0;
-bail:
- return -ENOMEM;
}
static const struct file_operations debug_state_fops = {
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index dc9da9133c8e..97bb9400e24b 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -63,7 +63,7 @@ static inline void byte_copymap(u8 dmap[], unsigned long smap[],
static void dlm_free_pagevec(void **vec, int pages)
{
while (pages--)
- free_page((unsigned long)vec[pages]);
+ kfree(vec[pages]);
kfree(vec);
}
@@ -75,9 +75,11 @@ static void **dlm_alloc_pagevec(int pages)
if (!vec)
return NULL;
- for (i = 0; i < pages; i++)
- if (!(vec[i] = (void *)__get_free_page(GFP_KERNEL)))
+ for (i = 0; i < pages; i++) {
+ vec[i] = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if (!vec[i])
goto out_free;
+ }
mlog(0, "Allocated DLM hash pagevec; %d pages (%lu expected), %lu buckets per page\n",
pages, (unsigned long)DLM_HASH_PAGES,
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 93eff38fdadd..aee3b4c56dcc 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2548,7 +2548,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
/* preallocate up front. if this fails, abort */
ret = -ENOMEM;
- mres = (struct dlm_migratable_lockres *) __get_free_page(GFP_NOFS);
+ mres = kmalloc(PAGE_SIZE, GFP_NOFS);
if (!mres) {
mlog_errno(ret);
goto leave;
@@ -2725,8 +2725,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
if (wake)
wake_up(&res->wq);
- if (mres)
- free_page((unsigned long)mres);
+ kfree(mres);
dlm_put(dlm);
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 128872bd945d..9b97bf73df22 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -837,7 +837,7 @@ int dlm_request_all_locks_handler(struct o2net_msg *msg, u32 len, void *data,
}
/* this will get freed by dlm_request_all_locks_worker */
- buf = (char *) __get_free_page(GFP_NOFS);
+ buf = kmalloc(PAGE_SIZE, GFP_NOFS);
if (!buf) {
kfree(item);
dlm_put(dlm);
@@ -933,7 +933,7 @@ static void dlm_request_all_locks_worker(struct dlm_work_item *item, void *data)
}
}
leave:
- free_page((unsigned long)data);
+ kfree(data);
}
--
2.53.0
^ permalink raw reply related
* [PATCH 04/17] nilfs2: replace get_zeroed_page() with kzalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
nilfs_ioctl_wrap_copy() allocates a temporary buffer with
get_zeroed_page().
kzalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of get_zeroed_page() with kzalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/nilfs2/ioctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index e0a606643e87..b73f2c5d10f0 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -69,7 +69,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
if (argv->v_index > ~(__u64)0 - argv->v_nmembs)
return -EINVAL;
- buf = (void *)get_zeroed_page(GFP_NOFS);
+ buf = kzalloc(PAGE_SIZE, GFP_NOFS);
if (unlikely(!buf))
return -ENOMEM;
maxmembs = PAGE_SIZE / argv->v_size;
@@ -107,7 +107,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
}
argv->v_nmembs = total;
- free_pages((unsigned long)buf, 0);
+ kfree(buf);
return ret;
}
--
2.53.0
^ permalink raw reply related
* [PATCH 05/17] NFS: replace __get_free_page() with kmalloc() in nfs_show_devname()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
nfs_show_devname() allocates a tmemporary buffer __get_free_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() with kmalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/nfs/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 4cd420b14ce3..8f8a03a68d3d 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -623,7 +623,7 @@ static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
int nfs_show_devname(struct seq_file *m, struct dentry *root)
{
- char *page = (char *) __get_free_page(GFP_KERNEL);
+ char *page = kmalloc(PAGE_SIZE, GFP_KERNEL);
char *devname, *dummy;
int err = 0;
if (!page)
@@ -633,7 +633,7 @@ int nfs_show_devname(struct seq_file *m, struct dentry *root)
err = PTR_ERR(devname);
else
seq_escape(m, devname, " \t\n\\");
- free_page((unsigned long)page);
+ kfree(page);
return err;
}
EXPORT_SYMBOL_GPL(nfs_show_devname);
--
2.53.0
^ permalink raw reply related
* [PATCH 06/17] NFS: remove unused page and page2 in nfs4_replace_transport()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
Temporary buffers page and page2 allocated by nfs4_replace_transport() and
passed to nfs4_try_replacing_one_location() are never used.
Remove them and the code that allocates and frees memory for these buffers.
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/nfs/nfs4namespace.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 14f72baf3b30..2a03f02bba7c 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -481,7 +481,6 @@ int nfs4_submount(struct fs_context *fc, struct nfs_server *server)
* Returns zero on success, or a negative errno value.
*/
static int nfs4_try_replacing_one_location(struct nfs_server *server,
- char *page, char *page2,
const struct nfs4_fs_location *location)
{
struct net *net = rpc_net_ns(server->client);
@@ -541,21 +540,12 @@ static int nfs4_try_replacing_one_location(struct nfs_server *server,
int nfs4_replace_transport(struct nfs_server *server,
const struct nfs4_fs_locations *locations)
{
- char *page = NULL, *page2 = NULL;
int loc, error;
error = -ENOENT;
if (locations == NULL || locations->nlocations <= 0)
goto out;
- error = -ENOMEM;
- page = (char *) __get_free_page(GFP_USER);
- if (!page)
- goto out;
- page2 = (char *) __get_free_page(GFP_USER);
- if (!page2)
- goto out;
-
for (loc = 0; loc < locations->nlocations; loc++) {
const struct nfs4_fs_location *location =
&locations->locations[loc];
@@ -564,14 +554,11 @@ int nfs4_replace_transport(struct nfs_server *server,
location->rootpath.ncomponents == 0)
continue;
- error = nfs4_try_replacing_one_location(server, page,
- page2, location);
+ error = nfs4_try_replacing_one_location(server, location);
if (error == 0)
break;
}
out:
- free_page((unsigned long)page);
- free_page((unsigned long)page2);
return error;
}
--
2.53.0
^ permalink raw reply related
* [PATCH 07/17] NFSD: replace __get_free_page() with kmalloc() in nfsd_buffered_readdir()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
nfsd_buffered_readdir() allocates a staging buffer with __get_free_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() with kmalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/nfsd/vfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index eafdf7b7890f..c99e54b23cd9 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -2407,7 +2407,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, struct svc_fh *fhp,
loff_t offset;
struct readdir_data buf = {
.ctx.actor = nfsd_buffered_filldir,
- .dirent = (void *)__get_free_page(GFP_KERNEL)
+ .dirent = kmalloc(PAGE_SIZE, GFP_KERNEL)
};
if (!buf.dirent)
@@ -2458,7 +2458,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, struct svc_fh *fhp,
offset = vfs_llseek(file, 0, SEEK_CUR);
}
- free_page((unsigned long)(buf.dirent));
+ kfree((buf.dirent));
if (host_err)
return nfserrno(host_err);
--
2.53.0
^ permalink raw reply related
* [PATCH 08/17] libfs: simple_transaction_get(): replace get_zeroed_page() with kzalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
simple_transaction_get() allocates memory with get_zeroed_page(). That
memory is used as a file local buffer that is accessed using
copy_from_user() and simple_read_from_buffer().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of get_zeroed_page() with kzalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/libfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/libfs.c b/fs/libfs.c
index 1bbea5e7bae3..80a330c8296f 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1258,7 +1258,7 @@ char *simple_transaction_get(struct file *file, const char __user *buf, size_t s
if (size > SIMPLE_TRANSACTION_LIMIT - 1)
return ERR_PTR(-EFBIG);
- ar = (struct simple_transaction_argresp *)get_zeroed_page(GFP_KERNEL);
+ ar = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!ar)
return ERR_PTR(-ENOMEM);
@@ -1267,7 +1267,7 @@ char *simple_transaction_get(struct file *file, const char __user *buf, size_t s
/* only one write allowed per open */
if (file->private_data) {
spin_unlock(&simple_transaction_lock);
- free_page((unsigned long)ar);
+ kfree(ar);
return ERR_PTR(-EBUSY);
}
@@ -1294,7 +1294,7 @@ EXPORT_SYMBOL(simple_transaction_read);
int simple_transaction_release(struct inode *inode, struct file *file)
{
- free_page((unsigned long)file->private_data);
+ kfree(file->private_data);
return 0;
}
EXPORT_SYMBOL(simple_transaction_release);
--
2.53.0
^ permalink raw reply related
* [PATCH 09/17] jfs: replace __get_free_page() with kmalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
jfs_readdir() allocates dirent_buf with __get_free_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() with kmalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/jfs/jfs_dtree.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index ac0f79fafaca..8ce6e4458cc2 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -2729,7 +2729,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
struct ldtentry *d;
struct dtslot *t;
int d_namleft, len, outlen;
- unsigned long dirent_buf;
+ void *dirent_buf;
char *name_ptr;
u32 dir_index;
int do_index = 0;
@@ -2884,7 +2884,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
}
}
- dirent_buf = __get_free_page(GFP_KERNEL);
+ dirent_buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (dirent_buf == 0) {
DT_PUTPAGE(mp);
jfs_warn("jfs_readdir: __get_free_page failed!");
@@ -2893,7 +2893,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
}
while (1) {
- jfs_dirent = (struct jfs_dirent *) dirent_buf;
+ jfs_dirent = dirent_buf;
jfs_dirents = 0;
overflow = fix_page = 0;
@@ -2903,7 +2903,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
if (stbl[i] < 0) {
jfs_err("JFS: Invalid stbl[%d] = %d for inode %ld, block = %lld",
i, stbl[i], (long)ip->i_ino, (long long)bn);
- free_page(dirent_buf);
+ kfree(dirent_buf);
DT_PUTPAGE(mp);
return -EIO;
}
@@ -2911,7 +2911,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
d = (struct ldtentry *) & p->slot[stbl[i]];
if (((long) jfs_dirent + d->namlen + 1) >
- (dirent_buf + PAGE_SIZE)) {
+ ((long)dirent_buf + PAGE_SIZE)) {
/* DBCS codepages could overrun dirent_buf */
index = i;
overflow = 1;
@@ -3014,7 +3014,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
/* unpin previous leaf page */
DT_PUTPAGE(mp);
- jfs_dirent = (struct jfs_dirent *) dirent_buf;
+ jfs_dirent = dirent_buf;
while (jfs_dirents--) {
ctx->pos = jfs_dirent->position;
if (!dir_emit(ctx, jfs_dirent->name,
@@ -3037,13 +3037,13 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) {
- free_page(dirent_buf);
+ kfree(dirent_buf);
return rc;
}
}
out:
- free_page(dirent_buf);
+ kfree(dirent_buf);
return rc;
}
--
2.53.0
^ permalink raw reply related
* [PATCH 10/17] jbd2: replace __get_free_pages() with kmalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
jbd2_alloc() falls back from kmem_cache_alloc() to __get_free_pages() for
allocations larger than PAGE_SIZE.
But kmalloc() can handle such cases with essentially the same fallback.
Replace use of __get_free_pages() with kmalloc() and simplify
jbd2_free() as both kmem_cache_alloc() and kmalloc() allocations can be
freed with kfree().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/jbd2/journal.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 4f397fcdb13c..1137b471e490 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2784,7 +2784,7 @@ void *jbd2_alloc(size_t size, gfp_t flags)
if (size < PAGE_SIZE)
ptr = kmem_cache_alloc(get_slab(size), flags);
else
- ptr = (void *)__get_free_pages(flags, get_order(size));
+ ptr = kmalloc(size, flags);
/* Check alignment; SLUB has gotten this wrong in the past,
* and this can lead to user data corruption! */
@@ -2795,10 +2795,7 @@ void *jbd2_alloc(size_t size, gfp_t flags)
void jbd2_free(void *ptr, size_t size)
{
- if (size < PAGE_SIZE)
- kmem_cache_free(get_slab(size), ptr);
- else
- free_pages((unsigned long)ptr, get_order(size));
+ kfree(ptr);
};
/*
--
2.53.0
^ permalink raw reply related
* [PATCH 11/17] isofs: replace __get_free_page() with kmalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
isofs_readdir() allocates a temporary buffer with __get_free_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() with kmalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/isofs/dir.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 2fd9948d606e..6d220eab531e 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -13,6 +13,7 @@
*/
#include <linux/gfp.h>
#include <linux/filelock.h>
+#include <linux/slab.h>
#include "isofs.h"
int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode)
@@ -255,7 +256,7 @@ static int isofs_readdir(struct file *file, struct dir_context *ctx)
struct iso_directory_record *tmpde;
struct inode *inode = file_inode(file);
- tmpname = (char *)__get_free_page(GFP_KERNEL);
+ tmpname = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (tmpname == NULL)
return -ENOMEM;
@@ -263,7 +264,7 @@ static int isofs_readdir(struct file *file, struct dir_context *ctx)
result = do_isofs_readdir(inode, file, ctx, tmpname, tmpde);
- free_page((unsigned long) tmpname);
+ kfree(tmpname);
return result;
}
--
2.53.0
^ permalink raw reply related
* [PATCH 12/17] fuse: replace __get_free_page() with kmalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
fuse_do_ioctl allocates memory for struct iov array using
__get_free_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() with kmalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/fuse/ioctl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index fdc175e93f74..3614ea603913 100644
--- a/fs/fuse/ioctl.c
+++ b/fs/fuse/ioctl.c
@@ -10,6 +10,7 @@
#include <linux/fileattr.h>
#include <linux/fsverity.h>
+#include <linux/slab.h>
#define FUSE_VERITY_ENABLE_ARG_MAX_PAGES 256
static ssize_t fuse_send_ioctl(struct fuse_mount *fm, struct fuse_args *args,
@@ -252,7 +253,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
err = -ENOMEM;
ap.folios = fuse_folios_alloc(fm->fc->max_pages, GFP_KERNEL, &ap.descs);
- iov_page = (struct iovec *) __get_free_page(GFP_KERNEL);
+ iov_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!ap.folios || !iov_page)
goto out;
@@ -400,7 +401,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
}
err = 0;
out:
- free_page((unsigned long) iov_page);
+ kfree(iov_page);
while (ap.num_folios)
folio_put(ap.folios[--ap.num_folios]);
kfree(ap.folios);
--
2.53.0
^ permalink raw reply related
* [PATCH 13/17] fs/select: replace __get_free_page() with kmalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
poll_get_entry() allocates new memory for poll_table entries using
__get_free_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() with kmalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/select.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/select.c b/fs/select.c
index 75978b18f48f..6fa63e48cdee 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -150,7 +150,7 @@ void poll_freewait(struct poll_wqueues *pwq)
} while (entry > p->entries);
old = p;
p = p->next;
- free_page((unsigned long) old);
+ kfree(old);
}
}
EXPORT_SYMBOL(poll_freewait);
@@ -165,7 +165,7 @@ static struct poll_table_entry *poll_get_entry(struct poll_wqueues *p)
if (!table || POLL_TABLE_FULL(table)) {
struct poll_table_page *new_table;
- new_table = (struct poll_table_page *) __get_free_page(GFP_KERNEL);
+ new_table = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!new_table) {
p->error = -ENOMEM;
return NULL;
--
2.53.0
^ permalink raw reply related
* [PATCH 14/17] fs/namespace: use __getname() to allocate mntpath buffer
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
mnt_warn_timestamp_expiry() allocates memory for a path with
__get_free_page() although there is a dedicated helper for allocation of
file paths: __getname().
Replace __get_free_page() for allocation of a path buffer with __getname().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/namespace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index fe919abd2f01..2ed9cd846a81 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3303,7 +3303,7 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint,
(ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) {
char *buf, *mntpath;
- buf = (char *)__get_free_page(GFP_KERNEL);
+ buf = __getname();
if (buf)
mntpath = d_path(mountpoint, buf, PAGE_SIZE);
else
@@ -3319,7 +3319,7 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint,
sb->s_iflags |= SB_I_TS_EXPIRY_WARNED;
if (buf)
- free_page((unsigned long)buf);
+ __putname(buf);
}
}
--
2.53.0
^ permalink raw reply related
* [PATCH 15/17] configfs: replace __get_free_pages() with kzalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
configfs allocates staging buffers __get_free_pages().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_pages() with kzalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/configfs/file.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index ef8c3cd10cc6..a48cece775a3 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -59,7 +59,7 @@ static int fill_read_buffer(struct file *file, struct configfs_buffer *buffer)
ssize_t count = -ENOENT;
if (!buffer->page)
- buffer->page = (char *) get_zeroed_page(GFP_KERNEL);
+ buffer->page = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!buffer->page)
return -ENOMEM;
@@ -184,7 +184,7 @@ static int fill_write_buffer(struct configfs_buffer *buffer,
int copied;
if (!buffer->page)
- buffer->page = (char *)__get_free_pages(GFP_KERNEL, 0);
+ buffer->page = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!buffer->page)
return -ENOMEM;
@@ -381,8 +381,7 @@ static int configfs_release(struct inode *inode, struct file *filp)
struct configfs_buffer *buffer = filp->private_data;
module_put(buffer->owner);
- if (buffer->page)
- free_page((unsigned long)buffer->page);
+ kfree(buffer->page);
mutex_destroy(&buffer->mutex);
kfree(buffer);
return 0;
--
2.53.0
^ permalink raw reply related
* [PATCH 16/17] binfmt_misc: replace __get_free_page() with kmalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
bm_entry_read() allocates temporary buffer using __get_free_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of __get_free_page() with kmalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/binfmt_misc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index b3d8fd70e8b1..84349fcb93f1 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -704,7 +704,7 @@ bm_entry_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
ssize_t res;
char *page;
- page = (char *) __get_free_page(GFP_KERNEL);
+ page = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!page)
return -ENOMEM;
@@ -712,7 +712,7 @@ bm_entry_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
res = simple_read_from_buffer(buf, nbytes, ppos, page, strlen(page));
- free_page((unsigned long) page);
+ kfree(page);
return res;
}
--
2.53.0
^ permalink raw reply related
* [PATCH 17/17] bfs: replace get_zeroed_page() with kzalloc()
From: Mike Rapoport (Microsoft) @ 2026-05-23 17:54 UTC (permalink / raw)
To: Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi, Ryusuke Konishi,
Viacheslav Dubeyko, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Alexander Viro, Christian Brauner, Jan Kara, Dave Kleikamp,
Theodore Ts'o, Miklos Szeredi, Andreas Hindborg, Breno Leitao,
Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm, Mike Rapoport (Microsoft)
In-Reply-To: <20260523-b4-fs-v1-0-275e36a83f0e@kernel.org>
bfs_dump_imap() allocates temporary buffer with get_zeroed_page().
kmalloc() is a better API for such use and it also provides better
scalability and more debugging possibilities.
Replace use of get_zeroed_page() with kzalloc().
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
fs/bfs/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 19e49c8cf750..0d7b95371271 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -311,7 +311,7 @@ void bfs_dump_imap(const char *prefix, struct super_block *s)
{
#ifdef DEBUG
int i;
- char *tmpbuf = (char *)get_zeroed_page(GFP_KERNEL);
+ char *tmpbuf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!tmpbuf)
return;
@@ -323,7 +323,7 @@ void bfs_dump_imap(const char *prefix, struct super_block *s)
strcat(tmpbuf, "0");
}
printf("%s: lasti=%08lx <%s>\n", prefix, BFS_SB(s)->si_lasti, tmpbuf);
- free_page((unsigned long)tmpbuf);
+ kfree(tmpbuf);
#endif
}
--
2.53.0
^ permalink raw reply related
* Re: [PATCH 07/17] NFSD: replace __get_free_page() with kmalloc() in nfsd_buffered_readdir()
From: Jeff Layton @ 2026-05-23 18:45 UTC (permalink / raw)
To: Mike Rapoport (Microsoft), Jan Kara, Mark Fasheh, Joel Becker,
Joseph Qi, Ryusuke Konishi, Viacheslav Dubeyko, Trond Myklebust,
Anna Schumaker, Chuck Lever, NeilBrown, Olga Kornievskaia,
Dai Ngo, Tom Talpey, Alexander Viro, Christian Brauner, Jan Kara,
Dave Kleikamp, Theodore Ts'o, Miklos Szeredi,
Andreas Hindborg, Breno Leitao, Kees Cook, Tigran A. Aivazian
Cc: linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm
In-Reply-To: <20260523-b4-fs-v1-7-275e36a83f0e@kernel.org>
On Sat, 2026-05-23 at 20:54 +0300, Mike Rapoport (Microsoft) wrote:
> nfsd_buffered_readdir() allocates a staging buffer with __get_free_page().
>
> kmalloc() is a better API for such use and it also provides better
> scalability and more debugging possibilities.
>
> Replace use of __get_free_page() with kmalloc().
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> fs/nfsd/vfs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index eafdf7b7890f..c99e54b23cd9 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -2407,7 +2407,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, struct svc_fh *fhp,
> loff_t offset;
> struct readdir_data buf = {
> .ctx.actor = nfsd_buffered_filldir,
> - .dirent = (void *)__get_free_page(GFP_KERNEL)
> + .dirent = kmalloc(PAGE_SIZE, GFP_KERNEL)
> };
>
> if (!buf.dirent)
> @@ -2458,7 +2458,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, struct svc_fh *fhp,
> offset = vfs_llseek(file, 0, SEEK_CUR);
> }
>
> - free_page((unsigned long)(buf.dirent));
> + kfree((buf.dirent));
nit: Don't need double parenthesis here
>
> if (host_err)
> return nfserrno(host_err);
The rest seems ok though.
Acked-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply
* Re: [PATCH] ext2: Remove deprecated DAX support
From: kernel test robot @ 2026-05-24 1:26 UTC (permalink / raw)
To: Ashwin Gundarapu, jack; +Cc: llvm, oe-kbuild-all, linux-ext4, linux-kernel
In-Reply-To: <19e54c7cba1.5355cb8650862.622752146451851140@zohomail.in>
Hi Ashwin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jack-fs/for_next]
[also build test WARNING on linus/master v7.1-rc4 next-20260522]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ashwin-Gundarapu/ext2-Remove-deprecated-DAX-support/20260523-202224
base: https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next
patch link: https://lore.kernel.org/r/19e54c7cba1.5355cb8650862.622752146451851140%40zohomail.in
patch subject: [PATCH] ext2: Remove deprecated DAX support
config: riscv-nommu_virt_defconfig (https://download.01.org/0day-ci/archive/20260524/202605240952.dIQvDsdW-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260524/202605240952.dIQvDsdW-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605240952.dIQvDsdW-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/riscv/include/asm/io.h:140:
include/asm-generic/io.h:838:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
838 | insb(addr, buffer, count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:108:53: note: expanded from macro 'insb'
108 | #define insb(addr, buffer, count) __insb(PCI_IOBASE + (addr), buffer, count)
| ~~~~~~~~~~ ^
In file included from fs/ext2/inode.c:28:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/riscv/include/asm/io.h:140:
include/asm-generic/io.h:846:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
846 | insw(addr, buffer, count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:109:53: note: expanded from macro 'insw'
109 | #define insw(addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count)
| ~~~~~~~~~~ ^
In file included from fs/ext2/inode.c:28:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/riscv/include/asm/io.h:140:
include/asm-generic/io.h:854:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
854 | insl(addr, buffer, count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:110:53: note: expanded from macro 'insl'
110 | #define insl(addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count)
| ~~~~~~~~~~ ^
In file included from fs/ext2/inode.c:28:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/riscv/include/asm/io.h:140:
include/asm-generic/io.h:863:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
863 | outsb(addr, buffer, count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:122:55: note: expanded from macro 'outsb'
122 | #define outsb(addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count)
| ~~~~~~~~~~ ^
In file included from fs/ext2/inode.c:28:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/riscv/include/asm/io.h:140:
include/asm-generic/io.h:872:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
872 | outsw(addr, buffer, count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:123:55: note: expanded from macro 'outsw'
123 | #define outsw(addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count)
| ~~~~~~~~~~ ^
In file included from fs/ext2/inode.c:28:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/riscv/include/asm/io.h:140:
include/asm-generic/io.h:881:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
881 | outsl(addr, buffer, count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:124:55: note: expanded from macro 'outsl'
124 | #define outsl(addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count)
| ~~~~~~~~~~ ^
In file included from fs/ext2/inode.c:28:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:12:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/riscv/include/asm/io.h:140:
include/asm-generic/io.h:1209:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
1209 | return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
| ~~~~~~~~~~ ^
>> fs/ext2/inode.c:792:23: warning: unused variable 'sbi' [-Wunused-variable]
792 | struct ext2_sb_info *sbi = EXT2_SB(inode->i_sb);
| ^~~
8 warnings generated.
vim +/sbi +792 fs/ext2/inode.c
a686cd898bd999f Martin J. Bligh 2007-10-16 785
25f4e70291a3097 Christoph Hellwig 2016-09-19 786 static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
c039b9979272634 Goldwyn Rodrigues 2019-10-18 787 unsigned flags, struct iomap *iomap, struct iomap *srcmap)
25f4e70291a3097 Christoph Hellwig 2016-09-19 788 {
25f4e70291a3097 Christoph Hellwig 2016-09-19 789 unsigned int blkbits = inode->i_blkbits;
25f4e70291a3097 Christoph Hellwig 2016-09-19 790 unsigned long first_block = offset >> blkbits;
25f4e70291a3097 Christoph Hellwig 2016-09-19 791 unsigned long max_blocks = (length + (1 << blkbits) - 1) >> blkbits;
8cf037a8b22f71c Dan Williams 2017-08-30 @792 struct ext2_sb_info *sbi = EXT2_SB(inode->i_sb);
25f4e70291a3097 Christoph Hellwig 2016-09-19 793 bool new = false, boundary = false;
25f4e70291a3097 Christoph Hellwig 2016-09-19 794 u32 bno;
25f4e70291a3097 Christoph Hellwig 2016-09-19 795 int ret;
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 796) bool create = flags & IOMAP_WRITE;
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 797)
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 798) /*
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 799) * For writes that could fill holes inside i_size on a
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 800) * DIO_SKIP_HOLES filesystem we forbid block creations: only
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 801) * overwrites are permitted.
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 802) */
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 803) if ((flags & IOMAP_DIRECT) &&
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 804) (first_block << blkbits) < i_size_read(inode))
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 805) create = 0;
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 806)
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 807) /*
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 808) * Writes that span EOF might trigger an IO size update on completion,
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 809) * so consider them to be dirty for the purposes of O_DSYNC even if
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 810) * there is no other metadata changes pending or have been made here.
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 811) */
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 812) if ((flags & IOMAP_WRITE) && offset + length > i_size_read(inode))
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 813) iomap->flags |= IOMAP_F_DIRTY;
25f4e70291a3097 Christoph Hellwig 2016-09-19 814
25f4e70291a3097 Christoph Hellwig 2016-09-19 815 ret = ext2_get_blocks(inode, first_block, max_blocks,
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 816) &bno, &new, &boundary, create);
25f4e70291a3097 Christoph Hellwig 2016-09-19 817 if (ret < 0)
a686cd898bd999f Martin J. Bligh 2007-10-16 818 return ret;
a686cd898bd999f Martin J. Bligh 2007-10-16 819
25f4e70291a3097 Christoph Hellwig 2016-09-19 820 iomap->flags = 0;
d5bfccdf38d094f Christoph Hellwig 2016-10-03 821 iomap->offset = (u64)first_block << blkbits;
de2051147771017 Christoph Hellwig 2021-11-29 822 iomap->bdev = inode->i_sb->s_bdev;
25f4e70291a3097 Christoph Hellwig 2016-09-19 823
25f4e70291a3097 Christoph Hellwig 2016-09-19 824 if (ret == 0) {
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 825) /*
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 826) * Switch to buffered-io for writing to holes in a non-extent
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 827) * based filesystem to avoid stale data exposure problem.
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 828) */
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 829) if (!create && (flags & IOMAP_WRITE) && (flags & IOMAP_DIRECT))
fb5de4358e1aa47 Ritesh Harjani (IBM 2023-04-21 830) return -ENOTBLK;
25f4e70291a3097 Christoph Hellwig 2016-09-19 831 iomap->type = IOMAP_HOLE;
19fe5f643f89f29 Andreas Gruenbacher 2017-10-01 832 iomap->addr = IOMAP_NULL_ADDR;
25f4e70291a3097 Christoph Hellwig 2016-09-19 833 iomap->length = 1 << blkbits;
25f4e70291a3097 Christoph Hellwig 2016-09-19 834 } else {
25f4e70291a3097 Christoph Hellwig 2016-09-19 835 iomap->type = IOMAP_MAPPED;
19fe5f643f89f29 Andreas Gruenbacher 2017-10-01 836 iomap->addr = (u64)bno << blkbits;
25f4e70291a3097 Christoph Hellwig 2016-09-19 837 iomap->length = (u64)ret << blkbits;
25f4e70291a3097 Christoph Hellwig 2016-09-19 838 iomap->flags |= IOMAP_F_MERGED;
25f4e70291a3097 Christoph Hellwig 2016-09-19 839 }
25f4e70291a3097 Christoph Hellwig 2016-09-19 840
25f4e70291a3097 Christoph Hellwig 2016-09-19 841 if (new)
25f4e70291a3097 Christoph Hellwig 2016-09-19 842 iomap->flags |= IOMAP_F_NEW;
25f4e70291a3097 Christoph Hellwig 2016-09-19 843 return 0;
a686cd898bd999f Martin J. Bligh 2007-10-16 844 }
a686cd898bd999f Martin J. Bligh 2007-10-16 845
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* [PATCH v6 v6 2/3] ext4: use READ_ONCE/WRITE_ONCE for s_mb_stats
From: Baolin Liu @ 2026-05-24 1:54 UTC (permalink / raw)
To: corbet, skhan, tytso, adilger.kernel, libaokun, jack, ojaswin,
ritesh.list, yi.zhang
Cc: linux-ext4, linux-kernel, Baolin Liu
In-Reply-To: <20260524015421.2529617-1-liubaolin12138@163.com>
From: Baolin Liu <liubaolin@kylinos.cn>
Use READ_ONCE()/WRITE_ONCE() for concurrent accesses to
s_mb_stats.
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
fs/ext4/mballoc.c | 24 ++++++++++++------------
fs/ext4/sysfs.c | 25 ++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d36b0f7b5d7d..fed6d854877b 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -924,7 +924,7 @@ static int ext4_mb_scan_groups_xa_range(struct ext4_allocation_context *ac,
xa_for_each_range(xa, group, grp, start, end - 1) {
int err;
- if (sbi->s_mb_stats)
+ if (READ_ONCE(sbi->s_mb_stats))
atomic64_inc(&sbi->s_bal_cX_groups_considered[cr]);
err = ext4_mb_scan_group(ac, grp->bb_group);
@@ -980,7 +980,7 @@ static int ext4_mb_scan_groups_p2_aligned(struct ext4_allocation_context *ac,
goto wrap_around;
}
- if (sbi->s_mb_stats)
+ if (READ_ONCE(sbi->s_mb_stats))
atomic64_inc(&sbi->s_bal_cX_failed[ac->ac_criteria]);
/* Increment cr and search again if no group is found */
@@ -1031,7 +1031,7 @@ static int ext4_mb_scan_groups_goal_fast(struct ext4_allocation_context *ac,
goto wrap_around;
}
- if (sbi->s_mb_stats)
+ if (READ_ONCE(sbi->s_mb_stats))
atomic64_inc(&sbi->s_bal_cX_failed[ac->ac_criteria]);
/*
* CR_BEST_AVAIL_LEN works based on the concept that we have
@@ -1135,7 +1135,7 @@ static int ext4_mb_scan_groups_best_avail(struct ext4_allocation_context *ac,
/* Reset goal length to original goal length before falling into CR_GOAL_LEN_SLOW */
ac->ac_g_ex.fe_len = ac->ac_orig_goal_len;
- if (sbi->s_mb_stats)
+ if (READ_ONCE(sbi->s_mb_stats))
atomic64_inc(&sbi->s_bal_cX_failed[ac->ac_criteria]);
ac->ac_criteria = CR_GOAL_LEN_SLOW;
@@ -1184,7 +1184,7 @@ static int ext4_mb_scan_groups_linear(struct ext4_allocation_context *ac,
ac->ac_criteria++;
/* Processed all groups and haven't found blocks */
- if (sbi->s_mb_stats && i == ngroups)
+ if (READ_ONCE(sbi->s_mb_stats) && i == ngroups)
atomic64_inc(&sbi->s_bal_cX_failed[cr]);
return 0;
@@ -2541,7 +2541,7 @@ void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac,
BUG_ON(ac->ac_f_ex.fe_len != ac->ac_g_ex.fe_len);
- if (EXT4_SB(sb)->s_mb_stats)
+ if (READ_ONCE(EXT4_SB(sb)->s_mb_stats))
atomic_inc(&EXT4_SB(sb)->s_bal_2orders);
break;
@@ -2786,7 +2786,7 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
if (!grp)
return -EFSCORRUPTED;
- if (sbi->s_mb_stats)
+ if (READ_ONCE(sbi->s_mb_stats))
atomic64_inc(&sbi->s_bal_cX_groups_considered[ac->ac_criteria]);
if (should_lock) {
ext4_lock_group(sb, group);
@@ -3097,7 +3097,7 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
}
}
- if (sbi->s_mb_stats && ac->ac_status == AC_STATUS_FOUND) {
+ if (READ_ONCE(sbi->s_mb_stats) && ac->ac_status == AC_STATUS_FOUND) {
atomic64_inc(&sbi->s_bal_cX_hits[ac->ac_criteria]);
if (ac->ac_flags & EXT4_MB_STREAM_ALLOC &&
ac->ac_b_ex.fe_group == ac->ac_g_ex.fe_group)
@@ -3210,7 +3210,7 @@ int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset)
struct ext4_sb_info *sbi = EXT4_SB(sb);
seq_puts(seq, "mballoc:\n");
- if (!sbi->s_mb_stats) {
+ if (!READ_ONCE(sbi->s_mb_stats)) {
seq_puts(seq, "\tmb stats collection turned off.\n");
seq_puts(
seq,
@@ -3787,7 +3787,7 @@ int ext4_mb_init(struct super_block *sb)
sbi->s_mb_max_to_scan = MB_DEFAULT_MAX_TO_SCAN;
sbi->s_mb_min_to_scan = MB_DEFAULT_MIN_TO_SCAN;
- sbi->s_mb_stats = MB_DEFAULT_STATS;
+ WRITE_ONCE(sbi->s_mb_stats, MB_DEFAULT_STATS);
sbi->s_mb_stream_request = MB_DEFAULT_STREAM_THRESHOLD;
sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS;
sbi->s_mb_best_avail_max_trim_order = MB_DEFAULT_BEST_AVAIL_TRIM_ORDER;
@@ -3929,7 +3929,7 @@ void ext4_mb_release(struct super_block *sb)
kfree(sbi->s_mb_offsets);
kfree(sbi->s_mb_maxs);
iput(sbi->s_buddy_cache);
- if (sbi->s_mb_stats) {
+ if (READ_ONCE(sbi->s_mb_stats)) {
ext4_msg(sb, KERN_INFO,
"mballoc: %u blocks %u reqs (%u success)",
atomic_read(&sbi->s_bal_allocated),
@@ -4694,7 +4694,7 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)
{
struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
- if (sbi->s_mb_stats && ac->ac_g_ex.fe_len >= 1) {
+ if (READ_ONCE(sbi->s_mb_stats) && ac->ac_g_ex.fe_len >= 1) {
atomic_inc(&sbi->s_bal_reqs);
atomic_add(ac->ac_b_ex.fe_len, &sbi->s_bal_allocated);
if (ac->ac_b_ex.fe_len >= ac->ac_o_ex.fe_len)
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index afe12bcc1603..47e06c32c6fb 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -41,6 +41,7 @@ typedef enum {
attr_pointer_atomic,
attr_journal_task,
attr_err_report_sec,
+ attr_mb_stats,
} attr_id_t;
typedef enum {
@@ -241,6 +242,7 @@ EXT4_ATTR_FUNC(session_write_kbytes, 0444);
EXT4_ATTR_FUNC(lifetime_write_kbytes, 0444);
EXT4_ATTR_FUNC(reserved_clusters, 0644);
EXT4_ATTR_FUNC(sra_exceeded_retry_limit, 0444);
+EXT4_ATTR_FUNC(mb_stats, 0644);
EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, inode_readahead,
ext4_sb_info, s_inode_readahead_blks);
@@ -250,7 +252,6 @@ EXT4_ATTR_OFFSET(mb_best_avail_max_trim_order, 0644, mb_order,
ext4_sb_info, s_mb_best_avail_max_trim_order);
EXT4_ATTR_OFFSET(err_report_sec, 0644, err_report_sec, ext4_sb_info, s_err_report_sec);
EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
-EXT4_RW_ATTR_SBI_UI(mb_stats, s_mb_stats);
EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
@@ -451,6 +452,24 @@ static ssize_t ext4_generic_attr_show(struct ext4_attr *a,
return 0;
}
+static ssize_t mb_stats_show(struct ext4_sb_info *sbi, char *buf)
+{
+ return sysfs_emit(buf, "%u\n", READ_ONCE(sbi->s_mb_stats));
+}
+
+static ssize_t mb_stats_store(struct ext4_sb_info *sbi,
+ const char *buf, size_t len)
+{
+ unsigned int t;
+ int ret;
+
+ ret = kstrtouint(skip_spaces(buf), 0, &t);
+ if (ret)
+ return ret;
+ WRITE_ONCE(sbi->s_mb_stats, t);
+ return len;
+}
+
static ssize_t ext4_attr_show(struct kobject *kobj,
struct attribute *attr, char *buf)
{
@@ -475,6 +494,8 @@ static ssize_t ext4_attr_show(struct kobject *kobj,
return sysfs_emit(buf, "%llu\n",
(unsigned long long)
percpu_counter_sum(&sbi->s_sra_exceeded_retry_limit));
+ case attr_mb_stats:
+ return mb_stats_show(sbi, buf);
case attr_feature:
return sysfs_emit(buf, "supported\n");
case attr_first_error_time:
@@ -559,6 +580,8 @@ static ssize_t ext4_attr_store(struct kobject *kobj,
return inode_readahead_blks_store(sbi, buf, len);
case attr_trigger_test_error:
return trigger_test_error(sbi, buf, len);
+ case attr_mb_stats:
+ return mb_stats_store(sbi, buf, len);
case attr_err_report_sec:
return err_report_sec_store(sbi, buf, len);
default:
--
2.51.0
^ permalink raw reply related
* [PATCH v6 v6 3/3] ext4: allow controlling mballoc stats through proc mb_stats
From: Baolin Liu @ 2026-05-24 1:54 UTC (permalink / raw)
To: corbet, skhan, tytso, adilger.kernel, libaokun, jack, ojaswin,
ritesh.list, yi.zhang
Cc: linux-ext4, linux-kernel, Baolin Liu, Andreas Dilger
In-Reply-To: <20260524015421.2529617-1-liubaolin12138@163.com>
From: Baolin Liu <liubaolin@kylinos.cn>
Make /proc/fs/ext4/<dev>/mb_stats writable. Writing 0 disables mballoc
statistics collection, writing 1 enables it, and writing -1 clears the
current statistics before enabling collection.
Update the documentation and deprecate the sysfs mb_stats entry.
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Baokun Li <libaokun@linux.alibaba.com>
Reviewed-by: Ted Tso <tytso@mit.edu>
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
Documentation/ABI/testing/sysfs-fs-ext4 | 3 +-
Documentation/admin-guide/ext4.rst | 9 +++-
Documentation/filesystems/proc.rst | 13 +-----
fs/ext4/ext4.h | 2 +
fs/ext4/mballoc.c | 32 +++++++++++++-
fs/ext4/sysfs.c | 55 ++++++++++++++++++++++++-
6 files changed, 97 insertions(+), 17 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-fs-ext4 b/Documentation/ABI/testing/sysfs-fs-ext4
index 2edd0a6672d3..7bf06c533343 100644
--- a/Documentation/ABI/testing/sysfs-fs-ext4
+++ b/Documentation/ABI/testing/sysfs-fs-ext4
@@ -5,7 +5,8 @@ Description:
Controls whether the multiblock allocator should
collect statistics, which are shown during the unmount.
1 means to collect statistics, 0 means not to collect
- statistics
+ statistics. This sysfs entry is deprecated, and users
+ should prefer /proc/fs/ext4/<disk>/mb_stats.
What: /sys/fs/ext4/<disk>/mb_group_prealloc
Date: March 2008
diff --git a/Documentation/admin-guide/ext4.rst b/Documentation/admin-guide/ext4.rst
index ac0c709ea9e7..ca76e981b2aa 100644
--- a/Documentation/admin-guide/ext4.rst
+++ b/Documentation/admin-guide/ext4.rst
@@ -436,6 +436,12 @@ Files in /proc/fs/ext4/<devname>
mb_groups
details of multiblock allocator buddy cache of free blocks
+ mb_stats
+ reports runtime statistics from the multiblock allocator
+ (mballoc). Writing 0 disables statistics collection, writing
+ 1 enables statistics collection, and writing -1 clears the
+ current statistics and enables statistics collection.
+
/sys entries
============
@@ -493,7 +499,8 @@ Files in /sys/fs/ext4/<devname>:
mb_stats
Controls whether the multiblock allocator should collect statistics,
which are shown during the unmount. 1 means to collect statistics, 0
- means not to collect statistics.
+ means not to collect statistics. This sysfs entry is deprecated, and
+ users should prefer /proc/fs/ext4/<devname>/mb_stats.
mb_stream_req
Files which have fewer blocks than this tunable parameter will have
diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst
index b0c0d1b45b99..dd487004b862 100644
--- a/Documentation/filesystems/proc.rst
+++ b/Documentation/filesystems/proc.rst
@@ -1623,18 +1623,7 @@ softirq.
1.8 Ext4 file system parameters
-------------------------------
-Information about mounted ext4 file systems can be found in
-/proc/fs/ext4. Each mounted filesystem will have a directory in
-/proc/fs/ext4 based on its device name (i.e., /proc/fs/ext4/hdc or
-/proc/fs/ext4/sda9 or /proc/fs/ext4/dm-0). The files in each per-device
-directory are shown in Table 1-12, below.
-
-.. table:: Table 1-12: Files in /proc/fs/ext4/<devname>
-
- ============== ==========================================================
- File Content
- mb_groups details of multiblock allocator buddy cache of free blocks
- ============== ==========================================================
+See Documentation/admin-guide/ext4.rst for ext4-specific /proc entries.
1.9 /proc/consoles
-------------------
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index df96bcd53a59..ab69ef8e5634 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1625,6 +1625,7 @@ struct ext4_sb_info {
unsigned int s_mb_stream_request;
unsigned int s_mb_max_to_scan;
unsigned int s_mb_min_to_scan;
+ struct mutex s_mb_stats_mutex;
unsigned int s_mb_stats;
unsigned int s_mb_order2_reqs;
unsigned int s_mb_group_prealloc;
@@ -2995,6 +2996,7 @@ int ext4_fc_record_regions(struct super_block *sb, int ino,
extern const struct seq_operations ext4_mb_seq_groups_ops;
extern const struct seq_operations ext4_mb_seq_structs_summary_ops;
extern int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset);
+extern void ext4_mb_stats_clear(struct ext4_sb_info *sbi);
extern int ext4_mb_init(struct super_block *);
extern void ext4_mb_release(struct super_block *);
extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index fed6d854877b..ee8f62861941 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3214,7 +3214,7 @@ int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset)
seq_puts(seq, "\tmb stats collection turned off.\n");
seq_puts(
seq,
- "\tTo enable, please write \"1\" to sysfs file mb_stats.\n");
+ "\tTo enable, please write \"1\" to proc file mb_stats.\n");
return 0;
}
seq_printf(seq, "\tblocks_allocated: %u\n",
@@ -3787,6 +3787,7 @@ int ext4_mb_init(struct super_block *sb)
sbi->s_mb_max_to_scan = MB_DEFAULT_MAX_TO_SCAN;
sbi->s_mb_min_to_scan = MB_DEFAULT_MIN_TO_SCAN;
+ mutex_init(&sbi->s_mb_stats_mutex);
WRITE_ONCE(sbi->s_mb_stats, MB_DEFAULT_STATS);
sbi->s_mb_stream_request = MB_DEFAULT_STREAM_THRESHOLD;
sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS;
@@ -4723,6 +4724,35 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)
trace_ext4_mballoc_prealloc(ac);
}
+void ext4_mb_stats_clear(struct ext4_sb_info *sbi)
+{
+ int i;
+
+ atomic_set(&sbi->s_bal_reqs, 0);
+ atomic_set(&sbi->s_bal_success, 0);
+ atomic_set(&sbi->s_bal_allocated, 0);
+ atomic_set(&sbi->s_bal_groups_scanned, 0);
+
+ for (i = 0; i < EXT4_MB_NUM_CRS; i++) {
+ atomic64_set(&sbi->s_bal_cX_hits[i], 0);
+ atomic64_set(&sbi->s_bal_cX_groups_considered[i], 0);
+ atomic_set(&sbi->s_bal_cX_ex_scanned[i], 0);
+ atomic64_set(&sbi->s_bal_cX_failed[i], 0);
+ }
+
+ atomic_set(&sbi->s_bal_ex_scanned, 0);
+ atomic_set(&sbi->s_bal_goals, 0);
+ atomic_set(&sbi->s_bal_stream_goals, 0);
+ atomic_set(&sbi->s_bal_len_goals, 0);
+ atomic_set(&sbi->s_bal_2orders, 0);
+ atomic_set(&sbi->s_bal_breaks, 0);
+ atomic_set(&sbi->s_mb_lost_chunks, 0);
+ atomic_set(&sbi->s_mb_buddies_generated, 0);
+ atomic64_set(&sbi->s_mb_generation_time, 0);
+ atomic_set(&sbi->s_mb_preallocated, 0);
+ atomic_set(&sbi->s_mb_discarded, 0);
+}
+
/*
* Called on failure; free up any blocks from the inode PA for this
* context. We don't need this for MB_GROUP_PA because we only change
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index 47e06c32c6fb..20935493dda8 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -53,6 +53,54 @@ typedef enum {
static const char proc_dirname[] = "fs/ext4";
static struct proc_dir_entry *ext4_proc_root;
+static int ext4_mb_stats_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, ext4_seq_mb_stats_show, pde_data(inode));
+}
+
+static ssize_t ext4_mb_stats_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ struct super_block *sb = pde_data(file_inode(file));
+ struct ext4_sb_info *sbi = EXT4_SB(sb);
+ int val;
+ int ret;
+
+ ret = kstrtoint_from_user(buf, count, 0, &val);
+ if (ret)
+ return ret;
+
+ ret = count;
+ mutex_lock(&sbi->s_mb_stats_mutex);
+ switch (val) {
+ case -1:
+ WRITE_ONCE(sbi->s_mb_stats, 0);
+ ext4_mb_stats_clear(sbi);
+ WRITE_ONCE(sbi->s_mb_stats, 1);
+ break;
+ case 1:
+ WRITE_ONCE(sbi->s_mb_stats, 1);
+ break;
+ case 0:
+ WRITE_ONCE(sbi->s_mb_stats, 0);
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ mutex_unlock(&sbi->s_mb_stats_mutex);
+
+ return ret;
+}
+
+static const struct proc_ops ext4_mb_stats_proc_ops = {
+ .proc_open = ext4_mb_stats_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+ .proc_write = ext4_mb_stats_write,
+};
+
struct ext4_attr {
struct attribute attr;
short attr_id;
@@ -466,7 +514,10 @@ static ssize_t mb_stats_store(struct ext4_sb_info *sbi,
ret = kstrtouint(skip_spaces(buf), 0, &t);
if (ret)
return ret;
+
+ mutex_lock(&sbi->s_mb_stats_mutex);
WRITE_ONCE(sbi->s_mb_stats, t);
+ mutex_unlock(&sbi->s_mb_stats_mutex);
return len;
}
@@ -666,8 +717,8 @@ int ext4_register_sysfs(struct super_block *sb)
ext4_fc_info_show, sb);
proc_create_seq_data("mb_groups", S_IRUGO, sbi->s_proc,
&ext4_mb_seq_groups_ops, sb);
- proc_create_single_data("mb_stats", 0444, sbi->s_proc,
- ext4_seq_mb_stats_show, sb);
+ proc_create_data("mb_stats", 0644, sbi->s_proc,
+ &ext4_mb_stats_proc_ops, sb);
proc_create_seq_data("mb_structs_summary", 0444, sbi->s_proc,
&ext4_mb_seq_structs_summary_ops, sb);
}
--
2.51.0
^ permalink raw reply related
* [PATCH v6 v6 1/3] ext4: add blocks_allocated to mb_stats output
From: Baolin Liu @ 2026-05-24 1:54 UTC (permalink / raw)
To: corbet, skhan, tytso, adilger.kernel, libaokun, jack, ojaswin,
ritesh.list, yi.zhang
Cc: linux-ext4, linux-kernel, Baolin Liu, Andreas Dilger
In-Reply-To: <20260524015421.2529617-1-liubaolin12138@163.com>
From: Baolin Liu <liubaolin@kylinos.cn>
Add blocks_allocated to /proc/fs/ext4/<dev>/mb_stats so that the
reported statistics match the mballoc summary printed at unmount time.
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
fs/ext4/mballoc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index bb58eafb87bc..d36b0f7b5d7d 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3217,6 +3217,8 @@ int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset)
"\tTo enable, please write \"1\" to sysfs file mb_stats.\n");
return 0;
}
+ seq_printf(seq, "\tblocks_allocated: %u\n",
+ atomic_read(&sbi->s_bal_allocated));
seq_printf(seq, "\treqs: %u\n", atomic_read(&sbi->s_bal_reqs));
seq_printf(seq, "\tsuccess: %u\n", atomic_read(&sbi->s_bal_success));
--
2.51.0
^ permalink raw reply related
* [PATCH v6 v6 0/3] ext4: improve mballoc statistics reporting and control
From: Baolin Liu @ 2026-05-24 1:54 UTC (permalink / raw)
To: corbet, skhan, tytso, adilger.kernel, libaokun, jack, ojaswin,
ritesh.list, yi.zhang
Cc: linux-ext4, linux-kernel, Baolin Liu
From: Baolin Liu <liubaolin@kylinos.cn>
This series improves mballoc statistics reporting and control by adding
blocks_allocated to /proc/fs/ext4/<dev>/mb_stats, using
READ_ONCE()/WRITE_ONCE() for concurrent accesses to s_mb_stats, and
allowing mballoc stats to be controlled through
/proc/fs/ext4/<dev>/mb_stats.
Changes in v6:
- Serialize proc and sysfs updates to s_mb_stats with a mutex so that
clearing mb_stats through the proc control path cannot race with
concurrent administrative writes.
Baolin Liu (3):
ext4: add blocks_allocated to mb_stats output
ext4: use READ_ONCE/WRITE_ONCE for s_mb_stats
ext4: allow controlling mballoc stats through proc mb_stats
Documentation/ABI/testing/sysfs-fs-ext4 | 3 +-
Documentation/admin-guide/ext4.rst | 9 ++-
Documentation/filesystems/proc.rst | 13 +---
fs/ext4/ext4.h | 2 +
fs/ext4/mballoc.c | 58 ++++++++++++++----
fs/ext4/sysfs.c | 80 ++++++++++++++++++++++++-
6 files changed, 135 insertions(+), 30 deletions(-)
--
2.51.0
^ permalink raw reply
* Re: [PATCH] ext2: Remove deprecated DAX support
From: kernel test robot @ 2026-05-24 4:06 UTC (permalink / raw)
To: Ashwin Gundarapu, jack; +Cc: oe-kbuild-all, linux-ext4, linux-kernel
In-Reply-To: <19e54c7cba1.5355cb8650862.622752146451851140@zohomail.in>
Hi Ashwin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jack-fs/for_next]
[also build test WARNING on linus/master v7.1-rc4 next-20260522]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ashwin-Gundarapu/ext2-Remove-deprecated-DAX-support/20260523-202224
base: https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next
patch link: https://lore.kernel.org/r/19e54c7cba1.5355cb8650862.622752146451851140%40zohomail.in
patch subject: [PATCH] ext2: Remove deprecated DAX support
config: i386-randconfig-141 (https://download.01.org/0day-ci/archive/20260524/202605241150.CHkeIFL0-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605241150.CHkeIFL0-lkp@intel.com/
smatch warnings:
fs/ext2/inode.c:1338 ext2_set_file_ops() warn: inconsistent indenting
vim +1338 fs/ext2/inode.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 1333
fb094c90748fbe Dan Williams 2017-12-21 1334 void ext2_set_file_ops(struct inode *inode)
fb094c90748fbe Dan Williams 2017-12-21 1335 {
fb094c90748fbe Dan Williams 2017-12-21 1336 inode->i_op = &ext2_file_inode_operations;
fb094c90748fbe Dan Williams 2017-12-21 1337 inode->i_fop = &ext2_file_operations;
fb094c90748fbe Dan Williams 2017-12-21 @1338 inode->i_mapping->a_ops = &ext2_aops;
fb094c90748fbe Dan Williams 2017-12-21 1339 }
fb094c90748fbe Dan Williams 2017-12-21 1340
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* [PATCH v2] ext2: Remove deprecated DAX support
From: Ashwin Gundarapu @ 2026-05-24 5:38 UTC (permalink / raw)
To: jack; +Cc: linux-ext4, linux-kernel
DAX support in ext2 was deprecated in commit d5a2693f93e4
("ext2: Deprecate DAX") with a removal deadline of end of 2025.
Remove all DAX code from ext2 as scheduled.
This removes the DAX mount option, IOMAP DAX support, DAX file
operations, DAX address_space_operations, and the DAX fault handler.
Signed-off-by: Ashwin Gundarapu <linuxuser509@zohomail.in>
---
v2: Removed unused sbi variable and fixed indentation as reported
by kernel test robot.
---
fs/ext2/ext2.h | 5 +-
fs/ext2/file.c | 118 ++----------------------------------------------
fs/ext2/inode.c | 61 ++-----------------------
fs/ext2/super.c | 45 +++---------------
4 files changed, 16 insertions(+), 213 deletions(-)
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 3eb1f342645c..3a26308ec841 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -114,8 +114,6 @@ struct ext2_sb_info {
*/
spinlock_t s_lock;
struct mb_cache *s_ea_block_cache;
- struct dax_device *s_daxdev;
- u64 s_dax_part_off;
};
static inline spinlock_t *
@@ -373,11 +371,10 @@ struct ext2_inode {
#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */
#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
-#define EXT2_MOUNT_XIP 0x010000 /* Obsolete, use DAX */
+#define EXT2_MOUNT_XIP 0x010000 /* Obsolete*/
#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
#define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
-#define EXT2_MOUNT_DAX 0x100000 /* Direct Access */
#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index d9b1eb34694a..0fd9208af062 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -21,7 +21,6 @@
#include <linux/time.h>
#include <linux/pagemap.h>
-#include <linux/dax.h>
#include <linux/filelock.h>
#include <linux/quotaops.h>
#include <linux/iomap.h>
@@ -32,111 +31,6 @@
#include "acl.h"
#include "trace.h"
-#ifdef CONFIG_FS_DAX
-static ssize_t ext2_dax_read_iter(struct kiocb *iocb, struct iov_iter *to)
-{
- struct inode *inode = iocb->ki_filp->f_mapping->host;
- ssize_t ret;
-
- if (!iov_iter_count(to))
- return 0; /* skip atime */
-
- inode_lock_shared(inode);
- ret = dax_iomap_rw(iocb, to, &ext2_iomap_ops);
- inode_unlock_shared(inode);
-
- file_accessed(iocb->ki_filp);
- return ret;
-}
-
-static ssize_t ext2_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
-{
- struct file *file = iocb->ki_filp;
- struct inode *inode = file->f_mapping->host;
- ssize_t ret;
-
- inode_lock(inode);
- ret = generic_write_checks(iocb, from);
- if (ret <= 0)
- goto out_unlock;
- ret = file_remove_privs(file);
- if (ret)
- goto out_unlock;
- ret = file_update_time(file);
- if (ret)
- goto out_unlock;
-
- ret = dax_iomap_rw(iocb, from, &ext2_iomap_ops);
- if (ret > 0 && iocb->ki_pos > i_size_read(inode)) {
- i_size_write(inode, iocb->ki_pos);
- mark_inode_dirty(inode);
- }
-
-out_unlock:
- inode_unlock(inode);
- if (ret > 0)
- ret = generic_write_sync(iocb, ret);
- return ret;
-}
-
-/*
- * The lock ordering for ext2 DAX fault paths is:
- *
- * mmap_lock (MM)
- * sb_start_pagefault (vfs, freeze)
- * address_space->invalidate_lock
- * address_space->i_mmap_rwsem or page_lock (mutually exclusive in DAX)
- * ext2_inode_info->truncate_mutex
- *
- * The default page_lock and i_size verification done by non-DAX fault paths
- * is sufficient because ext2 doesn't support hole punching.
- */
-static vm_fault_t ext2_dax_fault(struct vm_fault *vmf)
-{
- struct inode *inode = file_inode(vmf->vma->vm_file);
- vm_fault_t ret;
- bool write = (vmf->flags & FAULT_FLAG_WRITE) &&
- (vmf->vma->vm_flags & VM_SHARED);
-
- if (write) {
- sb_start_pagefault(inode->i_sb);
- file_update_time(vmf->vma->vm_file);
- }
- filemap_invalidate_lock_shared(inode->i_mapping);
-
- ret = dax_iomap_fault(vmf, 0, NULL, NULL, &ext2_iomap_ops);
-
- filemap_invalidate_unlock_shared(inode->i_mapping);
- if (write)
- sb_end_pagefault(inode->i_sb);
- return ret;
-}
-
-static const struct vm_operations_struct ext2_dax_vm_ops = {
- .fault = ext2_dax_fault,
- /*
- * .huge_fault is not supported for DAX because allocation in ext2
- * cannot be reliably aligned to huge page sizes and so pmd faults
- * will always fail and fail back to regular faults.
- */
- .page_mkwrite = ext2_dax_fault,
- .pfn_mkwrite = ext2_dax_fault,
-};
-
-static int ext2_file_mmap_prepare(struct vm_area_desc *desc)
-{
- struct file *file = desc->file;
-
- if (!IS_DAX(file_inode(file)))
- return generic_file_mmap_prepare(desc);
-
- file_accessed(file);
- desc->vm_ops = &ext2_dax_vm_ops;
- return 0;
-}
-#else
-#define ext2_file_mmap_prepare generic_file_mmap_prepare
-#endif
/*
* Called when filp is released. This happens when all file descriptors
@@ -285,10 +179,7 @@ static ssize_t ext2_dio_write_iter(struct kiocb *iocb, struct iov_iter *from)
static ssize_t ext2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
-#ifdef CONFIG_FS_DAX
- if (IS_DAX(iocb->ki_filp->f_mapping->host))
- return ext2_dax_read_iter(iocb, to);
-#endif
+
if (iocb->ki_flags & IOCB_DIRECT)
return ext2_dio_read_iter(iocb, to);
@@ -297,10 +188,7 @@ static ssize_t ext2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
static ssize_t ext2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
-#ifdef CONFIG_FS_DAX
- if (IS_DAX(iocb->ki_filp->f_mapping->host))
- return ext2_dax_write_iter(iocb, from);
-#endif
+
if (iocb->ki_flags & IOCB_DIRECT)
return ext2_dio_write_iter(iocb, from);
@@ -321,7 +209,7 @@ const struct file_operations ext2_file_operations = {
#ifdef CONFIG_COMPAT
.compat_ioctl = ext2_compat_ioctl,
#endif
- .mmap_prepare = ext2_file_mmap_prepare,
+ .mmap_prepare = generic_file_mmap_prepare,
.open = ext2_file_open,
.release = ext2_release_file,
.fsync = ext2_fsync,
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 74aca5eb572d..193acff37270 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -26,7 +26,6 @@
#include <linux/time.h>
#include <linux/highuid.h>
#include <linux/pagemap.h>
-#include <linux/dax.h>
#include <linux/blkdev.h>
#include <linux/quotaops.h>
#include <linux/writeback.h>
@@ -741,27 +740,6 @@ static int ext2_get_blocks(struct inode *inode,
goto cleanup;
}
- if (IS_DAX(inode)) {
- /*
- * We must unmap blocks before zeroing so that writeback cannot
- * overwrite zeros with stale data from block device page cache.
- */
- clean_bdev_aliases(inode->i_sb->s_bdev,
- le32_to_cpu(chain[depth-1].key),
- count);
- /*
- * block must be initialised before we put it in the tree
- * so that it's not found by another thread before it's
- * initialised
- */
- err = sb_issue_zeroout(inode->i_sb,
- le32_to_cpu(chain[depth-1].key), count,
- GFP_KERNEL);
- if (err) {
- mutex_unlock(&ei->truncate_mutex);
- goto cleanup;
- }
- }
*new = true;
ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
@@ -811,7 +789,6 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
unsigned int blkbits = inode->i_blkbits;
unsigned long first_block = offset >> blkbits;
unsigned long max_blocks = (length + (1 << blkbits) - 1) >> blkbits;
- struct ext2_sb_info *sbi = EXT2_SB(inode->i_sb);
bool new = false, boundary = false;
u32 bno;
int ret;
@@ -841,10 +818,7 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
iomap->flags = 0;
iomap->offset = (u64)first_block << blkbits;
- if (flags & IOMAP_DAX)
- iomap->dax_dev = sbi->s_daxdev;
- else
- iomap->bdev = inode->i_sb->s_bdev;
+ iomap->bdev = inode->i_sb->s_bdev;
if (ret == 0) {
/*
@@ -859,8 +833,6 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
} else {
iomap->type = IOMAP_MAPPED;
iomap->addr = (u64)bno << blkbits;
- if (flags & IOMAP_DAX)
- iomap->addr += sbi->s_dax_part_off;
iomap->length = (u64)ret << blkbits;
iomap->flags |= IOMAP_F_MERGED;
}
@@ -962,13 +934,6 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
return mpage_writepages(mapping, wbc, ext2_get_block);
}
-static int
-ext2_dax_writepages(struct address_space *mapping, struct writeback_control *wbc)
-{
- struct ext2_sb_info *sbi = EXT2_SB(mapping->host->i_sb);
-
- return dax_writeback_mapping_range(mapping, sbi->s_daxdev, wbc);
-}
const struct address_space_operations ext2_aops = {
.dirty_folio = block_dirty_folio,
@@ -984,10 +949,6 @@ const struct address_space_operations ext2_aops = {
.error_remove_folio = generic_error_remove_folio,
};
-static const struct address_space_operations ext2_dax_aops = {
- .writepages = ext2_dax_writepages,
- .dirty_folio = noop_dirty_folio,
-};
/*
* Probably it should be a library function... search for first non-zero word
@@ -1186,9 +1147,6 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
blocksize = inode->i_sb->s_blocksize;
iblock = (offset + blocksize-1) >> EXT2_BLOCK_SIZE_BITS(inode->i_sb);
-#ifdef CONFIG_FS_DAX
- WARN_ON(!rwsem_is_locked(&inode->i_mapping->invalidate_lock));
-#endif
n = ext2_block_to_path(inode, iblock, offsets, NULL);
if (n == 0)
@@ -1290,12 +1248,8 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
inode_dio_wait(inode);
- if (IS_DAX(inode))
- error = dax_truncate_page(inode, newsize, NULL,
- &ext2_iomap_ops);
- else
- error = block_truncate_page(inode->i_mapping,
- newsize, ext2_get_block);
+ error = block_truncate_page(inode->i_mapping,
+ newsize, ext2_get_block);
if (error)
return error;
@@ -1363,7 +1317,7 @@ void ext2_set_inode_flags(struct inode *inode)
unsigned int flags = EXT2_I(inode)->i_flags;
inode->i_flags &= ~(S_SYNC | S_APPEND | S_IMMUTABLE | S_NOATIME |
- S_DIRSYNC | S_DAX);
+ S_DIRSYNC);
if (flags & EXT2_SYNC_FL)
inode->i_flags |= S_SYNC;
if (flags & EXT2_APPEND_FL)
@@ -1374,18 +1328,13 @@ void ext2_set_inode_flags(struct inode *inode)
inode->i_flags |= S_NOATIME;
if (flags & EXT2_DIRSYNC_FL)
inode->i_flags |= S_DIRSYNC;
- if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode))
- inode->i_flags |= S_DAX;
}
void ext2_set_file_ops(struct inode *inode)
{
inode->i_op = &ext2_file_inode_operations;
inode->i_fop = &ext2_file_operations;
- if (IS_DAX(inode))
- inode->i_mapping->a_ops = &ext2_dax_aops;
- else
- inode->i_mapping->a_ops = &ext2_aops;
+ inode->i_mapping->a_ops = &ext2_aops;
}
struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 19f76d8cb473..ede4ad84828c 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -34,7 +34,6 @@
#include <linux/log2.h>
#include <linux/quotaops.h>
#include <linux/uaccess.h>
-#include <linux/dax.h>
#include <linux/iversion.h>
#include "ext2.h"
#include "xattr.h"
@@ -198,7 +197,6 @@ static void ext2_put_super (struct super_block * sb)
brelse (sbi->s_sbh);
sb->s_fs_info = NULL;
kfree(sbi->s_blockgroup_lock);
- fs_put_dax(sbi->s_daxdev, NULL);
kfree(sbi);
}
@@ -332,8 +330,6 @@ static int ext2_show_options(struct seq_file *seq, struct dentry *root)
if (test_opt(sb, XIP))
seq_puts(seq, ",xip");
- if (test_opt(sb, DAX))
- seq_puts(seq, ",dax");
if (!test_opt(sb, RESERVATION))
seq_puts(seq, ",noreservation");
@@ -432,7 +428,7 @@ static const struct export_operations ext2_export_ops = {
enum {
Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, Opt_resgid, Opt_resuid,
Opt_sb, Opt_errors, Opt_nouid32, Opt_debug, Opt_oldalloc, Opt_orlov,
- Opt_nobh, Opt_user_xattr, Opt_acl, Opt_xip, Opt_dax, Opt_ignore,
+ Opt_nobh, Opt_user_xattr, Opt_acl, Opt_xip, Opt_ignore,
Opt_quota, Opt_usrquota, Opt_grpquota, Opt_reservation,
};
@@ -462,7 +458,6 @@ static const struct fs_parameter_spec ext2_param_spec[] = {
fsparam_flag_no ("user_xattr", Opt_user_xattr),
fsparam_flag_no ("acl", Opt_acl),
fsparam_flag ("xip", Opt_xip),
- fsparam_flag ("dax", Opt_dax),
fsparam_flag ("grpquota", Opt_grpquota),
fsparam_flag ("noquota", Opt_ignore),
fsparam_flag ("quota", Opt_quota),
@@ -595,20 +590,9 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
ext2_msg_fc(fc, KERN_INFO, "(no)acl options not supported");
break;
#endif
- case Opt_xip:
- ext2_msg_fc(fc, KERN_INFO, "use dax instead of xip");
- ctx_set_mount_opt(ctx, EXT2_MOUNT_XIP);
- fallthrough;
- case Opt_dax:
-#ifdef CONFIG_FS_DAX
- ext2_msg_fc(fc, KERN_WARNING,
- "DAX enabled. Warning: DAX support in ext2 driver is deprecated"
- " and will be removed at the end of 2025. Please use ext4 driver instead.");
- ctx_set_mount_opt(ctx, EXT2_MOUNT_DAX);
-#else
- ext2_msg_fc(fc, KERN_INFO, "dax option not supported");
-#endif
- break;
+ case Opt_xip:
+ ext2_msg_fc(fc, KERN_ERR, "DAX support has been removed. Please use ext4 instead.");
+ return -EINVAL;
#if defined(CONFIG_QUOTA)
case Opt_quota:
@@ -906,8 +890,6 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
}
sb->s_fs_info = sbi;
sbi->s_sb_block = sb_block;
- sbi->s_daxdev = fs_dax_get_by_bdev(sb->s_bdev, &sbi->s_dax_part_off,
- NULL, NULL);
spin_lock_init(&sbi->s_lock);
ret = -EINVAL;
@@ -992,16 +974,8 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
}
blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
- if (test_opt(sb, DAX)) {
- if (!sbi->s_daxdev) {
- ext2_msg(sb, KERN_ERR,
- "DAX unsupported by block device. Turning off DAX.");
- clear_opt(sbi->s_mount_opt, DAX);
- } else if (blocksize != PAGE_SIZE) {
- ext2_msg(sb, KERN_ERR, "unsupported blocksize for DAX\n");
- clear_opt(sbi->s_mount_opt, DAX);
- }
- }
+
+
/* If the blocksize doesn't match, re-read the thing.. */
if (sb->s_blocksize != blocksize) {
@@ -1252,7 +1226,6 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
failed_mount:
brelse(bh);
failed_sbi:
- fs_put_dax(sbi->s_daxdev, NULL);
sb->s_fs_info = NULL;
kfree(sbi->s_blockgroup_lock);
kfree(sbi);
@@ -1379,11 +1352,7 @@ static int ext2_reconfigure(struct fs_context *fc)
spin_lock(&sbi->s_lock);
es = sbi->s_es;
- if ((sbi->s_mount_opt ^ new_opts.s_mount_opt) & EXT2_MOUNT_DAX) {
- ext2_msg(sb, KERN_WARNING, "warning: refusing change of "
- "dax flag with busy inodes while remounting");
- new_opts.s_mount_opt ^= EXT2_MOUNT_DAX;
- }
+
if ((bool)(flags & SB_RDONLY) == sb_rdonly(sb))
goto out_set;
if (flags & SB_RDONLY) {
--
2.43.0
^ permalink raw reply related
* [PATCH v3] ext2: Remove deprecated DAX support
From: Ashwin Gundarapu @ 2026-05-24 9:39 UTC (permalink / raw)
To: jack; +Cc: linux-ext4, linux-kernel
DAX support in ext2 was deprecated in commit d5a2693f93e4
("ext2: Deprecate DAX") with a removal deadline of end of 2025.
Remove all DAX code from ext2 as scheduled.
This removes the DAX mount option, IOMAP DAX support, DAX file
operations, DAX address_space_operations, and the DAX fault handler.
Signed-off-by: Ashwin Gundarapu <linuxuser509@zohomail.in>
---
v3: Restored Opt_dax for graceful mount error message. Fixed remaining
space-to-tab indentation. Kept EXT2_MOUNT_XIP for compilation.
v2: Removed unused sbi variable and fixed indentation as reported
by kernel test robot.
---
fs/ext2/ext2.h | 5 +-
fs/ext2/file.c | 118 ++----------------------------------------------
fs/ext2/inode.c | 61 ++-----------------------
fs/ext2/super.c | 45 ++++--------------
4 files changed, 18 insertions(+), 211 deletions(-)
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 3eb1f342645c..3a26308ec841 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -114,8 +114,6 @@ struct ext2_sb_info {
*/
spinlock_t s_lock;
struct mb_cache *s_ea_block_cache;
- struct dax_device *s_daxdev;
- u64 s_dax_part_off;
};
static inline spinlock_t *
@@ -373,11 +371,10 @@ struct ext2_inode {
#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */
#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
-#define EXT2_MOUNT_XIP 0x010000 /* Obsolete, use DAX */
+#define EXT2_MOUNT_XIP 0x010000 /* Obsolete*/
#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
#define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
-#define EXT2_MOUNT_DAX 0x100000 /* Direct Access */
#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index d9b1eb34694a..0fd9208af062 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -21,7 +21,6 @@
#include <linux/time.h>
#include <linux/pagemap.h>
-#include <linux/dax.h>
#include <linux/filelock.h>
#include <linux/quotaops.h>
#include <linux/iomap.h>
@@ -32,111 +31,6 @@
#include "acl.h"
#include "trace.h"
-#ifdef CONFIG_FS_DAX
-static ssize_t ext2_dax_read_iter(struct kiocb *iocb, struct iov_iter *to)
-{
- struct inode *inode = iocb->ki_filp->f_mapping->host;
- ssize_t ret;
-
- if (!iov_iter_count(to))
- return 0; /* skip atime */
-
- inode_lock_shared(inode);
- ret = dax_iomap_rw(iocb, to, &ext2_iomap_ops);
- inode_unlock_shared(inode);
-
- file_accessed(iocb->ki_filp);
- return ret;
-}
-
-static ssize_t ext2_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
-{
- struct file *file = iocb->ki_filp;
- struct inode *inode = file->f_mapping->host;
- ssize_t ret;
-
- inode_lock(inode);
- ret = generic_write_checks(iocb, from);
- if (ret <= 0)
- goto out_unlock;
- ret = file_remove_privs(file);
- if (ret)
- goto out_unlock;
- ret = file_update_time(file);
- if (ret)
- goto out_unlock;
-
- ret = dax_iomap_rw(iocb, from, &ext2_iomap_ops);
- if (ret > 0 && iocb->ki_pos > i_size_read(inode)) {
- i_size_write(inode, iocb->ki_pos);
- mark_inode_dirty(inode);
- }
-
-out_unlock:
- inode_unlock(inode);
- if (ret > 0)
- ret = generic_write_sync(iocb, ret);
- return ret;
-}
-
-/*
- * The lock ordering for ext2 DAX fault paths is:
- *
- * mmap_lock (MM)
- * sb_start_pagefault (vfs, freeze)
- * address_space->invalidate_lock
- * address_space->i_mmap_rwsem or page_lock (mutually exclusive in DAX)
- * ext2_inode_info->truncate_mutex
- *
- * The default page_lock and i_size verification done by non-DAX fault paths
- * is sufficient because ext2 doesn't support hole punching.
- */
-static vm_fault_t ext2_dax_fault(struct vm_fault *vmf)
-{
- struct inode *inode = file_inode(vmf->vma->vm_file);
- vm_fault_t ret;
- bool write = (vmf->flags & FAULT_FLAG_WRITE) &&
- (vmf->vma->vm_flags & VM_SHARED);
-
- if (write) {
- sb_start_pagefault(inode->i_sb);
- file_update_time(vmf->vma->vm_file);
- }
- filemap_invalidate_lock_shared(inode->i_mapping);
-
- ret = dax_iomap_fault(vmf, 0, NULL, NULL, &ext2_iomap_ops);
-
- filemap_invalidate_unlock_shared(inode->i_mapping);
- if (write)
- sb_end_pagefault(inode->i_sb);
- return ret;
-}
-
-static const struct vm_operations_struct ext2_dax_vm_ops = {
- .fault = ext2_dax_fault,
- /*
- * .huge_fault is not supported for DAX because allocation in ext2
- * cannot be reliably aligned to huge page sizes and so pmd faults
- * will always fail and fail back to regular faults.
- */
- .page_mkwrite = ext2_dax_fault,
- .pfn_mkwrite = ext2_dax_fault,
-};
-
-static int ext2_file_mmap_prepare(struct vm_area_desc *desc)
-{
- struct file *file = desc->file;
-
- if (!IS_DAX(file_inode(file)))
- return generic_file_mmap_prepare(desc);
-
- file_accessed(file);
- desc->vm_ops = &ext2_dax_vm_ops;
- return 0;
-}
-#else
-#define ext2_file_mmap_prepare generic_file_mmap_prepare
-#endif
/*
* Called when filp is released. This happens when all file descriptors
@@ -285,10 +179,7 @@ static ssize_t ext2_dio_write_iter(struct kiocb *iocb, struct iov_iter *from)
static ssize_t ext2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
-#ifdef CONFIG_FS_DAX
- if (IS_DAX(iocb->ki_filp->f_mapping->host))
- return ext2_dax_read_iter(iocb, to);
-#endif
+
if (iocb->ki_flags & IOCB_DIRECT)
return ext2_dio_read_iter(iocb, to);
@@ -297,10 +188,7 @@ static ssize_t ext2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
static ssize_t ext2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
-#ifdef CONFIG_FS_DAX
- if (IS_DAX(iocb->ki_filp->f_mapping->host))
- return ext2_dax_write_iter(iocb, from);
-#endif
+
if (iocb->ki_flags & IOCB_DIRECT)
return ext2_dio_write_iter(iocb, from);
@@ -321,7 +209,7 @@ const struct file_operations ext2_file_operations = {
#ifdef CONFIG_COMPAT
.compat_ioctl = ext2_compat_ioctl,
#endif
- .mmap_prepare = ext2_file_mmap_prepare,
+ .mmap_prepare = generic_file_mmap_prepare,
.open = ext2_file_open,
.release = ext2_release_file,
.fsync = ext2_fsync,
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 74aca5eb572d..e2aa6152fa1f 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -26,7 +26,6 @@
#include <linux/time.h>
#include <linux/highuid.h>
#include <linux/pagemap.h>
-#include <linux/dax.h>
#include <linux/blkdev.h>
#include <linux/quotaops.h>
#include <linux/writeback.h>
@@ -741,27 +740,6 @@ static int ext2_get_blocks(struct inode *inode,
goto cleanup;
}
- if (IS_DAX(inode)) {
- /*
- * We must unmap blocks before zeroing so that writeback cannot
- * overwrite zeros with stale data from block device page cache.
- */
- clean_bdev_aliases(inode->i_sb->s_bdev,
- le32_to_cpu(chain[depth-1].key),
- count);
- /*
- * block must be initialised before we put it in the tree
- * so that it's not found by another thread before it's
- * initialised
- */
- err = sb_issue_zeroout(inode->i_sb,
- le32_to_cpu(chain[depth-1].key), count,
- GFP_KERNEL);
- if (err) {
- mutex_unlock(&ei->truncate_mutex);
- goto cleanup;
- }
- }
*new = true;
ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
@@ -811,7 +789,6 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
unsigned int blkbits = inode->i_blkbits;
unsigned long first_block = offset >> blkbits;
unsigned long max_blocks = (length + (1 << blkbits) - 1) >> blkbits;
- struct ext2_sb_info *sbi = EXT2_SB(inode->i_sb);
bool new = false, boundary = false;
u32 bno;
int ret;
@@ -841,10 +818,7 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
iomap->flags = 0;
iomap->offset = (u64)first_block << blkbits;
- if (flags & IOMAP_DAX)
- iomap->dax_dev = sbi->s_daxdev;
- else
- iomap->bdev = inode->i_sb->s_bdev;
+ iomap->bdev = inode->i_sb->s_bdev;
if (ret == 0) {
/*
@@ -859,8 +833,6 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
} else {
iomap->type = IOMAP_MAPPED;
iomap->addr = (u64)bno << blkbits;
- if (flags & IOMAP_DAX)
- iomap->addr += sbi->s_dax_part_off;
iomap->length = (u64)ret << blkbits;
iomap->flags |= IOMAP_F_MERGED;
}
@@ -962,13 +934,6 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
return mpage_writepages(mapping, wbc, ext2_get_block);
}
-static int
-ext2_dax_writepages(struct address_space *mapping, struct writeback_control *wbc)
-{
- struct ext2_sb_info *sbi = EXT2_SB(mapping->host->i_sb);
-
- return dax_writeback_mapping_range(mapping, sbi->s_daxdev, wbc);
-}
const struct address_space_operations ext2_aops = {
.dirty_folio = block_dirty_folio,
@@ -984,10 +949,6 @@ const struct address_space_operations ext2_aops = {
.error_remove_folio = generic_error_remove_folio,
};
-static const struct address_space_operations ext2_dax_aops = {
- .writepages = ext2_dax_writepages,
- .dirty_folio = noop_dirty_folio,
-};
/*
* Probably it should be a library function... search for first non-zero word
@@ -1186,9 +1147,6 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
blocksize = inode->i_sb->s_blocksize;
iblock = (offset + blocksize-1) >> EXT2_BLOCK_SIZE_BITS(inode->i_sb);
-#ifdef CONFIG_FS_DAX
- WARN_ON(!rwsem_is_locked(&inode->i_mapping->invalidate_lock));
-#endif
n = ext2_block_to_path(inode, iblock, offsets, NULL);
if (n == 0)
@@ -1290,12 +1248,8 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
inode_dio_wait(inode);
- if (IS_DAX(inode))
- error = dax_truncate_page(inode, newsize, NULL,
- &ext2_iomap_ops);
- else
- error = block_truncate_page(inode->i_mapping,
- newsize, ext2_get_block);
+ error = block_truncate_page(inode->i_mapping,
+ newsize, ext2_get_block);
if (error)
return error;
@@ -1363,7 +1317,7 @@ void ext2_set_inode_flags(struct inode *inode)
unsigned int flags = EXT2_I(inode)->i_flags;
inode->i_flags &= ~(S_SYNC | S_APPEND | S_IMMUTABLE | S_NOATIME |
- S_DIRSYNC | S_DAX);
+ S_DIRSYNC);
if (flags & EXT2_SYNC_FL)
inode->i_flags |= S_SYNC;
if (flags & EXT2_APPEND_FL)
@@ -1374,18 +1328,13 @@ void ext2_set_inode_flags(struct inode *inode)
inode->i_flags |= S_NOATIME;
if (flags & EXT2_DIRSYNC_FL)
inode->i_flags |= S_DIRSYNC;
- if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode))
- inode->i_flags |= S_DAX;
}
void ext2_set_file_ops(struct inode *inode)
{
inode->i_op = &ext2_file_inode_operations;
inode->i_fop = &ext2_file_operations;
- if (IS_DAX(inode))
- inode->i_mapping->a_ops = &ext2_dax_aops;
- else
- inode->i_mapping->a_ops = &ext2_aops;
+ inode->i_mapping->a_ops = &ext2_aops;
}
struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 19f76d8cb473..6f24d1448a40 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -34,7 +34,6 @@
#include <linux/log2.h>
#include <linux/quotaops.h>
#include <linux/uaccess.h>
-#include <linux/dax.h>
#include <linux/iversion.h>
#include "ext2.h"
#include "xattr.h"
@@ -198,7 +197,6 @@ static void ext2_put_super (struct super_block * sb)
brelse (sbi->s_sbh);
sb->s_fs_info = NULL;
kfree(sbi->s_blockgroup_lock);
- fs_put_dax(sbi->s_daxdev, NULL);
kfree(sbi);
}
@@ -332,8 +330,6 @@ static int ext2_show_options(struct seq_file *seq, struct dentry *root)
if (test_opt(sb, XIP))
seq_puts(seq, ",xip");
- if (test_opt(sb, DAX))
- seq_puts(seq, ",dax");
if (!test_opt(sb, RESERVATION))
seq_puts(seq, ",noreservation");
@@ -595,20 +591,12 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
ext2_msg_fc(fc, KERN_INFO, "(no)acl options not supported");
break;
#endif
- case Opt_xip:
- ext2_msg_fc(fc, KERN_INFO, "use dax instead of xip");
- ctx_set_mount_opt(ctx, EXT2_MOUNT_XIP);
- fallthrough;
- case Opt_dax:
-#ifdef CONFIG_FS_DAX
- ext2_msg_fc(fc, KERN_WARNING,
- "DAX enabled. Warning: DAX support in ext2 driver is deprecated"
- " and will be removed at the end of 2025. Please use ext4 driver instead.");
- ctx_set_mount_opt(ctx, EXT2_MOUNT_DAX);
-#else
- ext2_msg_fc(fc, KERN_INFO, "dax option not supported");
-#endif
- break;
+ case Opt_xip:
+ ext2_msg_fc(fc, KERN_ERR, "DAX support has been removed. Please use ext4 instead.");
+ return -EINVAL;
+ case Opt_dax:
+ ext2_msg_fc(fc, KERN_ERR, "DAX support has been removed. Please use ext4 instead.");
+ return -EINVAL;
#if defined(CONFIG_QUOTA)
case Opt_quota:
@@ -906,8 +894,6 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
}
sb->s_fs_info = sbi;
sbi->s_sb_block = sb_block;
- sbi->s_daxdev = fs_dax_get_by_bdev(sb->s_bdev, &sbi->s_dax_part_off,
- NULL, NULL);
spin_lock_init(&sbi->s_lock);
ret = -EINVAL;
@@ -992,16 +978,8 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
}
blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
- if (test_opt(sb, DAX)) {
- if (!sbi->s_daxdev) {
- ext2_msg(sb, KERN_ERR,
- "DAX unsupported by block device. Turning off DAX.");
- clear_opt(sbi->s_mount_opt, DAX);
- } else if (blocksize != PAGE_SIZE) {
- ext2_msg(sb, KERN_ERR, "unsupported blocksize for DAX\n");
- clear_opt(sbi->s_mount_opt, DAX);
- }
- }
+
+
/* If the blocksize doesn't match, re-read the thing.. */
if (sb->s_blocksize != blocksize) {
@@ -1252,7 +1230,6 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
failed_mount:
brelse(bh);
failed_sbi:
- fs_put_dax(sbi->s_daxdev, NULL);
sb->s_fs_info = NULL;
kfree(sbi->s_blockgroup_lock);
kfree(sbi);
@@ -1379,11 +1356,7 @@ static int ext2_reconfigure(struct fs_context *fc)
spin_lock(&sbi->s_lock);
es = sbi->s_es;
- if ((sbi->s_mount_opt ^ new_opts.s_mount_opt) & EXT2_MOUNT_DAX) {
- ext2_msg(sb, KERN_WARNING, "warning: refusing change of "
- "dax flag with busy inodes while remounting");
- new_opts.s_mount_opt ^= EXT2_MOUNT_DAX;
- }
+
if ((bool)(flags & SB_RDONLY) == sb_rdonly(sb))
goto out_set;
if (flags & SB_RDONLY) {
--
2.43.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox