Merge tag 'rproc-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc...
[linux-block.git] / fs / btrfs / file-item.h
CommitLineData
7c8ede16
JB
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef BTRFS_FILE_ITEM_H
4#define BTRFS_FILE_ITEM_H
5
6bfd0ffa
JB
6#include "accessors.h"
7
8#define BTRFS_FILE_EXTENT_INLINE_DATA_START \
9 (offsetof(struct btrfs_file_extent_item, disk_bytenr))
10
11static inline u32 BTRFS_MAX_INLINE_DATA_SIZE(const struct btrfs_fs_info *info)
12{
13 return BTRFS_MAX_ITEM_SIZE(info) - BTRFS_FILE_EXTENT_INLINE_DATA_START;
14}
15
16/*
17 * Return the number of bytes used by the item on disk, minus the size of any
18 * extent headers. If a file is compressed on disk, this is the compressed
19 * size.
20 */
21static inline u32 btrfs_file_extent_inline_item_len(
22 const struct extent_buffer *eb,
23 int nr)
24{
25 return btrfs_item_size(eb, nr) - BTRFS_FILE_EXTENT_INLINE_DATA_START;
26}
27
28static inline unsigned long btrfs_file_extent_inline_start(
29 const struct btrfs_file_extent_item *e)
30{
31 return (unsigned long)e + BTRFS_FILE_EXTENT_INLINE_DATA_START;
32}
33
34static inline u32 btrfs_file_extent_calc_inline_size(u32 datasize)
35{
36 return BTRFS_FILE_EXTENT_INLINE_DATA_START + datasize;
37}
38
7c8ede16
JB
39int btrfs_del_csums(struct btrfs_trans_handle *trans,
40 struct btrfs_root *root, u64 bytenr, u64 len);
4ae2edf1 41blk_status_t btrfs_lookup_bio_sums(struct btrfs_bio *bbio);
7c8ede16
JB
42int btrfs_insert_hole_extent(struct btrfs_trans_handle *trans,
43 struct btrfs_root *root, u64 objectid, u64 pos,
44 u64 num_bytes);
45int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
46 struct btrfs_root *root,
47 struct btrfs_path *path, u64 objectid,
48 u64 bytenr, int mod);
49int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
50 struct btrfs_root *root,
51 struct btrfs_ordered_sum *sums);
f8c44673 52blk_status_t btrfs_csum_one_bio(struct btrfs_bio *bbio);
cbfce4c7 53blk_status_t btrfs_alloc_dummy_sum(struct btrfs_bio *bbio);
f8c44673
CH
54int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
55 struct list_head *list, int search_commit,
56 bool nowait);
97e38239
QW
57int btrfs_lookup_csums_list(struct btrfs_root *root, u64 start, u64 end,
58 struct list_head *list, int search_commit,
59 bool nowait);
3c771c19
QW
60int btrfs_lookup_csums_bitmap(struct btrfs_root *root, struct btrfs_path *path,
61 u64 start, u64 end, u8 *csum_buf,
62 unsigned long *csum_bitmap);
7c8ede16
JB
63void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode,
64 const struct btrfs_path *path,
65 struct btrfs_file_extent_item *fi,
7c8ede16
JB
66 struct extent_map *em);
67int btrfs_inode_clear_file_extent_range(struct btrfs_inode *inode, u64 start,
68 u64 len);
69int btrfs_inode_set_file_extent_range(struct btrfs_inode *inode, u64 start, u64 len);
70void btrfs_inode_safe_disk_i_size_write(struct btrfs_inode *inode, u64 new_i_size);
71u64 btrfs_file_extent_end(const struct btrfs_path *path);
72
73#endif