diff options
| author | Gao Xiang <[email protected]> | 2021-08-10 00:16:47 +0800 |
|---|---|---|
| committer | Gao Xiang <[email protected]> | 2021-08-10 00:17:44 +0800 |
| commit | 61dc131cecaecfa1ade0f932f306544861e83718 (patch) | |
| tree | 89d326fd5cbbe48084e4ece2b81bd1c00946f171 /include/linux | |
| parent | 06252e9ce05b94b587e522667b85848a30197b15 (diff) | |
| parent | ae44f9c286da3fbb3f827076403ea64fa9adfef2 (diff) | |
Merge tag 'iomap-5.15-merge-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
Pull 'iomap-5.15-merge-2' to support EROFS iomap tail-packing inline:
- Simplify the bio_end_page usage in the buffered IO code.
- Support reading inline data at nonzero offsets for erofs.
- Fix some typos and bad grammar.
- Convert kmap_atomic usage in the inline data read path.
- Add some extra inline data input checking.
Signed-off-by: Gao Xiang <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/iomap.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 479c1da3e221..b8ec145b2975 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -98,6 +98,24 @@ iomap_sector(struct iomap *iomap, loff_t pos) } /* + * Returns the inline data pointer for logical offset @pos. + */ +static inline void *iomap_inline_data(struct iomap *iomap, loff_t pos) +{ + return iomap->inline_data + pos - iomap->offset; +} + +/* + * Check if the mapping's length is within the valid range for inline data. + * This is used to guard against accessing data beyond the page inline_data + * points at. + */ +static inline bool iomap_inline_data_valid(struct iomap *iomap) +{ + return iomap->length <= PAGE_SIZE - offset_in_page(iomap->inline_data); +} + +/* * When a filesystem sets page_ops in an iomap mapping it returns, page_prepare * and page_done will be called for each page written to. This only applies to * buffered writes as unbuffered writes will not typically have pages |