* [PATCH] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
@ 2017-05-09 23:02 Liu Bo
2017-05-19 19:06 ` David Sterba
2017-05-26 23:44 ` [PATCH v2] " Liu Bo
0 siblings, 2 replies; 6+ messages in thread
From: Liu Bo @ 2017-05-09 23:02 UTC (permalink / raw)
To: linux-btrfs
Before this, we use 'filled' mode here, ie. if all range has been filled
with EXTENT_DEFRAG bits, get to clear it, but if the defrag range joins
the adjacent delalloc range, then we'll leave EXTENT_DEFRAG bits until
evicting inode.
This clears the bit if any was found within the ordered extent.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 78ab511..1293810 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2875,7 +2875,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
ret = test_range_bit(io_tree, ordered_extent->file_offset,
ordered_extent->file_offset + ordered_extent->len - 1,
- EXTENT_DEFRAG, 1, cached_state);
+ EXTENT_DEFRAG, 0, cached_state);
if (ret) {
u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item);
if (0 && last_snapshot >= BTRFS_I(inode)->generation)
--
2.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
2017-05-09 23:02 [PATCH] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io Liu Bo
@ 2017-05-19 19:06 ` David Sterba
2017-05-19 20:01 ` Liu Bo
2017-05-26 23:44 ` [PATCH v2] " Liu Bo
1 sibling, 1 reply; 6+ messages in thread
From: David Sterba @ 2017-05-19 19:06 UTC (permalink / raw)
To: Liu Bo; +Cc: linux-btrfs
On Tue, May 09, 2017 at 05:02:15PM -0600, Liu Bo wrote:
> Before this, we use 'filled' mode here, ie. if all range has been filled
> with EXTENT_DEFRAG bits, get to clear it, but if the defrag range joins
> the adjacent delalloc range, then we'll leave EXTENT_DEFRAG bits until
> evicting inode.
>
> This clears the bit if any was found within the ordered extent.
What effects, good or bad, can this have?
Is it worth backporting to stable trees?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
2017-05-19 19:06 ` David Sterba
@ 2017-05-19 20:01 ` Liu Bo
2017-05-25 17:11 ` David Sterba
0 siblings, 1 reply; 6+ messages in thread
From: Liu Bo @ 2017-05-19 20:01 UTC (permalink / raw)
To: dsterba, linux-btrfs
On Fri, May 19, 2017 at 09:06:42PM +0200, David Sterba wrote:
> On Tue, May 09, 2017 at 05:02:15PM -0600, Liu Bo wrote:
> > Before this, we use 'filled' mode here, ie. if all range has been filled
> > with EXTENT_DEFRAG bits, get to clear it, but if the defrag range joins
> > the adjacent delalloc range, then we'll leave EXTENT_DEFRAG bits until
> > evicting inode.
> >
> > This clears the bit if any was found within the ordered extent.
>
> What effects, good or bad, can this have?
>
> Is it worth backporting to stable trees?
The good effect of this patch is to free extent_state quickly if we
don't need it, without this, it can't be freed since the extent_state
has at least EXTENT_DEFRAG bit in ->state.
Just notice that I made a mistake in the changelog, the bit will be
cleared until releasing pages, which may be called by
invalidate_mapping_ranges(), not evicting inode.
No, I don't think it's a candidate for stable tree.
thanks,
-liubo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
2017-05-19 20:01 ` Liu Bo
@ 2017-05-25 17:11 ` David Sterba
0 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2017-05-25 17:11 UTC (permalink / raw)
To: Liu Bo; +Cc: linux-btrfs
On Fri, May 19, 2017 at 01:01:42PM -0700, Liu Bo wrote:
> On Fri, May 19, 2017 at 09:06:42PM +0200, David Sterba wrote:
> > On Tue, May 09, 2017 at 05:02:15PM -0600, Liu Bo wrote:
> > > Before this, we use 'filled' mode here, ie. if all range has been filled
> > > with EXTENT_DEFRAG bits, get to clear it, but if the defrag range joins
> > > the adjacent delalloc range, then we'll leave EXTENT_DEFRAG bits until
> > > evicting inode.
> > >
> > > This clears the bit if any was found within the ordered extent.
> >
> > What effects, good or bad, can this have?
> >
> > Is it worth backporting to stable trees?
>
> The good effect of this patch is to free extent_state quickly if we
> don't need it, without this, it can't be freed since the extent_state
> has at least EXTENT_DEFRAG bit in ->state.
>
> Just notice that I made a mistake in the changelog, the bit will be
> cleared until releasing pages, which may be called by
> invalidate_mapping_ranges(), not evicting inode.
>
> No, I don't think it's a candidate for stable tree.
Thanks for the answers. Please update the patch changelog and resend.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
2017-05-09 23:02 [PATCH] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io Liu Bo
2017-05-19 19:06 ` David Sterba
@ 2017-05-26 23:44 ` Liu Bo
2017-05-29 14:38 ` David Sterba
1 sibling, 1 reply; 6+ messages in thread
From: Liu Bo @ 2017-05-26 23:44 UTC (permalink / raw)
To: linux-btrfs
Before this, we use 'filled' mode here, ie. if all range has been
filled with EXTENT_DEFRAG bits, get to clear it, but if the defrag
range joins the adjacent delalloc range, then we'll have EXTENT_DEFRAG
bits in extent_state until releasing this inode's pages, and that
prevents extent_date from being freed.
This clears the bit if any was found within the ordered extent.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: Improve changelog.
fs/btrfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 78ab511..1293810 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2875,7 +2875,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
ret = test_range_bit(io_tree, ordered_extent->file_offset,
ordered_extent->file_offset + ordered_extent->len - 1,
- EXTENT_DEFRAG, 1, cached_state);
+ EXTENT_DEFRAG, 0, cached_state);
if (ret) {
u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item);
if (0 && last_snapshot >= BTRFS_I(inode)->generation)
--
2.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io
2017-05-26 23:44 ` [PATCH v2] " Liu Bo
@ 2017-05-29 14:38 ` David Sterba
0 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2017-05-29 14:38 UTC (permalink / raw)
To: Liu Bo; +Cc: linux-btrfs
On Fri, May 26, 2017 at 05:44:23PM -0600, Liu Bo wrote:
> Before this, we use 'filled' mode here, ie. if all range has been
> filled with EXTENT_DEFRAG bits, get to clear it, but if the defrag
> range joins the adjacent delalloc range, then we'll have EXTENT_DEFRAG
> bits in extent_state until releasing this inode's pages, and that
> prevents extent_date from being freed.
>
> This clears the bit if any was found within the ordered extent.
>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-29 14:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-09 23:02 [PATCH] Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io Liu Bo
2017-05-19 19:06 ` David Sterba
2017-05-19 20:01 ` Liu Bo
2017-05-25 17:11 ` David Sterba
2017-05-26 23:44 ` [PATCH v2] " Liu Bo
2017-05-29 14:38 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).