]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcache/fs-io.h
bcache in userspace; userspace fsck
[bcachefs-tools-debian] / libbcache / fs-io.h
1 #ifndef _BCACHE_FS_IO_H
2 #define _BCACHE_FS_IO_H
3
4 #include "buckets.h"
5 #include <linux/uio.h>
6
7 int bch_set_page_dirty(struct page *);
8
9 int bch_writepage(struct page *, struct writeback_control *);
10 int bch_readpage(struct file *, struct page *);
11
12 int bch_writepages(struct address_space *, struct writeback_control *);
13 int bch_readpages(struct file *, struct address_space *,
14                   struct list_head *, unsigned);
15
16 int bch_write_begin(struct file *, struct address_space *, loff_t,
17                     unsigned, unsigned, struct page **, void **);
18 int bch_write_end(struct file *, struct address_space *, loff_t,
19                   unsigned, unsigned, struct page *, void *);
20
21 ssize_t bch_direct_IO(struct kiocb *, struct iov_iter *);
22
23 ssize_t bch_write_iter(struct kiocb *, struct iov_iter *);
24
25 int bch_fsync(struct file *, loff_t, loff_t, int);
26
27 int bch_truncate(struct inode *, struct iattr *);
28 long bch_fallocate_dispatch(struct file *, int, loff_t, loff_t);
29
30 loff_t bch_llseek(struct file *, loff_t, int);
31
32 int bch_page_mkwrite(struct vm_area_struct *, struct vm_fault *);
33 void bch_invalidatepage(struct page *, unsigned int, unsigned int);
34 int bch_releasepage(struct page *, gfp_t);
35 int bch_migrate_page(struct address_space *, struct page *,
36                      struct page *, enum migrate_mode);
37
38 struct i_sectors_hook {
39         struct extent_insert_hook       hook;
40         s64                             sectors;
41         struct bch_inode_info           *ei;
42 };
43
44 struct bchfs_write_op {
45         struct bch_inode_info   *ei;
46         s64                     sectors_added;
47         bool                    is_dio;
48         u64                     new_i_size;
49         struct bch_write_op     op;
50 };
51
52 struct bch_writepage_io {
53         struct closure          cl;
54
55         struct bchfs_write_op   op;
56
57         /* must come last: */
58         struct bch_write_bio    bio;
59 };
60
61 extern struct bio_set *bch_writepage_bioset;
62
63 struct dio_write {
64         struct closure          cl;
65         struct kiocb            *req;
66         struct cache_set        *c;
67         long                    written;
68         long                    error;
69         loff_t                  offset;
70
71         struct disk_reservation res;
72
73         struct iovec            *iovec;
74         struct iovec            inline_vecs[UIO_FASTIOV];
75         struct iov_iter         iter;
76
77         struct mm_struct        *mm;
78
79         struct bchfs_write_op   iop;
80
81         /* must be last: */
82         struct bch_write_bio    bio;
83 };
84
85 extern struct bio_set *bch_dio_write_bioset;
86
87 struct dio_read {
88         struct closure          cl;
89         struct kiocb            *req;
90         long                    ret;
91         struct bch_read_bio     rbio;
92 };
93
94 extern struct bio_set *bch_dio_read_bioset;
95
96 #endif /* _BCACHE_FS_IO_H */