~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/part_stat.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/part_stat.h (Version linux-6.12-rc7) and /include/linux/part_stat.h (Version linux-5.12.19)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_PART_STAT_H                          2 #ifndef _LINUX_PART_STAT_H
  3 #define _LINUX_PART_STAT_H                          3 #define _LINUX_PART_STAT_H
  4                                                     4 
  5 #include <linux/blkdev.h>                      !!   5 #include <linux/genhd.h>
  6 #include <asm/local.h>                         << 
  7                                                     6 
  8 struct disk_stats {                                 7 struct disk_stats {
  9         u64 nsecs[NR_STAT_GROUPS];                  8         u64 nsecs[NR_STAT_GROUPS];
 10         unsigned long sectors[NR_STAT_GROUPS];      9         unsigned long sectors[NR_STAT_GROUPS];
 11         unsigned long ios[NR_STAT_GROUPS];         10         unsigned long ios[NR_STAT_GROUPS];
 12         unsigned long merges[NR_STAT_GROUPS];      11         unsigned long merges[NR_STAT_GROUPS];
 13         unsigned long io_ticks;                    12         unsigned long io_ticks;
 14         local_t in_flight[2];                      13         local_t in_flight[2];
 15 };                                                 14 };
 16                                                    15 
 17 /*                                                 16 /*
 18  * Macros to operate on percpu disk statistics     17  * Macros to operate on percpu disk statistics:
 19  *                                                 18  *
 20  * {disk|part|all}_stat_{add|sub|inc|dec}() mo     19  * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters and should
 21  * be called between disk_stat_lock() and disk     20  * be called between disk_stat_lock() and disk_stat_unlock().
 22  *                                                 21  *
 23  * part_stat_read() can be called at any time.     22  * part_stat_read() can be called at any time.
 24  */                                                23  */
 25 #define part_stat_lock()        preempt_disabl     24 #define part_stat_lock()        preempt_disable()
 26 #define part_stat_unlock()      preempt_enable     25 #define part_stat_unlock()      preempt_enable()
 27                                                    26 
 28 #define part_stat_get_cpu(part, field, cpu)        27 #define part_stat_get_cpu(part, field, cpu)                             \
 29         (per_cpu_ptr((part)->bd_stats, (cpu))-     28         (per_cpu_ptr((part)->bd_stats, (cpu))->field)
 30                                                    29 
 31 #define part_stat_get(part, field)                 30 #define part_stat_get(part, field)                                      \
 32         part_stat_get_cpu(part, field, smp_pro     31         part_stat_get_cpu(part, field, smp_processor_id())
 33                                                    32 
 34 #define part_stat_read(part, field)                33 #define part_stat_read(part, field)                                     \
 35 ({                                                 34 ({                                                                      \
 36         typeof((part)->bd_stats->field) res =      35         typeof((part)->bd_stats->field) res = 0;                        \
 37         unsigned int _cpu;                         36         unsigned int _cpu;                                              \
 38         for_each_possible_cpu(_cpu)                37         for_each_possible_cpu(_cpu)                                     \
 39                 res += per_cpu_ptr((part)->bd_     38                 res += per_cpu_ptr((part)->bd_stats, _cpu)->field; \
 40         res;                                       39         res;                                                            \
 41 })                                                 40 })
 42                                                    41 
 43 static inline void part_stat_set_all(struct bl     42 static inline void part_stat_set_all(struct block_device *part, int value)
 44 {                                                  43 {
 45         int i;                                     44         int i;
 46                                                    45 
 47         for_each_possible_cpu(i)                   46         for_each_possible_cpu(i)
 48                 memset(per_cpu_ptr(part->bd_st     47                 memset(per_cpu_ptr(part->bd_stats, i), value,
 49                                 sizeof(struct      48                                 sizeof(struct disk_stats));
 50 }                                                  49 }
 51                                                    50 
 52 #define part_stat_read_accum(part, field)          51 #define part_stat_read_accum(part, field)                               \
 53         (part_stat_read(part, field[STAT_READ]     52         (part_stat_read(part, field[STAT_READ]) +                       \
 54          part_stat_read(part, field[STAT_WRITE     53          part_stat_read(part, field[STAT_WRITE]) +                      \
 55          part_stat_read(part, field[STAT_DISCA     54          part_stat_read(part, field[STAT_DISCARD]))
 56                                                    55 
 57 #define __part_stat_add(part, field, addnd)        56 #define __part_stat_add(part, field, addnd)                             \
 58         __this_cpu_add((part)->bd_stats->field     57         __this_cpu_add((part)->bd_stats->field, addnd)
 59                                                    58 
 60 #define part_stat_add(part, field, addnd)          59 #define part_stat_add(part, field, addnd)       do {                    \
 61         __part_stat_add((part), field, addnd);     60         __part_stat_add((part), field, addnd);                          \
 62         if (bdev_is_partition(part))           !!  61         if ((part)->bd_partno)                                          \
 63                 __part_stat_add(bdev_whole(par     62                 __part_stat_add(bdev_whole(part), field, addnd);        \
 64 } while (0)                                        63 } while (0)
 65                                                    64 
 66 #define part_stat_dec(part, field)                 65 #define part_stat_dec(part, field)                                      \
 67         part_stat_add(part, field, -1)             66         part_stat_add(part, field, -1)
 68 #define part_stat_inc(part, field)                 67 #define part_stat_inc(part, field)                                      \
 69         part_stat_add(part, field, 1)              68         part_stat_add(part, field, 1)
 70 #define part_stat_sub(part, field, subnd)          69 #define part_stat_sub(part, field, subnd)                               \
 71         part_stat_add(part, field, -subnd)         70         part_stat_add(part, field, -subnd)
 72                                                    71 
 73 #define part_stat_local_dec(part, field)           72 #define part_stat_local_dec(part, field)                                \
 74         local_dec(&(part_stat_get(part, field)     73         local_dec(&(part_stat_get(part, field)))
 75 #define part_stat_local_inc(part, field)           74 #define part_stat_local_inc(part, field)                                \
 76         local_inc(&(part_stat_get(part, field)     75         local_inc(&(part_stat_get(part, field)))
 77 #define part_stat_local_read(part, field)          76 #define part_stat_local_read(part, field)                               \
 78         local_read(&(part_stat_get(part, field     77         local_read(&(part_stat_get(part, field)))
 79 #define part_stat_local_read_cpu(part, field,      78 #define part_stat_local_read_cpu(part, field, cpu)                      \
 80         local_read(&(part_stat_get_cpu(part, f     79         local_read(&(part_stat_get_cpu(part, field, cpu)))
 81                                                    80 
 82 #endif /* _LINUX_PART_STAT_H */                    81 #endif /* _LINUX_PART_STAT_H */
 83                                                    82 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php