Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] vfs: remove unused argument in iterate_bdevs
@ 2018-01-11 14:04 Rakesh Pandit
  2018-01-11 15:06 ` Jan Kara
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Rakesh Pandit @ 2018-01-11 14:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel; +Cc: Alexander Viro, Jan Kara

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
---
 fs/block_dev.c     |  4 ++--
 fs/sync.c          | 12 ++++++------
 include/linux/fs.h |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 4a181fc..95eba30 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -2112,7 +2112,7 @@ int __invalidate_device(struct block_device *bdev, bool kill_dirty)
 }
 EXPORT_SYMBOL(__invalidate_device);
 
-void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
+void iterate_bdevs(void (*func)(struct block_device *))
 {
 	struct inode *inode, *old_inode = NULL;
 
@@ -2144,7 +2144,7 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
 
 		mutex_lock(&bdev->bd_mutex);
 		if (bdev->bd_openers)
-			func(bdev, arg);
+			func(bdev);
 		mutex_unlock(&bdev->bd_mutex);
 
 		spin_lock(&blockdev_superblock->s_inode_list_lock);
diff --git a/fs/sync.c b/fs/sync.c
index 6e0a2cb..47bfff8 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -80,12 +80,12 @@ static void sync_fs_one_sb(struct super_block *sb, void *arg)
 		sb->s_op->sync_fs(sb, *(int *)arg);
 }
 
-static void fdatawrite_one_bdev(struct block_device *bdev, void *arg)
+static void fdatawrite_one_bdev(struct block_device *bdev)
 {
 	filemap_fdatawrite(bdev->bd_inode->i_mapping);
 }
 
-static void fdatawait_one_bdev(struct block_device *bdev, void *arg)
+static void fdatawait_one_bdev(struct block_device *bdev)
 {
 	/*
 	 * We keep the error status of individual mapping so that
@@ -113,8 +113,8 @@ SYSCALL_DEFINE0(sync)
 	iterate_supers(sync_inodes_one_sb, NULL);
 	iterate_supers(sync_fs_one_sb, &nowait);
 	iterate_supers(sync_fs_one_sb, &wait);
-	iterate_bdevs(fdatawrite_one_bdev, NULL);
-	iterate_bdevs(fdatawait_one_bdev, NULL);
+	iterate_bdevs(fdatawrite_one_bdev);
+	iterate_bdevs(fdatawait_one_bdev);
 	if (unlikely(laptop_mode))
 		laptop_sync_completion();
 	return 0;
@@ -130,10 +130,10 @@ static void do_sync_work(struct work_struct *work)
 	 */
 	iterate_supers(sync_inodes_one_sb, &nowait);
 	iterate_supers(sync_fs_one_sb, &nowait);
-	iterate_bdevs(fdatawrite_one_bdev, NULL);
+	iterate_bdevs(fdatawrite_one_bdev);
 	iterate_supers(sync_inodes_one_sb, &nowait);
 	iterate_supers(sync_fs_one_sb, &nowait);
-	iterate_bdevs(fdatawrite_one_bdev, NULL);
+	iterate_bdevs(fdatawrite_one_bdev);
 	printk("Emergency Sync complete\n");
 	kfree(work);
 }
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 511fbaa..6a2d7b9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2442,7 +2442,7 @@ extern void bd_set_size(struct block_device *, loff_t size);
 extern void bd_forget(struct inode *inode);
 extern void bdput(struct block_device *);
 extern void invalidate_bdev(struct block_device *);
-extern void iterate_bdevs(void (*)(struct block_device *, void *), void *);
+extern void iterate_bdevs(void (*)(struct block_device *));
 extern int sync_blockdev(struct block_device *bdev);
 extern void kill_bdev(struct block_device *);
 extern struct super_block *freeze_bdev(struct block_device *);
@@ -2472,7 +2472,7 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
 	return 0;
 }
 
-static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
+static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
 {
 }
 
-- 
2.5.5

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vfs: remove unused argument in iterate_bdevs
  2018-01-11 14:04 [PATCH] vfs: remove unused argument in iterate_bdevs Rakesh Pandit
@ 2018-01-11 15:06 ` Jan Kara
  2018-01-11 15:18   ` Rakesh Pandit
  2018-01-11 15:31 ` Al Viro
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Jan Kara @ 2018-01-11 15:06 UTC (permalink / raw)
  To: Rakesh Pandit; +Cc: linux-fsdevel, linux-kernel, Alexander Viro, Jan Kara

On Thu 11-01-18 16:04:07, Rakesh Pandit wrote:
> @@ -2472,7 +2472,7 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
>  	return 0;
>  }
>  
> -static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
> +static inline void iterate_bdevs(void (*f)(struct block_device *, void *))

