diff mbox series

[2/2] md: don't account sync_io if iostats of the disk is disabled

Message ID 20231211075614.1850003-3-linan666@huaweicloud.com (mailing list archive)
State Superseded, archived
Delegated to: Song Liu
Headers show
Series md: fix is_mddev_idle() | expand

Commit Message

Li Nan Dec. 11, 2023, 7:56 a.m. UTC
From: Li Nan <linan122@huawei.com>

If iostats is disabled, disk_stats will not be updated and
part_stat_read_accum() only returns a constant value. In this case,
continuing to count sync_io and to check is_mddev_idle() is no longer
meaningful.

Signed-off-by: Li Nan <linan122@huawei.com>
---
 drivers/md/md.h | 3 ++-
 drivers/md/md.c | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

kernel test robot Dec. 11, 2023, 6 p.m. UTC | #1
Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on song-md/md-next]
[also build test ERROR on axboe-block/for-next linus/master v6.7-rc5 next-20231211]
[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/linan666-huaweicloud-com/md-Fix-overflow-in-is_mddev_idle/20231211-155833
base:   git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next
patch link:    https://lore.kernel.org/r/20231211075614.1850003-3-linan666%40huaweicloud.com
patch subject: [PATCH 2/2] md: don't account sync_io if iostats of the disk is disabled
config: i386-buildonly-randconfig-003-20231211 (https://download.01.org/0day-ci/archive/20231212/202312120159.I03ON8Ov-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231212/202312120159.I03ON8Ov-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/202312120159.I03ON8Ov-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from drivers/md/md-faulty.c:60:
>> drivers/md/md.h:587:28: error: character <U+2014> not allowed in an identifier
           if (blk_queue_io_stat(disk—>queue))
                                     ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
   11 errors generated.
--
   In file included from drivers/md/md-bitmap.c:32:
>> drivers/md/md.h:587:28: error: character <U+2014> not allowed in an identifier
           if (blk_queue_io_stat(disk—>queue))
                                     ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md-bitmap.c:2601:34: warning: result of comparison of constant 4294967296 with expression of type 'unsigned long' is always false [-Wtautological-constant-out-of-range-compare]
           if (BITS_PER_LONG > 32 && csize >= (1ULL << (BITS_PER_BYTE *
                                     ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 11 errors generated.
--
   In file included from drivers/md/md.c:69:
>> drivers/md/md.h:587:28: error: character <U+2014> not allowed in an identifier
           if (blk_queue_io_stat(disk—>queue))
                                     ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.c:8517:29: error: character <U+2014> not allowed in an identifier
                   if (blk_queue_io_stat(disk—>queue))
                                             ^
>> drivers/md/md.c:8517:25: error: use of undeclared identifier 'disk—'
                   if (blk_queue_io_stat(disk—>queue))
                                         ^
>> drivers/md/md.c:8517:33: error: use of undeclared identifier 'queue'
                   if (blk_queue_io_stat(disk—>queue))
                                               ^
>> drivers/md/md.c:8517:25: error: use of undeclared identifier 'disk—'
                   if (blk_queue_io_stat(disk—>queue))
                                         ^
>> drivers/md/md.c:8517:33: error: use of undeclared identifier 'queue'
                   if (blk_queue_io_stat(disk—>queue))
                                               ^
>> drivers/md/md.c:8517:25: error: use of undeclared identifier 'disk—'
                   if (blk_queue_io_stat(disk—>queue))
                                         ^
>> drivers/md/md.c:8517:33: error: use of undeclared identifier 'queue'
                   if (blk_queue_io_stat(disk—>queue))
                                               ^
>> drivers/md/md.c:8517:25: error: use of undeclared identifier 'disk—'
                   if (blk_queue_io_stat(disk—>queue))
                                         ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   20 errors generated.
--
   In file included from drivers/md/raid5.c:53:
>> drivers/md/md.h:587:28: error: character <U+2014> not allowed in an identifier
           if (blk_queue_io_stat(disk—>queue))
                                     ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
>> drivers/md/md.h:587:24: error: use of undeclared identifier 'disk—'
           if (blk_queue_io_stat(disk—>queue))
                                 ^
>> drivers/md/md.h:587:32: error: use of undeclared identifier 'queue'
           if (blk_queue_io_stat(disk—>queue))
                                       ^
   drivers/md/raid5.c:4265:7: warning: variable 'qread' set but not used [-Wunused-but-set-variable]
                   int qread =0;
                       ^
   1 warning and 11 errors generated.


vim +587 drivers/md/md.h

   584	
   585	static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
   586	{
 > 587		if (blk_queue_io_stat(disk—>queue))
   588			md_sync_acct(bio->bi_bdev, nr_sectors);
   589	}
   590
kernel test robot Dec. 11, 2023, 9:42 p.m. UTC | #2
Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on song-md/md-next]
[also build test ERROR on axboe-block/for-next linus/master v6.7-rc5 next-20231211]
[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/linan666-huaweicloud-com/md-Fix-overflow-in-is_mddev_idle/20231211-155833
base:   git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next
patch link:    https://lore.kernel.org/r/20231211075614.1850003-3-linan666%40huaweicloud.com
patch subject: [PATCH 2/2] md: don't account sync_io if iostats of the disk is disabled
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20231212/202312120536.VqOKGsPZ-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231212/202312120536.VqOKGsPZ-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/202312120536.VqOKGsPZ-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:23,
                    from include/linux/sched/mm.h:5,
                    from drivers/md/md.c:40:
   drivers/md/md.h: In function 'md_sync_acct_bio':
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:31: error: 'disk' undeclared (first use in this function)
     587 |         if (blk_queue_io_stat(disk—>queue))
         |                               ^~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
   drivers/md/md.h:587:31: note: each undeclared identifier is reported only once for each function it appears in
     587 |         if (blk_queue_io_stat(disk—>queue))
         |                               ^~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:37: error: 'queue' undeclared (first use in this function); did you mean 'sigqueue'?
     587 |         if (blk_queue_io_stat(disk—>queue))
         |                                     ^~~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:51:23: note: in definition of macro 'bitop'
      51 |           (uintptr_t)(addr) != (uintptr_t)NULL &&                       \
         |                       ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:52:57: note: in definition of macro 'bitop'
      52 |           __builtin_constant_p(*(const unsigned long *)(addr))) ?       \
         |                                                         ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:53:24: note: in definition of macro 'bitop'
      53 |          const##op(nr, addr) : op(nr, addr))
         |                        ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:53:39: note: in definition of macro 'bitop'
      53 |          const##op(nr, addr) : op(nr, addr))
         |                                       ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
   drivers/md/md.c: In function 'is_mddev_idle':
>> drivers/md/md.c:8517:43: error: stray '\342' in program
    8517 |                 if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                           ^~~~~~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.c:8517:21: note: in expansion of macro 'blk_queue_io_stat'
    8517 |                 if (blk_queue_io_stat(disk—>queue))
         |                     ^~~~~~~~~~~~~~~~~
>> drivers/md/md.c:8517:45: error: 'queue' undeclared (first use in this function); did you mean 'sigqueue'?
    8517 |                 if (blk_queue_io_stat(disk—>queue))
         |                                             ^~~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.c:8517:21: note: in expansion of macro 'blk_queue_io_stat'
    8517 |                 if (blk_queue_io_stat(disk—>queue))
         |                     ^~~~~~~~~~~~~~~~~
>> drivers/md/md.c:8517:43: error: stray '\342' in program
    8517 |                 if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                           ^~~~~~~~
   include/linux/bitops.h:51:23: note: in definition of macro 'bitop'
      51 |           (uintptr_t)(addr) != (uintptr_t)NULL &&                       \
         |                       ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.c:8517:21: note: in expansion of macro 'blk_queue_io_stat'
    8517 |                 if (blk_queue_io_stat(disk—>queue))
         |                     ^~~~~~~~~~~~~~~~~
>> drivers/md/md.c:8517:43: error: stray '\342' in program
    8517 |                 if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                           ^~~~~~~~
   include/linux/bitops.h:52:57: note: in definition of macro 'bitop'
      52 |           __builtin_constant_p(*(const unsigned long *)(addr))) ?       \
         |                                                         ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.c:8517:21: note: in expansion of macro 'blk_queue_io_stat'
    8517 |                 if (blk_queue_io_stat(disk—>queue))
         |                     ^~~~~~~~~~~~~~~~~
>> drivers/md/md.c:8517:43: error: stray '\342' in program
    8517 |                 if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                           ^~~~~~~~
   include/linux/bitops.h:53:24: note: in definition of macro 'bitop'
      53 |          const##op(nr, addr) : op(nr, addr))
         |                        ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.c:8517:21: note: in expansion of macro 'blk_queue_io_stat'
    8517 |                 if (blk_queue_io_stat(disk—>queue))
         |                     ^~~~~~~~~~~~~~~~~
>> drivers/md/md.c:8517:43: error: stray '\342' in program
    8517 |                 if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                           ^~~~~~~~
   include/linux/bitops.h:53:39: note: in definition of macro 'bitop'
      53 |          const##op(nr, addr) : op(nr, addr))
         |                                       ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.c:8517:21: note: in expansion of macro 'blk_queue_io_stat'
    8517 |                 if (blk_queue_io_stat(disk—>queue))
         |                     ^~~~~~~~~~~~~~~~~
--
   In file included from include/linux/thread_info.h:27,
                    from arch/arm64/include/asm/preempt.h:6,
                    from include/linux/preempt.h:79,
                    from include/linux/spinlock.h:56,
                    from include/linux/wait.h:9,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/highmem.h:5,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/blkdev.h:9,
                    from drivers/md/md-bitmap.c:19:
   drivers/md/md.h: In function 'md_sync_acct_bio':
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:31: error: 'disk' undeclared (first use in this function)
     587 |         if (blk_queue_io_stat(disk—>queue))
         |                               ^~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
   drivers/md/md.h:587:31: note: each undeclared identifier is reported only once for each function it appears in
     587 |         if (blk_queue_io_stat(disk—>queue))
         |                               ^~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:37: error: 'queue' undeclared (first use in this function); did you mean 'sigqueue'?
     587 |         if (blk_queue_io_stat(disk—>queue))
         |                                     ^~~~~
   include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
      50 |           __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
         |                                            ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:51:23: note: in definition of macro 'bitop'
      51 |           (uintptr_t)(addr) != (uintptr_t)NULL &&                       \
         |                       ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:52:57: note: in definition of macro 'bitop'
      52 |           __builtin_constant_p(*(const unsigned long *)(addr))) ?       \
         |                                                         ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:53:24: note: in definition of macro 'bitop'
      53 |          const##op(nr, addr) : op(nr, addr))
         |                        ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~
>> drivers/md/md.h:587:35: error: stray '\342' in program
     587 |         if (blk_queue_io_stat(disk<U+2014>>queue))
         |                                   ^~~~~~~~
   include/linux/bitops.h:53:39: note: in definition of macro 'bitop'
      53 |          const##op(nr, addr) : op(nr, addr))
         |                                       ^~~~
   include/linux/blkdev.h:567:33: note: in expansion of macro 'test_bit'
     567 | #define blk_queue_io_stat(q)    test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
         |                                 ^~~~~~~~
   drivers/md/md.h:587:13: note: in expansion of macro 'blk_queue_io_stat'
     587 |         if (blk_queue_io_stat(disk—>queue))
         |             ^~~~~~~~~~~~~~~~~


vim +/342 +587 drivers/md/md.h

   584	
   585	static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
   586	{
 > 587		if (blk_queue_io_stat(disk—>queue))
   588			md_sync_acct(bio->bi_bdev, nr_sectors);
   589	}
   590
diff mbox series

Patch

diff --git a/drivers/md/md.h b/drivers/md/md.h
index 1a4f976951c1..d57e765b4ec2 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -589,7 +589,8 @@  static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sect
 
 static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
 {
-	md_sync_acct(bio->bi_bdev, nr_sectors);
+	if (blk_queue_io_stat(disk—>queue))
+		md_sync_acct(bio->bi_bdev, nr_sectors);
 }
 
 struct md_personality
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1d71b2a9af03..9a3610bcc75f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8502,6 +8502,10 @@  static int is_mddev_idle(struct mddev *mddev, int init)
 	rcu_read_lock();
 	rdev_for_each_rcu(rdev, mddev) {
 		struct gendisk *disk = rdev->bdev->bd_disk;
+
+		if (blk_queue_io_stat(disk—>queue))
+			continue;
+
 		curr_events =
 			(long long)part_stat_read_accum(disk->part0, sectors) -
 			      atomic64_read(&disk->sync_io);