dax: try to avoid unused function warnings
Subsystems (5)
PATCH 1/1 dax: try to avoid unused function warnings
Without the get_block based I/O, we get warnings when CONFIG_FS_IOMAP is disabled:
fs/dax.c:736:12: error: ‘dax_insert_mapping’ defined but not used [-Werror=unused-function] fs/dax.c:512:12: error: ‘copy_user_dax’ defined but not used [-Werror=unused-function] fs/dax.c:490:12: error: ‘dax_load_hole’ defined but not used [-Werror=unused-function] fs/dax.c:294:14: error: ‘grab_mapping_entry’ defined but not used [-Werror=unused-function]
This patch blindly marks those as __maybe_unused, which avoids the warnings. However, I suspect that there is actually more code in this file that should not be provided without CONFIG_FS_IOMAP even though we don't get a warning for it, and that we actually want a different rework, so please treat this as a bug report. I have applied the patch locally in my randconfig build setup to avoid seeing the warnings.
--- fs/dax.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/dax.c +4 -4
@@ -309,7 +309,7 @@ static void put_unlocked_mapping_entry(struct address_space *mapping,* persistent memory the benefit is doubtful. We can add that later if we can * show it helps. */ -static void *grab_mapping_entry (struct address_space *mapping,pgoff_t index, +static __maybe_unused void *grab_mapping_entry (struct address_space *mapping,pgoff_t index,unsigned long size_flag) {bool pmd_downgrade = false;/* splitting 2MiB entry into 4k entries? */
@@ -489,7 +489,7 @@ int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index)* otherwise it will simply fall out of the page cache under memory * pressure without ever having been dirtied. */ -static int dax_load_hole (struct address_space *mapping,void *entry, +static int __maybe_unused dax_load_hole (struct address_space *mapping,void *entry,struct vm_fault *vmf) {struct page *page;
@@ -509,7 +509,7 @@ static int dax_load_hole(struct address_space *mapping, void *entry,return VM_FAULT_LOCKED ; } -static int copy_user_dax (struct block_device *bdev,sector_t sector,size_t size, +static int __maybe_unused copy_user_dax (struct block_device *bdev,sector_t sector,size_t size,struct page *to,unsigned long vaddr) {struct blk_dax_ctl dax = {
@@ -815,7 +815,7 @@ int dax_writeback_mapping_range(struct address_space *mapping, }EXPORT_SYMBOL_GPL (dax_writeback_mapping_range); -static int dax_insert_mapping (struct address_space *mapping, +static int __maybe_unused dax_insert_mapping (struct address_space *mapping,struct block_device *bdev,sector_t sector,size_t size,void **entryp,struct vm_area_struct *vma,struct vm_fault *vmf) {
Signature · 1 line
2.9.0
Quoted 15 lines · Arnd Bergmann
Without the
get_blockbased I/O, we get warnings whenCONFIG_FS_IOMAPis disabled:
fs/dax.c:736:12: error: ‘dax_insert_mapping’ defined but not used [-Werror=unused-function]fs/dax.c:512:12: error: ‘copy_user_dax’ defined but not used [-Werror=unused-function]fs/dax.c:490:12: error: ‘dax_load_hole’ defined but not used [-Werror=unused-function]fs/dax.c:294:14: error: ‘grab_mapping_entry’ defined but not used [-Werror=unused-function]This patch blindly marks those as
__maybe_unused, which avoids the warnings. However, I suspect that there is actually more code in this file that should not be provided withoutCONFIG_FS_IOMAPeven though we don't get a warning for it, and that we actually want a different rework, so please treat this as a bug report. I have applied the patch locally in my randconfig build setup to avoid seeing the warnings.
Quoted 2 lines
Fixes 5ac65736f740 ("dax: rip out get_block based IO support")Signed-off-by Arnd Bergmann <[email protected]>
Thanks for the report. I think the right way to deal with this is to just select FS_IOMAP when we pull in the DAX code. I sent out a patch last week that does this:
Quoted 16 lines · Ross Zwisler
Quoted 15 lines · Arnd Bergmann
Without the
get_blockbased I/O, we get warnings whenCONFIG_FS_IOMAPis disabled:
fs/dax.c:736:12: error: ‘dax_insert_mapping’ defined but not used [-Werror=unused-function]fs/dax.c:512:12: error: ‘copy_user_dax’ defined but not used [-Werror=unused-function]fs/dax.c:490:12: error: ‘dax_load_hole’ defined but not used [-Werror=unused-function]fs/dax.c:294:14: error: ‘grab_mapping_entry’ defined but not used [-Werror=unused-function]This patch blindly marks those as
__maybe_unused, which avoids the warnings. However, I suspect that there is actually more code in this file that should not be provided withoutCONFIG_FS_IOMAPeven though we don't get a warning for it, and that we actually want a different rework, so please treat this as a bug report. I have applied the patch locally in my randconfig build setup to avoid seeing the warnings.
Quoted 8 lines
Quoted 2 lines
Fixes 5ac65736f740 ("dax: rip out get_block based IO support")Signed-off-by Arnd Bergmann <[email protected]>Thanks for the report. I think the right way to deal with this is to just select
FS_IOMAPwhen we pull in the DAX code. I sent out a patch last week that does this:
It seems awkward for both filesystems and the FS_DAX core to be selecting FS_IOMAP. In the end FS_DAX and FS_IOMAP are both libraries of functionality that a filesystem can optionally use. I think the longer term FS_DAX stops being an independent user visible setting and is instead selected by filesystems that want DAX.
Quoted 25 lines · Dan Williams
Quoted 23 lines · Ross Zwisler
Quoted 15 lines · Arnd Bergmann
Without the
get_blockbased I/O, we get warnings whenCONFIG_FS_IOMAPis disabled:
fs/dax.c:736:12: error: ‘dax_insert_mapping’ defined but not used [-Werror=unused-function]fs/dax.c:512:12: error: ‘copy_user_dax’ defined but not used [-Werror=unused-function]fs/dax.c:490:12: error: ‘dax_load_hole’ defined but not used [-Werror=unused-function]fs/dax.c:294:14: error: ‘grab_mapping_entry’ defined but not used [-Werror=unused-function]This patch blindly marks those as
__maybe_unused, which avoids the warnings. However, I suspect that there is actually more code in this file that should not be provided withoutCONFIG_FS_IOMAPeven though we don't get a warning for it, and that we actually want a different rework, so please treat this as a bug report. I have applied the patch locally in my randconfig build setup to avoid seeing the warnings.Quoted 2 lines
Fixes 5ac65736f740 ("dax: rip out get_block based IO support")Signed-off-by Arnd Bergmann <[email protected]>Thanks for the report. I think the right way to deal with this is to just select
FS_IOMAPwhen we pull in the DAX code. I sent out a patch last week that does this:
Quoted 7 lines
Quoted 1 line
It seems awkward for both filesystems and the
FS_DAXcore to be selectingFS_IOMAP. In the endFS_DAXandFS_IOMAPare both libraries of functionality that a filesystem can optionally use. I think the longer termFS_DAXstops being an independent user visible setting and is instead selected by filesystems that want DAX.
This doesn't make sense to me. DAX is a user-selectable option that changes behavior (at the user's request), but FS_IOMAP is a library of functionality that is required for XFS and for DAX.
The filesystems can all work fine without DAX (hence the user option), but DAX and XFS at least require FS_IOMAP to behave correctly.
If you made DAX a FS selectable option instead of a user selectable one, when would a FS know it needs to include DAX support?
Quoted 38 lines · Ross Zwisler
Quoted 25 lines · Dan Williams
Quoted 23 lines · Ross Zwisler
Quoted 15 lines · Arnd Bergmann
Without the
get_blockbased I/O, we get warnings whenCONFIG_FS_IOMAPis disabled:
fs/dax.c:736:12: error: ‘dax_insert_mapping’ defined but not used [-Werror=unused-function]fs/dax.c:512:12: error: ‘copy_user_dax’ defined but not used [-Werror=unused-function]fs/dax.c:490:12: error: ‘dax_load_hole’ defined but not used [-Werror=unused-function]fs/dax.c:294:14: error: ‘grab_mapping_entry’ defined but not used [-Werror=unused-function]This patch blindly marks those as
__maybe_unused, which avoids the warnings. However, I suspect that there is actually more code in this file that should not be provided withoutCONFIG_FS_IOMAPeven though we don't get a warning for it, and that we actually want a different rework, so please treat this as a bug report. I have applied the patch locally in my randconfig build setup to avoid seeing the warnings.Quoted 2 lines
Fixes 5ac65736f740 ("dax: rip out get_block based IO support")Signed-off-by Arnd Bergmann <[email protected]>Thanks for the report. I think the right way to deal with this is to just select
FS_IOMAPwhen we pull in the DAX code. I sent out a patch last week that does this:Quoted 7 lines
Quoted 1 line
It seems awkward for both filesystems and the
FS_DAXcore to be selectingFS_IOMAP. In the endFS_DAXandFS_IOMAPare both libraries of functionality that a filesystem can optionally use. I think the longer termFS_DAXstops being an independent user visible setting and is instead selected by filesystems that want DAX.This doesn't make sense to me. DAX is a user-selectable option that changes behavior (at the user's request), but
FS_IOMAPis a library of functionality that is required for XFS and for DAX.
Quoted 5 lines
The filesystems can all work fine without DAX (hence the user option), but DAX and XFS at least require
FS_IOMAPto behave correctly.If you made DAX a FS selectable option instead of a user selectable one, when would a FS know it needs to include DAX support?
With a user-selectable DAX knob per-filesystem, XFS_DAX, EXT4_DAX, etc...
Quoted 40 lines · Dan Williams
Quoted 38 lines · Ross Zwisler
Quoted 25 lines · Dan Williams
Quoted 23 lines · Ross Zwisler
Quoted 15 lines · Arnd Bergmann
Without the
get_blockbased I/O, we get warnings whenCONFIG_FS_IOMAPis disabled:
fs/dax.c:736:12: error: ‘dax_insert_mapping’ defined but not used [-Werror=unused-function]fs/dax.c:512:12: error: ‘copy_user_dax’ defined but not used [-Werror=unused-function]fs/dax.c:490:12: error: ‘dax_load_hole’ defined but not used [-Werror=unused-function]fs/dax.c:294:14: error: ‘grab_mapping_entry’ defined but not used [-Werror=unused-function]This patch blindly marks those as
__maybe_unused, which avoids the warnings. However, I suspect that there is actually more code in this file that should not be provided withoutCONFIG_FS_IOMAPeven though we don't get a warning for it, and that we actually want a different rework, so please treat this as a bug report. I have applied the patch locally in my randconfig build setup to avoid seeing the warnings.Quoted 2 lines
Fixes 5ac65736f740 ("dax: rip out get_block based IO support")Signed-off-by Arnd Bergmann <[email protected]>Thanks for the report. I think the right way to deal with this is to just select
FS_IOMAPwhen we pull in the DAX code. I sent out a patch last week that does this:Quoted 7 lines
Quoted 1 line
It seems awkward for both filesystems and the
FS_DAXcore to be selectingFS_IOMAP. In the endFS_DAXandFS_IOMAPare both libraries of functionality that a filesystem can optionally use. I think the longer termFS_DAXstops being an independent user visible setting and is instead selected by filesystems that want DAX.This doesn't make sense to me. DAX is a user-selectable option that changes behavior (at the user's request), but
FS_IOMAPis a library of functionality that is required for XFS and for DAX.
Quoted 7 lines
Quoted 5 lines
The filesystems can all work fine without DAX (hence the user option), but DAX and XFS at least require
FS_IOMAPto behave correctly.If you made DAX a FS selectable option instead of a user selectable one, when would a FS know it needs to include DAX support?
With a user-selectable DAX knob per-filesystem,
XFS_DAX,EXT4_DAX, etc...
That's just silly. Requiring users to configure every filesystem that can support DAX to support DAX at config time is unneeded config space bloat. DAX has an iomap config dependency, so just select it when DAX is selected - everything else should just be automatically and nobody else needs to care what build dependencies DAX has.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 16 lines · CET Ross Zwisler
Quoted 15 lines · Arnd Bergmann
Without the
get_blockbased I/O, we get warnings whenCONFIG_FS_IOMAPis disabled:
fs/dax.c:736:12: error: ‘dax_insert_mapping’ defined but not used [-Werror=unused-function]fs/dax.c:512:12: error: ‘copy_user_dax’ defined but not used [-Werror=unused-function]fs/dax.c:490:12: error: ‘dax_load_hole’ defined but not used [-Werror=unused-function]fs/dax.c:294:14: error: ‘grab_mapping_entry’ defined but not used [-Werror=unused-function]This patch blindly marks those as
__maybe_unused, which avoids the warnings. However, I suspect that there is actually more code in this file that should not be provided withoutCONFIG_FS_IOMAPeven though we don't get a warning for it, and that we actually want a different rework, so please treat this as a bug report. I have applied the patch locally in my randconfig build setup to avoid seeing the warnings.
Quoted 8 lines
Quoted 2 lines
Fixes 5ac65736f740 ("dax: rip out get_block based IO support")Signed-off-by Arnd Bergmann <[email protected]>Thanks for the report. I think the right way to deal with this is to just select
FS_IOMAPwhen we pull in the DAX code. I sent out a patch last week that does this:
It seems we never got agreement on the approach, and we still get the warnings above in v4.10. Should we use my patch to fix up 4.10 and get a clean build again? It no longer applies, but I have a rebased version that I can send.
Arnd
Quoted 24 lines · Arnd Bergmann
Quoted 23 lines · CET Ross Zwisler
Quoted 15 lines · Arnd Bergmann
Without the
get_blockbased I/O, we get warnings whenCONFIG_FS_IOMAPis disabled:
fs/dax.c:736:12: error: ‘dax_insert_mapping’ defined but not used [-Werror=unused-function]fs/dax.c:512:12: error: ‘copy_user_dax’ defined but not used [-Werror=unused-function]fs/dax.c:490:12: error: ‘dax_load_hole’ defined but not used [-Werror=unused-function]fs/dax.c:294:14: error: ‘grab_mapping_entry’ defined but not used [-Werror=unused-function]This patch blindly marks those as
__maybe_unused, which avoids the warnings. However, I suspect that there is actually more code in this file that should not be provided withoutCONFIG_FS_IOMAPeven though we don't get a warning for it, and that we actually want a different rework, so please treat this as a bug report. I have applied the patch locally in my randconfig build setup to avoid seeing the warnings.Quoted 2 lines
Fixes 5ac65736f740 ("dax: rip out get_block based IO support")Signed-off-by Arnd Bergmann <[email protected]>Thanks for the report. I think the right way to deal with this is to just select
FS_IOMAPwhen we pull in the DAX code. I sent out a patch last week that does this:
Quoted 8 lines
Quoted 1 line
It seems we never got agreement on the approach, and we still get the warnings above in v4.10. Should we use my patch to fix up 4.10 and get a clean build again? It no longer applies, but I have a rebased version that I can send.
Arnd
Thanks for the reminder, this one slipped through the cracks. I still think the right way to go with this is to fix up DAX's dependence on FS_IOMAP. I'll send out an updated patch.
PATCH 1/1 dax: fix build warnings with FS_DAX and !FS_IOMAP
In reply to Arnd BergmannAs reported by Arnd:
https://lkml.org/lkml/2017/1/10/756
Compiling with the following configuration:
# CONFIG_EXT2_FS is not set
# CONFIG_EXT4_FS is not set
# CONFIG_XFS_FS is not set
# CONFIG_FS_IOMAP depends on the above filesystems, as is not set CONFIG_FS_DAX=y
generates build warnings about unused functions in fs/dax.c:
fs/dax.c:878:12: warning: ‘dax_insert_mapping’ defined but not used [-Wunused-function]
static int dax_insert_mapping(struct address_space *mapping,
^~~~~~~~~~~~~~~~~~
fs/dax.c:572:12: warning: ‘copy_user_dax’ defined but not used [-Wunused-function]
static int copy_user_dax(struct block_device *bdev, sector_t sector, size_t size,
^~~~~~~~~~~~~
fs/dax.c:542:12: warning: ‘dax_load_hole’ defined but not used [-Wunused-function]
static int dax_load_hole(struct address_space *mapping, void **entry,
^~~~~~~~~~~~~
fs/dax.c:312:14: warning: ‘grab_mapping_entry’ defined but not used [-Wunused-function]
static void *grab_mapping_entry(struct address_space *mapping, pgoff_t index,
^~~~~~~~~~~~~~~~~~Now that the struct buffer_head based DAX fault paths and I/O path have been removed we really depend on iomap support being present for DAX. Make this explicit by selecting FS_IOMAP if we compile in DAX support.
This allows us to remove conditional selections of FS_IOMAP when FS_DAX was present for ext2 and ext4, and to remove an #ifdef in fs/dax.c.
--- fs/Kconfig | 1 + fs/dax.c | 2 -- fs/ext2/Kconfig | 1 - fs/ext4/Kconfig | 1 - 4 files changed, 1 insertion(+), 4 deletions(-)
fs/Kconfig +1 -0
@@ -38,6 +38,7 @@ config FS_DAX bool "Direct Access (DAX) support" depends on MMU depends on !(ARM || MIPS || SPARC) + select FS_IOMAP help Direct Access (DAX) can be used on memory-backed block devices. If the block device supports DAX and the filesystem supports DAX,
fs/dax.c +0 -2
@@ -969,7 +969,6 @@ int __dax_zero_page_range(struct block_device *bdev, sector_t sector, }EXPORT_SYMBOL_GPL (__dax_zero_page_range); -#ifdef CONFIG_FS_IOMAP static sector_t dax_iomap_sector (struct iomap *iomap,loff_t pos) {return iomap->blkno + (((pos &PAGE_MASK ) - iomap->offset) >>9 );
@@ -1407,4 +1406,3 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, }EXPORT_SYMBOL_GPL (dax_iomap_pmd_fault);#endif /* CONFIG_FS_DAX_PMD */ -#endif /* CONFIG_FS_IOMAP */
fs/ext2/Kconfig +0 -1
@@ -1,6 +1,5 @@ config EXT2_FS tristate "Second extended fs support" - select FS_IOMAP if FS_DAX help Ext2 is a standard Linux file system for hard disks.
fs/ext4/Kconfig +0 -1
@@ -37,7 +37,6 @@ config EXT4_FS select CRC16 select CRYPTO select CRYPTO_CRC32C - select FS_IOMAP if FS_DAX help This is the next generation of the ext3 filesystem.
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] dax: fix build warnings with FS_DAX and !FS_IOMAP
Quoted 31 lines · Ross Zwisler
As reported by Arnd:
https://lkml.org/lkml/2017/1/10/756
Compiling with the following configuration:
#
CONFIG_EXT2_FSis not set
#CONFIG_EXT4_FSis not set
#CONFIG_XFS_FSis not set
#CONFIG_FS_IOMAPdepends on the above filesystems, as is not setCONFIG_FS_DAX=ygenerates build warnings about unused functions in
fs/dax.c:
fs/dax.c:878:12: warning: ‘dax_insert_mapping’ defined but not used [-Wunused-function]
static int dax_insert_mapping(structaddress_space*mapping,^~~~~~~~~~~~~~~~~~ fs/dax.c:572:12: warning: ‘copy_user_dax’ defined but not used [-Wunused-function] static int copy_user_dax(struct block_device *bdev, sector_t sector, size_t size, ^~~~~~~~~~~~~ fs/dax.c:542:12: warning: ‘dax_load_hole’ defined but not used [-Wunused-function] static int dax_load_hole(struct address_space *mapping, void **entry, ^~~~~~~~~~~~~ fs/dax.c:312:14: warning: ‘grab_mapping_entry’ defined but not used [-Wunused-function] static void *grab_mapping_entry(struct address_space *mapping, pgoff_t index, ^~~~~~~~~~~~~~~~~~Now that the struct
buffer_headbased DAX fault paths and I/O path have been removed we really depend on iomap support being present for DAX. Make this explicit by selectingFS_IOMAPif we compile in DAX support.
Quoted 7 lines
This allows us to remove conditional selections of
FS_IOMAPwhenFS_DAXwas present for ext2 and ext4, and to remove an #ifdef infs/dax.c.Signed-off-by Ross Zwisler <[email protected]>Reported-by Arnd Bergmann <[email protected]>Cc Jan Kara <[email protected]>Cc Christoph Hellwig <[email protected]>
Looks good. I agree that DAX without FS_IOMAP does not make sense. You can add:
Honza
Quoted 62 lines
--- fs/Kconfig | 1 + fs/dax.c | 2 -- fs/ext2/Kconfig | 1 - fs/ext4/Kconfig | 1 - 4 files changed, 1 insertion(+), 4 deletions(-)fs/Kconfig +1
-0@@ -38,6 +38,7 @@ config FS_DAX bool "Direct Access (DAX) support" depends on MMU depends on !(ARM || MIPS || SPARC) + select FS_IOMAP help Direct Access (DAX) can be used on memory-backed block devices. If the block device supports DAX and the filesystem supports DAX,fs/dax.c +0
-2@@ -969,7 +969,6 @@ int __dax_zero_page_range(struct block_device *bdev, sector_t sector, }EXPORT_SYMBOL_GPL (__dax_zero_page_range); -#ifdef CONFIG_FS_IOMAP static sector_t dax_iomap_sector (struct iomap *iomap,loff_t pos) {return iomap->blkno + (((pos &PAGE_MASK ) - iomap->offset) >>9 );@@ -1407,4 +1406,3 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address, }EXPORT_SYMBOL_GPL (dax_iomap_pmd_fault);#endif /* CONFIG_FS_DAX_PMD */ -#endif /* CONFIG_FS_IOMAP */ fs/ext2/Kconfig +0
-1@@ -1,6 +1,5 @@ config EXT2_FS tristate "Second extended fs support" - select FS_IOMAP if FS_DAX help Ext2 is a standard Linux file system for hard disks.fs/ext4/Kconfig +0
-1@@ -37,7 +37,6 @@ config EXT4_FS select CRC16 select CRYPTO select CRYPTO_CRC32C - select FS_IOMAP if FS_DAX help This is the next generation of the ext3 filesystem.Signature · 1 line
2.7.4
Signature · 6 lines
Jan Kara <[email protected]> SUSE Labs, CR _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH] dax: fix build warnings with FS_DAX and !FS_IOMAP
In reply to Ross ZwislerLooks fine: