* [PATCH] btrfs: Derive compression type from extent map during reads
@ 2022-04-26 13:46 Goldwyn Rodrigues
0 siblings, 0 replies; 5+ messages in thread
From: Goldwyn Rodrigues @ 2022-04-26 13:46 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dave Sterba
Derive the compression type from extent map as opposed to the bio flags
passed. This makes it more precise and not reliant on function
parameters.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 19bf36d8ffea..f14255cb4ed7 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -803,7 +803,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
* bio we were passed and then call the bio end_io calls
*/
blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
- int mirror_num, unsigned long bio_flags)
+ int mirror_num)
{
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
struct extent_map_tree *em_tree;
@@ -855,14 +855,14 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
em_len = em->len;
em_start = em->start;
- free_extent_map(em);
- em = NULL;
-
cb->len = bio->bi_iter.bi_size;
cb->compressed_len = compressed_len;
- cb->compress_type = extent_compress_type(bio_flags);
+ cb->compress_type = em->compress_type;
cb->orig_bio = bio;
+ free_extent_map(em);
+ em = NULL;
+
nr_pages = DIV_ROUND_UP(compressed_len, PAGE_SIZE);
cb->compressed_pages = kcalloc(nr_pages, sizeof(struct page *),
GFP_NOFS);
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index ac5b20731d2a..26d80df0b42e 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -103,7 +103,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
struct cgroup_subsys_state *blkcg_css,
bool writeback);
blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
- int mirror_num, unsigned long bio_flags);
+ int mirror_num);
unsigned int btrfs_compress_str2level(unsigned int type, const char *str);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5082b9c70f8c..4dfc02fbbad5 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2547,8 +2547,7 @@ blk_status_t btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
* here.
*/
ret = btrfs_submit_compressed_read(inode, bio,
- mirror_num,
- bio_flags);
+ mirror_num);
goto out_no_endio;
} else {
/*
--
Goldwyn
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] btrfs: Derive compression type from extent map during reads
@ 2022-04-26 13:47 Goldwyn Rodrigues
2022-04-27 9:06 ` Nikolay Borisov
2022-04-28 16:42 ` David Sterba
0 siblings, 2 replies; 5+ messages in thread
From: Goldwyn Rodrigues @ 2022-04-26 13:47 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dave Sterba
Derive the compression type from extent map as opposed to the bio flags
passed. This makes it more precise and not reliant on function
parameters.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 19bf36d8ffea..f14255cb4ed7 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -803,7 +803,7 @@ static noinline int add_ra_bio_pages(struct inode *inode,
* bio we were passed and then call the bio end_io calls
*/
blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
- int mirror_num, unsigned long bio_flags)
+ int mirror_num)
{
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
struct extent_map_tree *em_tree;
@@ -855,14 +855,14 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
em_len = em->len;
em_start = em->start;
- free_extent_map(em);
- em = NULL;
-
cb->len = bio->bi_iter.bi_size;
cb->compressed_len = compressed_len;
- cb->compress_type = extent_compress_type(bio_flags);
+ cb->compress_type = em->compress_type;
cb->orig_bio = bio;
+ free_extent_map(em);
+ em = NULL;
+
nr_pages = DIV_ROUND_UP(compressed_len, PAGE_SIZE);
cb->compressed_pages = kcalloc(nr_pages, sizeof(struct page *),
GFP_NOFS);
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index ac5b20731d2a..26d80df0b42e 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -103,7 +103,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
struct cgroup_subsys_state *blkcg_css,
bool writeback);
blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
- int mirror_num, unsigned long bio_flags);
+ int mirror_num);
unsigned int btrfs_compress_str2level(unsigned int type, const char *str);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5082b9c70f8c..4dfc02fbbad5 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2547,8 +2547,7 @@ blk_status_t btrfs_submit_data_bio(struct inode *inode, struct bio *bio,
* here.
*/
ret = btrfs_submit_compressed_read(inode, bio,
- mirror_num,
- bio_flags);
+ mirror_num);
goto out_no_endio;
} else {
/*
--
Goldwyn
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: Derive compression type from extent map during reads
2022-04-26 13:47 [PATCH] btrfs: Derive compression type from extent map during reads Goldwyn Rodrigues
@ 2022-04-27 9:06 ` Nikolay Borisov
2022-04-27 20:24 ` David Sterba
2022-04-28 16:42 ` David Sterba
1 sibling, 1 reply; 5+ messages in thread
From: Nikolay Borisov @ 2022-04-27 9:06 UTC (permalink / raw)
To: Goldwyn Rodrigues, linux-btrfs; +Cc: Dave Sterba
On 26.04.22 г. 16:47 ч., Goldwyn Rodrigues wrote:
> Derive the compression type from extent map as opposed to the bio flags
> passed. This makes it more precise and not reliant on function
> parameters.
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
This patch also makes extent_compress_type unused so it can be removed.
Also extent_set_compress_type also becomes redundant and can be removed.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
<snip>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: Derive compression type from extent map during reads
2022-04-27 9:06 ` Nikolay Borisov
@ 2022-04-27 20:24 ` David Sterba
0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2022-04-27 20:24 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: Goldwyn Rodrigues, linux-btrfs, Dave Sterba
On Wed, Apr 27, 2022 at 12:06:37PM +0300, Nikolay Borisov wrote:
>
>
> On 26.04.22 г. 16:47 ч., Goldwyn Rodrigues wrote:
> > Derive the compression type from extent map as opposed to the bio flags
> > passed. This makes it more precise and not reliant on function
> > parameters.
> >
> > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
>
> This patch also makes extent_compress_type unused so it can be removed.
> Also extent_set_compress_type also becomes redundant and can be removed.
I have a cleanup patch removing extent_set_compress_type so I'll rebase
it on top of that patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: Derive compression type from extent map during reads
2022-04-26 13:47 [PATCH] btrfs: Derive compression type from extent map during reads Goldwyn Rodrigues
2022-04-27 9:06 ` Nikolay Borisov
@ 2022-04-28 16:42 ` David Sterba
1 sibling, 0 replies; 5+ messages in thread
From: David Sterba @ 2022-04-28 16:42 UTC (permalink / raw)
To: Goldwyn Rodrigues; +Cc: linux-btrfs, Dave Sterba
On Tue, Apr 26, 2022 at 08:47:34AM -0500, Goldwyn Rodrigues wrote:
> Derive the compression type from extent map as opposed to the bio flags
> passed. This makes it more precise and not reliant on function
> parameters.
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-28 16:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-26 13:47 [PATCH] btrfs: Derive compression type from extent map during reads Goldwyn Rodrigues
2022-04-27 9:06 ` Nikolay Borisov
2022-04-27 20:24 ` David Sterba
2022-04-28 16:42 ` David Sterba
-- strict thread matches above, loose matches on Subject: below --
2022-04-26 13:46 Goldwyn Rodrigues
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox