1 /*
2 * Copyright (C) 2020 Western Digital Corporation or its affiliates.
3 *
4 * This file is released under the GPL.
5 */
6 #ifndef FIO_BLKZONED_H
7 #define FIO_BLKZONED_H
8
9 #include "zbd_types.h"
10
11 #ifdef CONFIG_HAS_BLKZONED
12 extern int blkzoned_get_zoned_model(struct thread_data *td,
13 struct fio_file *f, enum zbd_zoned_model *model);
14 extern int blkzoned_report_zones(struct thread_data *td,
15 struct fio_file *f, uint64_t offset,
16 struct zbd_zone *zones, unsigned int nr_zones);
17 extern int blkzoned_reset_wp(struct thread_data *td, struct fio_file *f,
18 uint64_t offset, uint64_t length);
19 extern int blkzoned_get_max_open_zones(struct thread_data *td, struct fio_file *f,
20 unsigned int *max_open_zones);
21 #else
22 /*
23 * Define stubs for systems that do not have zoned block device support.
24 */
blkzoned_get_zoned_model(struct thread_data * td,struct fio_file * f,enum zbd_zoned_model * model)25 static inline int blkzoned_get_zoned_model(struct thread_data *td,
26 struct fio_file *f, enum zbd_zoned_model *model)
27 {
28 /*
29 * If this is a block device file, allow zbd emulation.
30 */
31 if (f->filetype == FIO_TYPE_BLOCK) {
32 *model = ZBD_NONE;
33 return 0;
34 }
35
36 return -ENODEV;
37 }
blkzoned_report_zones(struct thread_data * td,struct fio_file * f,uint64_t offset,struct zbd_zone * zones,unsigned int nr_zones)38 static inline int blkzoned_report_zones(struct thread_data *td,
39 struct fio_file *f, uint64_t offset,
40 struct zbd_zone *zones, unsigned int nr_zones)
41 {
42 return -EIO;
43 }
blkzoned_reset_wp(struct thread_data * td,struct fio_file * f,uint64_t offset,uint64_t length)44 static inline int blkzoned_reset_wp(struct thread_data *td, struct fio_file *f,
45 uint64_t offset, uint64_t length)
46 {
47 return -EIO;
48 }
blkzoned_get_max_open_zones(struct thread_data * td,struct fio_file * f,unsigned int * max_open_zones)49 static inline int blkzoned_get_max_open_zones(struct thread_data *td, struct fio_file *f,
50 unsigned int *max_open_zones)
51 {
52 return -EIO;
53 }
54 #endif
55
56 #endif /* FIO_BLKZONED_H */
57