summaryrefslogtreecommitdiff
path: root/include/linux/part_stat.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-24 11:36:54 +0300
committerJens Axboe <axboe@kernel.dk>2020-12-02 00:53:40 +0300
commit8446fe9255be821cb38ffd306d7e8edc4b9ea662 (patch)
tree7da651adc11c5df03c517255cd6872a92705f150 /include/linux/part_stat.h
parentcb8432d650fe3be58bb962bc8e602dc405510327 (diff)
downloadlinux-8446fe9255be821cb38ffd306d7e8edc4b9ea662.tar.xz
block: switch partition lookup to use struct block_device
Use struct block_device to lookup partitions on a disk. This removes all usage of struct hd_struct from the I/O path. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Coly Li <colyli@suse.de> [bcache] Acked-by: Chao Yu <yuchao0@huawei.com> [f2fs] Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/part_stat.h')
-rw-r--r--include/linux/part_stat.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/include/linux/part_stat.h b/include/linux/part_stat.h
index 680de036691e..d2558121d48c 100644
--- a/include/linux/part_stat.h
+++ b/include/linux/part_stat.h
@@ -25,26 +25,26 @@ struct disk_stats {
#define part_stat_unlock() preempt_enable()
#define part_stat_get_cpu(part, field, cpu) \
- (per_cpu_ptr((part)->bdev->bd_stats, (cpu))->field)
+ (per_cpu_ptr((part)->bd_stats, (cpu))->field)
#define part_stat_get(part, field) \
part_stat_get_cpu(part, field, smp_processor_id())
#define part_stat_read(part, field) \
({ \
- typeof((part)->bdev->bd_stats->field) res = 0; \
+ typeof((part)->bd_stats->field) res = 0; \
unsigned int _cpu; \
for_each_possible_cpu(_cpu) \
- res += per_cpu_ptr((part)->bdev->bd_stats, _cpu)->field; \
+ res += per_cpu_ptr((part)->bd_stats, _cpu)->field; \
res; \
})
-static inline void part_stat_set_all(struct hd_struct *part, int value)
+static inline void part_stat_set_all(struct block_device *part, int value)
{
int i;
for_each_possible_cpu(i)
- memset(per_cpu_ptr(part->bdev->bd_stats, i), value,
+ memset(per_cpu_ptr(part->bd_stats, i), value,
sizeof(struct disk_stats));
}
@@ -54,13 +54,12 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
part_stat_read(part, field[STAT_DISCARD]))
#define __part_stat_add(part, field, addnd) \
- __this_cpu_add((part)->bdev->bd_stats->field, addnd)
+ __this_cpu_add((part)->bd_stats->field, addnd)
#define part_stat_add(part, field, addnd) do { \
__part_stat_add((part), field, addnd); \
- if ((part)->partno) \
- __part_stat_add(part_to_disk((part))->part0->bd_part, \
- field, addnd); \
+ if ((part)->bd_partno) \
+ __part_stat_add(bdev_whole(part), field, addnd); \
} while (0)
#define part_stat_dec(part, field) \