You've missed the void * in (*f) prototype here. Other than that:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vfs: remove unused argument in iterate_bdevs
  2018-01-11 15:06 ` Jan Kara
@ 2018-01-11 15:18   ` Rakesh Pandit
  0 siblings, 0 replies; 6+ messages in thread
From: Rakesh Pandit @ 2018-01-11 15:18 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, linux-kernel, Alexander Viro

On Thu, Jan 11, 2018 at 04:06:45PM +0100, Jan Kara wrote:
> On Thu 11-01-18 16:04:07, Rakesh Pandit wrote:
> > @@ -2472,7 +2472,7 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
> >  	return 0;
> >  }
> >  
> > -static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
> > +static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
> 
> You've missed the void * in (*f) prototype here. Other than that:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>

Thanks for catching it.  I would repost with your tag and fix it same time.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vfs: remove unused argument in iterate_bdevs
  2018-01-11 14:04 [PATCH] vfs: remove unused argument in iterate_bdevs Rakesh Pandit
  2018-01-11 15:06 ` Jan Kara
@ 2018-01-11 15:31 ` Al Viro
  2018-01-14 15:07 ` kbuild test robot
  2018-01-14 16:13 ` kbuild test robot
  3 siblings, 0 replies; 6+ messages in thread
From: Al Viro @ 2018-01-11 15:31 UTC (permalink / raw)
  To: Rakesh Pandit; +Cc: linux-fsdevel, linux-kernel, Jan Kara

On Thu, Jan 11, 2018 at 04:04:07PM +0200, Rakesh Pandit wrote:
> Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
> ---
>  fs/block_dev.c     |  4 ++--
>  fs/sync.c          | 12 ++++++------
>  include/linux/fs.h |  4 ++--
>  3 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 4a181fc..95eba30 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -2112,7 +2112,7 @@ int __invalidate_device(struct block_device *bdev, bool kill_dirty)
>  }
>  EXPORT_SYMBOL(__invalidate_device);
>  
> -void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
> +void iterate_bdevs(void (*func)(struct block_device *))

Sure, after you implement partially applied functions in C, so that we could
do it properly.  Until then - NAK.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vfs: remove unused argument in iterate_bdevs
  2018-01-11 14:04 [PATCH] vfs: remove unused argument in iterate_bdevs Rakesh Pandit
  2018-01-11 15:06 ` Jan Kara
  2018-01-11 15:31 ` Al Viro
@ 2018-01-14 15:07 ` kbuild test robot
  2018-01-14 16:13 ` kbuild test robot
  3 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2018-01-14 15:07 UTC (permalink / raw)
  To: Rakesh Pandit
  Cc: kbuild-all, linux-fsdevel, linux-kernel, Alexander Viro, Jan Kara

