* [PATCH] btrfs: extent_io read eb to dirty_metadata_bytes on ioerr
@ 2019-09-13 13:54 Dennis Zhou
2019-09-13 15:46 ` Filipe Manana
0 siblings, 1 reply; 3+ messages in thread
From: Dennis Zhou @ 2019-09-13 13:54 UTC (permalink / raw)
To: Chris Mason, Josef Bacik, David Sterba, Filipe Manana
Cc: kernel-team, linux-btrfs, Dennis Zhou
Before, if a eb failed to write out, we would end up triggering a
BUG_ON(). As of f4340622e0226 ("btrfs: extent_io: Move the BUG_ON() in
flush_write_bio() one level up"), we no longer BUG_ON(), so we should
make life consistent and add back the unwritten bytes to
dirty_metadata_bytes.
Signed-off-by: Dennis Zhou <dennis@kernel.org>
Cc: Filipe Manana <fdmanana@kernel.org>
---
fs/btrfs/extent_io.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 1ff438fd5bc2..b67133a23652 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3728,11 +3728,21 @@ static void end_extent_buffer_writeback(struct extent_buffer *eb)
static void set_btree_ioerr(struct page *page)
{
struct extent_buffer *eb = (struct extent_buffer *)page->private;
+ struct btrfs_fs_info *fs_info;
SetPageError(page);
if (test_and_set_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags))
return;
+ /*
+ * If we error out, we should add back the dirty_metadata_bytes
+ * to make it consistent.
+ */
+ fs_info = eb->fs_info;
+ percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
+ eb->len,
+ fs_info->dirty_metadata_batch);
+
/*
* If writeback for a btree extent that doesn't belong to a log tree
* failed, increment the counter transaction->eb_write_errors.
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: extent_io read eb to dirty_metadata_bytes on ioerr
2019-09-13 13:54 [PATCH] btrfs: extent_io read eb to dirty_metadata_bytes on ioerr Dennis Zhou
@ 2019-09-13 15:46 ` Filipe Manana
2019-09-23 15:05 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Filipe Manana @ 2019-09-13 15:46 UTC (permalink / raw)
To: Dennis Zhou
Cc: Chris Mason, Josef Bacik, David Sterba, kernel-team, linux-btrfs
On Fri, Sep 13, 2019 at 2:54 PM Dennis Zhou <dennis@kernel.org> wrote:
>
> Before, if a eb failed to write out, we would end up triggering a
> BUG_ON(). As of f4340622e0226 ("btrfs: extent_io: Move the BUG_ON() in
> flush_write_bio() one level up"), we no longer BUG_ON(), so we should
> make life consistent and add back the unwritten bytes to
> dirty_metadata_bytes.
>
> Signed-off-by: Dennis Zhou <dennis@kernel.org>
> Cc: Filipe Manana <fdmanana@kernel.org>
Looks good.
However I find the subject very confusing and misleading.
"extent_io read eb to dirty_metadata_bytes on ioerr"
That gives the idea of reading the eb (like from disk? or its content,
reading from its pages?), and the "to dirty_metadata_bytes" also find
it confusing.
Something like:
"btrfs: adjust dirty_metadata_bytes after writeback failure of extent buffer"
would make it clear and not confusing IMHO.
Perhaps it's something David can change when he picks the patch
(either to that or some other more clear subject).
Anyway, for the change itself,
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Thanks!
> ---
> fs/btrfs/extent_io.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 1ff438fd5bc2..b67133a23652 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -3728,11 +3728,21 @@ static void end_extent_buffer_writeback(struct extent_buffer *eb)
> static void set_btree_ioerr(struct page *page)
> {
> struct extent_buffer *eb = (struct extent_buffer *)page->private;
> + struct btrfs_fs_info *fs_info;
>
> SetPageError(page);
> if (test_and_set_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags))
> return;
>
> + /*
> + * If we error out, we should add back the dirty_metadata_bytes
> + * to make it consistent.
> + */
> + fs_info = eb->fs_info;
> + percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
> + eb->len,
> + fs_info->dirty_metadata_batch);
> +
> /*
> * If writeback for a btree extent that doesn't belong to a log tree
> * failed, increment the counter transaction->eb_write_errors.
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: extent_io read eb to dirty_metadata_bytes on ioerr
2019-09-13 15:46 ` Filipe Manana
@ 2019-09-23 15:05 ` David Sterba
0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2019-09-23 15:05 UTC (permalink / raw)
To: Filipe Manana
Cc: Dennis Zhou, Chris Mason, Josef Bacik, David Sterba, kernel-team,
linux-btrfs
On Fri, Sep 13, 2019 at 04:46:09PM +0100, Filipe Manana wrote:
> On Fri, Sep 13, 2019 at 2:54 PM Dennis Zhou <dennis@kernel.org> wrote:
> >
> > Before, if a eb failed to write out, we would end up triggering a
> > BUG_ON(). As of f4340622e0226 ("btrfs: extent_io: Move the BUG_ON() in
> > flush_write_bio() one level up"), we no longer BUG_ON(), so we should
> > make life consistent and add back the unwritten bytes to
> > dirty_metadata_bytes.
> >
> > Signed-off-by: Dennis Zhou <dennis@kernel.org>
> > Cc: Filipe Manana <fdmanana@kernel.org>
>
> Looks good.
> However I find the subject very confusing and misleading.
>
> "extent_io read eb to dirty_metadata_bytes on ioerr"
>
> That gives the idea of reading the eb (like from disk? or its content,
> reading from its pages?), and the "to dirty_metadata_bytes" also find
> it confusing.
> Something like:
>
> "btrfs: adjust dirty_metadata_bytes after writeback failure of extent buffer"
>
> would make it clear and not confusing IMHO.
> Perhaps it's something David can change when he picks the patch
> (either to that or some other more clear subject).
That's perfectly fine to suggest updates to subject or changelogs in
case you find them worth an improvement. Patch updated and queued for,
thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-23 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-13 13:54 [PATCH] btrfs: extent_io read eb to dirty_metadata_bytes on ioerr Dennis Zhou
2019-09-13 15:46 ` Filipe Manana
2019-09-23 15:05 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.