summaryrefslogtreecommitdiff
path: root/fs/btrfs/compression.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2019-08-14 02:00:02 +0300
committerDavid Sterba <dsterba@suse.com>2022-03-14 15:13:51 +0300
commit7c0c7269f7b508ba6e4b063a9314d6bd1fb6db22 (patch)
tree97c42d1bcd553b2ef14e5b2494b4f303585e09b1 /fs/btrfs/compression.c
parent1881fba89bd5dcd364d2e1bf561912a90a11c21a (diff)
downloadlinux-7c0c7269f7b508ba6e4b063a9314d6bd1fb6db22.tar.xz
btrfs: add BTRFS_IOC_ENCODED_WRITE
The implementation resembles direct I/O: we have to flush any ordered extents, invalidate the page cache, and do the io tree/delalloc/extent map/ordered extent dance. From there, we can reuse the compression code with a minor modification to distinguish the write from writeback. This also creates inline extents when possible. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r--fs/btrfs/compression.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 8b3bca269de3..71d26b8a9396 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -383,7 +383,8 @@ static void finish_compressed_bio_write(struct compressed_bio *cb)
cb->start, cb->start + cb->len - 1,
!cb->errors);
- end_compressed_writeback(inode, cb);
+ if (cb->writeback)
+ end_compressed_writeback(inode, cb);
/* Note, our inode could be gone now */
/*
@@ -506,7 +507,8 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
struct page **compressed_pages,
unsigned int nr_pages,
unsigned int write_flags,
- struct cgroup_subsys_state *blkcg_css)
+ struct cgroup_subsys_state *blkcg_css,
+ bool writeback)
{
struct btrfs_fs_info *fs_info = inode->root->fs_info;
struct bio *bio = NULL;
@@ -531,6 +533,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
cb->mirror_num = 0;
cb->compressed_pages = compressed_pages;
cb->compressed_len = compressed_len;
+ cb->writeback = writeback;
cb->orig_bio = NULL;
cb->nr_pages = nr_pages;