fs/ext2/ext2.h | 5 +- fs/ext2/file.c | 118 ++---------------------------------------------- fs/ext2/inode.c | 60 ++---------------------- fs/ext2/super.c | 45 +++--------------- 4 files changed, 16 insertions(+), 212 deletions(-)
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>
---
fs/ext2/ext2.h | 5 +-
fs/ext2/file.c | 118 ++----------------------------------------------
fs/ext2/inode.c | 60 ++----------------------
fs/ext2/super.c | 45 +++---------------
4 files changed, 16 insertions(+), 212 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..91fc4709836f 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);
@@ -841,10 +819,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 +834,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 +935,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 +950,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 +1148,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 +1249,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 +1318,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 +1329,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
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
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
© 2016 - 2026 Red Hat, Inc.