diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-09-17 01:09:07 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-09-17 11:37:15 -0400 |
commit | ff14f7886ed9adc133777d5cdba1e3101856f29a (patch) | |
tree | 828ef053e1ba60ee9df2d845facec16bc0ec34ca | |
parent | f8a958f04d309e868f5d3f910aa1fc185772596b (diff) |
bcachefs: compat code for pre 6.17
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/fs-io-buffered.c | 16 | ||||
-rw-r--r-- | fs/bcachefs/fs-io-buffered.h | 9 | ||||
-rw-r--r-- | fs/bcachefs/fs.c | 5 |
3 files changed, 28 insertions, 2 deletions
diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c index fe684adca370..4761af1f92f8 100644 --- a/fs/bcachefs/fs-io-buffered.c +++ b/fs/bcachefs/fs-io-buffered.c @@ -729,7 +729,13 @@ int bch2_writepages(struct address_space *mapping, struct writeback_control *wbc /* buffered writes: */ -int bch2_write_begin(const struct kiocb *iocb, struct address_space *mapping, +int bch2_write_begin( +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0) + const struct kiocb *iocb, +#else + struct file *file, +#endif + struct address_space *mapping, loff_t pos, unsigned len, struct folio **foliop, void **fsdata) { @@ -812,7 +818,13 @@ err_unlock: return bch2_err_class(ret); } -int bch2_write_end(const struct kiocb *iocb, struct address_space *mapping, +int bch2_write_end( +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0) + const struct kiocb *iocb, +#else + struct file *file, +#endif + struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct folio *folio, void *fsdata) { diff --git a/fs/bcachefs/fs-io-buffered.h b/fs/bcachefs/fs-io-buffered.h index 14de91c27656..89b7064dffe9 100644 --- a/fs/bcachefs/fs-io-buffered.h +++ b/fs/bcachefs/fs-io-buffered.h @@ -4,16 +4,25 @@ #ifndef NO_BCACHEFS_FS +#include <linux/version.h> + int bch2_read_single_folio(struct folio *, struct address_space *); int bch2_read_folio(struct file *, struct folio *); int bch2_writepages(struct address_space *, struct writeback_control *); void bch2_readahead(struct readahead_control *); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,17,0) int bch2_write_begin(const struct kiocb *, struct address_space *, loff_t pos, unsigned len, struct folio **, void **); int bch2_write_end(const struct kiocb *, struct address_space *, loff_t, unsigned len, unsigned copied, struct folio *, void *); +#else +int bch2_write_begin(struct file *, struct address_space *, loff_t pos, + unsigned len, struct folio **, void **); +int bch2_write_end(struct file *, struct address_space *, loff_t, + unsigned len, unsigned copied, struct folio *, void *); +#endif ssize_t bch2_write_iter(struct kiocb *, struct iov_iter *); diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index d6a2031e17e8..958849c30071 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -44,6 +44,7 @@ #include <linux/siphash.h> #include <linux/statfs.h> #include <linux/string.h> +#include <linux/version.h> #include <linux/xattr.h> static struct kmem_cache *bch2_inode_cache; @@ -1585,6 +1586,10 @@ static const __maybe_unused unsigned bch_flags_to_xflags[] = { [__BCH_INODE_noatime] = FS_XFLAG_NOATIME, }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,17,0) +#define file_kattr fileattr +#endif + static int bch2_fileattr_get(struct dentry *dentry, struct file_kattr *fa) { |