xref: /linux/fs/iomap/internal.h (revision c4dde411bc366f568dbe33366253bbfea049e8ea)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _IOMAP_INTERNAL_H
3 #define _IOMAP_INTERNAL_H 1
4 
5 #define IOEND_BATCH_SIZE	4096
6 
7 /*
8  * Normally we can build bios as big as the data structure supports.
9  *
10  * But for integrity protected I/O we need to respect the maximum size of the
11  * single contiguous allocation for the integrity buffer.
12  */
13 static inline size_t iomap_max_bio_size(const struct iomap *iomap)
14 {
15 	if (iomap->flags & IOMAP_F_INTEGRITY)
16 		return max_integrity_io_size(bdev_limits(iomap->bdev));
17 	return BIO_MAX_SIZE;
18 }
19 
20 u32 iomap_finish_ioend_buffered_read(struct iomap_ioend *ioend);
21 u32 iomap_finish_ioend_direct(struct iomap_ioend *ioend);
22 
23 #ifdef CONFIG_BLOCK
24 int iomap_bio_read_folio_range_sync(const struct iomap_iter *iter,
25 		struct folio *folio, loff_t pos, size_t len);
26 #else
27 static inline int iomap_bio_read_folio_range_sync(const struct iomap_iter *iter,
28 		struct folio *folio, loff_t pos, size_t len)
29 {
30 	WARN_ON_ONCE(1);
31 	return -EIO;
32 }
33 #endif /* CONFIG_BLOCK */
34 
35 #endif /* _IOMAP_INTERNAL_H */
36