[-- Attachment #1: Type: text/plain, Size: 4133 bytes --]

Hi Rakesh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.15-rc7 next-20180112]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rakesh-Pandit/vfs-remove-unused-argument-in-iterate_bdevs/20180114-215207
config: i386-randconfig-x071-201802 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   fs/sync.c: In function 'sys_sync':
>> fs/sync.c:116:16: error: passing argument 1 of 'iterate_bdevs' from incompatible pointer type [-Werror=incompatible-pointer-types]
     iterate_bdevs(fdatawrite_one_bdev);
                   ^~~~~~~~~~~~~~~~~~~
   In file included from fs/sync.c:8:0:
   include/linux/fs.h:2475:20: note: expected 'void (*)(struct block_device *, void *)' but argument is of type 'void (*)(struct block_device *)'
    static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
                       ^~~~~~~~~~~~~
   fs/sync.c:117:16: error: passing argument 1 of 'iterate_bdevs' from incompatible pointer type [-Werror=incompatible-pointer-types]
     iterate_bdevs(fdatawait_one_bdev);
                   ^~~~~~~~~~~~~~~~~~
   In file included from fs/sync.c:8:0:
   include/linux/fs.h:2475:20: note: expected 'void (*)(struct block_device *, void *)' but argument is of type 'void (*)(struct block_device *)'
    static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
                       ^~~~~~~~~~~~~
   fs/sync.c: In function 'do_sync_work':
   fs/sync.c:133:16: error: passing argument 1 of 'iterate_bdevs' from incompatible pointer type [-Werror=incompatible-pointer-types]
     iterate_bdevs(fdatawrite_one_bdev);
                   ^~~~~~~~~~~~~~~~~~~
   In file included from fs/sync.c:8:0:
   include/linux/fs.h:2475:20: note: expected 'void (*)(struct block_device *, void *)' but argument is of type 'void (*)(struct block_device *)'
    static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
                       ^~~~~~~~~~~~~
   fs/sync.c:136:16: error: passing argument 1 of 'iterate_bdevs' from incompatible pointer type [-Werror=incompatible-pointer-types]
     iterate_bdevs(fdatawrite_one_bdev);
                   ^~~~~~~~~~~~~~~~~~~
   In file included from fs/sync.c:8:0:
   include/linux/fs.h:2475:20: note: expected 'void (*)(struct block_device *, void *)' but argument is of type 'void (*)(struct block_device *)'
    static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
                       ^~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/iterate_bdevs +116 fs/sync.c

    97	
    98	/*
    99	 * Sync everything. We start by waking flusher threads so that most of
   100	 * writeback runs on all devices in parallel. Then we sync all inodes reliably
   101	 * which effectively also waits for all flusher threads to finish doing
   102	 * writeback. At this point all data is on disk so metadata should be stable
   103	 * and we tell filesystems to sync their metadata via ->sync_fs() calls.
   104	 * Finally, we writeout all block devices because some filesystems (e.g. ext2)
   105	 * just write metadata (such as inodes or bitmaps) to block device page cache
   106	 * and do not sync it on their own in ->sync_fs().
   107	 */
   108	SYSCALL_DEFINE0(sync)
   109	{
   110		int nowait = 0, wait = 1;
   111	
   112		wakeup_flusher_threads(WB_REASON_SYNC);
   113		iterate_supers(sync_inodes_one_sb, NULL);
   114		iterate_supers(sync_fs_one_sb, &nowait);
   115		iterate_supers(sync_fs_one_sb, &wait);
 > 116		iterate_bdevs(fdatawrite_one_bdev);
   117		iterate_bdevs(fdatawait_one_bdev);
   118		if (unlikely(laptop_mode))
   119			laptop_sync_completion();
   120		return 0;
   121	}
   122	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28414 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vfs: remove unused argument in iterate_bdevs
  2018-01-11 14:04 [PATCH] vfs: remove unused argument in iterate_bdevs Rakesh Pandit
                   ` (2 preceding siblings ...)
  2018-01-14 15:07 ` kbuild test robot
@ 2018-01-14 16:13 ` kbuild test robot
  3 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2018-01-14 16:13 UTC (permalink / raw)
  To: Rakesh Pandit
  Cc: kbuild-all, linux-fsdevel, linux-kernel, Alexander Viro, Jan Kara

[-- Attachment #1: Type: text/plain, Size: 6633 bytes --]

Hi Rakesh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.15-rc7 next-20180112]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rakesh-Pandit/vfs-remove-unused-argument-in-iterate_bdevs/20180114-215207
config: i386-randconfig-a1-01142254 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   fs/sync.c: In function 'sys_sync':
>> fs/sync.c:116:16: warning: passing argument 1 of 'iterate_bdevs' from incompatible pointer type
     iterate_bdevs(fdatawrite_one_bdev);
                   ^
   In file included from fs/sync.c:8:0:
   include/linux/fs.h:2475:20: note: expected 'void (*)(struct block_device *, void *)' but argument is of type 'void (*)(struct block_device *)'
    static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
                       ^
   fs/sync.c:117:16: warning: passing argument 1 of 'iterate_bdevs' from incompatible pointer type
     iterate_bdevs(fdatawait_one_bdev);
                   ^
   In file included from fs/sync.c:8:0:
   include/linux/fs.h:2475:20: note: expected 'void (*)(struct block_device *, void *)' but argument is of type 'void (*)(struct block_device *)'
    static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
                       ^
   fs/sync.c: In function 'do_sync_work':
   fs/sync.c:133:16: warning: passing argument 1 of 'iterate_bdevs' from incompatible pointer type
     iterate_bdevs(fdatawrite_one_bdev);
                   ^
   In file included from fs/sync.c:8:0:
   include/linux/fs.h:2475:20: note: expected 'void (*)(struct block_device *, void *)' but argument is of type 'void (*)(struct block_device *)'
    static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
                       ^
   fs/sync.c:136:16: warning: passing argument 1 of 'iterate_bdevs' from incompatible pointer type
     iterate_bdevs(fdatawrite_one_bdev);
                   ^
   In file included from fs/sync.c:8:0:
   include/linux/fs.h:2475:20: note: expected 'void (*)(struct block_device *, void *)' but argument is of type 'void (*)(struct block_device *)'
    static inline void iterate_bdevs(void (*f)(struct block_device *, void *))
                       ^
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 2 include/linux/file.h:fdput
   Cyclomatic Complexity 1 include/linux/file.h:__to_fd
   Cyclomatic Complexity 1 include/linux/file.h:fdget
   Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_read
   Cyclomatic Complexity 1 include/asm-generic/atomic-long.h:atomic_long_read
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock
   Cyclomatic Complexity 1 include/linux/rwsem.h:rwsem_is_locked
   Cyclomatic Complexity 1 include/linux/workqueue.h:__init_work
   Cyclomatic Complexity 1 include/linux/workqueue.h:queue_work
   Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_work
   Cyclomatic Complexity 1 include/linux/fs.h:file_inode
   Cyclomatic Complexity 1 include/linux/fs.h:sb_rdonly
   Cyclomatic Complexity 1 include/linux/fs.h:mark_inode_dirty_sync
   Cyclomatic Complexity 1 include/linux/fs.h:iterate_bdevs
   Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_order_trace
   Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 3 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/writeback.h:laptop_sync_completion
   Cyclomatic Complexity 1 fs/internal.h:__sync_blockdev
   Cyclomatic Complexity 3 fs/sync.c:sync_fs_one_sb
   Cyclomatic Complexity 2 fs/sync.c:SYSC_syncfs
   Cyclomatic Complexity 1 fs/sync.c:SYSC_fsync
   Cyclomatic Complexity 1 fs/sync.c:SYSC_fdatasync
   Cyclomatic Complexity 17 fs/sync.c:SYSC_sync_file_range
   Cyclomatic Complexity 1 fs/sync.c:SYSC_sync_file_range2
   Cyclomatic Complexity 2 fs/sync.c:sync_inodes_one_sb
   Cyclomatic Complexity 3 fs/sync.c:__sync_filesystem
   Cyclomatic Complexity 1 fs/sync.c:fdatawait_one_bdev
   Cyclomatic Complexity 1 fs/sync.c:fdatawrite_one_bdev
   Cyclomatic Complexity 1 fs/sync.c:do_sync_work
   Cyclomatic Complexity 4 fs/sync.c:sync_filesystem
   Cyclomatic Complexity 2 fs/sync.c:sys_sync
   Cyclomatic Complexity 2 fs/sync.c:emergency_sync
   Cyclomatic Complexity 1 fs/sync.c:SyS_syncfs
   Cyclomatic Complexity 4 fs/sync.c:vfs_fsync_range
   Cyclomatic Complexity 1 fs/sync.c:vfs_fsync
   Cyclomatic Complexity 2 fs/sync.c:do_fsync
   Cyclomatic Complexity 1 fs/sync.c:SyS_fsync
   Cyclomatic Complexity 1 fs/sync.c:SyS_fdatasync
   Cyclomatic Complexity 1 fs/sync.c:SyS_sync_file_range
   Cyclomatic Complexity 1 fs/sync.c:SyS_sync_file_range2

vim +/iterate_bdevs +116 fs/sync.c

    97	
    98	/*
    99	 * Sync everything. We start by waking flusher threads so that most of
   100	 * writeback runs on all devices in parallel. Then we sync all inodes reliably
   101	 * which effectively also waits for all flusher threads to finish doing
   102	 * writeback. At this point all data is on disk so metadata should be stable
   103	 * and we tell filesystems to sync their metadata via ->sync_fs() calls.
   104	 * Finally, we writeout all block devices because some filesystems (e.g. ext2)
   105	 * just write metadata (such as inodes or bitmaps) to block device page cache
   106	 * and do not sync it on their own in ->sync_fs().
   107	 */
   108	SYSCALL_DEFINE0(sync)
   109	{
   110		int nowait = 0, wait = 1;
   111	
   112		wakeup_flusher_threads(WB_REASON_SYNC);
   113		iterate_supers(sync_inodes_one_sb, NULL);
   114		iterate_supers(sync_fs_one_sb, &nowait);
   115		iterate_supers(sync_fs_one_sb, &wait);
 > 116		iterate_bdevs(fdatawrite_one_bdev);
   117		iterate_bdevs(fdatawait_one_bdev);
   118		if (unlikely(laptop_mode))
   119			laptop_sync_completion();
   120		return 0;
   121	}
   122	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24464 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-14 16:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-11 14:04 [PATCH] vfs: remove unused argument in iterate_bdevs Rakesh Pandit
2018-01-11 15:06 ` Jan Kara
2018-01-11 15:18   ` Rakesh Pandit
2018-01-11 15:31 ` Al Viro
2018-01-14 15:07 ` kbuild test robot
2018-01-14 16:13 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).