Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: decouple READ and WRITE from the block layer ops

Move READ and WRITE to kernel.h and don't define them in terms of block
layer ops; they are our generic data direction indicators these days
and have no more resemblance with the block layer ops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>

authored by

Christoph Hellwig and committed by
Jens Axboe
d3849953 70fd7614

+11 -14
+6
include/linux/bio.h
··· 63 63 #define bio_end_sector(bio) ((bio)->bi_iter.bi_sector + bio_sectors((bio))) 64 64 65 65 /* 66 + * Return the data direction, READ or WRITE. 67 + */ 68 + #define bio_data_dir(bio) \ 69 + (op_is_write(bio_op(bio)) ? WRITE : READ) 70 + 71 + /* 66 72 * Check whether this bio carries any data or not. A NULL bio is allowed. 67 73 */ 68 74 static inline bool bio_has_data(struct bio *bio)
-13
include/linux/fs.h
··· 151 151 */ 152 152 #define CHECK_IOVEC_ONLY -1 153 153 154 - #define RW_MASK REQ_OP_WRITE 155 - 156 - #define READ REQ_OP_READ 157 - #define WRITE REQ_OP_WRITE 158 - 159 154 /* 160 155 * Attribute flags. These should be or-ed together to figure out what 161 156 * has been changed! ··· 2447 2452 extern bool is_bad_inode(struct inode *); 2448 2453 2449 2454 #ifdef CONFIG_BLOCK 2450 - /* 2451 - * return data direction, READ or WRITE 2452 - */ 2453 - static inline int bio_data_dir(struct bio *bio) 2454 - { 2455 - return op_is_write(bio_op(bio)) ? WRITE : READ; 2456 - } 2457 - 2458 2455 extern void check_disk_size_change(struct gendisk *disk, 2459 2456 struct block_device *bdev); 2460 2457 extern int revalidate_disk(struct gendisk *);
+4
include/linux/kernel.h
··· 50 50 #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) 51 51 #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) 52 52 53 + /* generic data direction definitions */ 54 + #define READ 0 55 + #define WRITE 1 56 + 53 57 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) 54 58 55 59 #define u64_to_user_ptr(x) ( \
+1 -1
include/linux/uio.h
··· 125 125 * 126 126 * The ?: is just for type safety. 127 127 */ 128 - #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK) 128 + #define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & (READ | WRITE)) 129 129 130 130 /* 131 131 * Cap the iov_iter by given limit; note that the second argument is