All of lore.kernel.org
 help / color / mirror / Atom feed
From: trix@redhat.com
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tom Rix <trix@redhat.com>
Subject: [PATCH] writeback: clear auto_free in initializaiton
Date: Tue, 18 Aug 2020 07:13:30 -0700	[thread overview]
Message-ID: <20200818141330.29134-1-trix@redhat.com> (raw)

From: Tom Rix <trix@redhat.com>

Review fs/fs-writeback.c bdi_split_work_to_wbs
The CONFIG_CGROUP_WRITEBACK version contains this line
	base_work->auto_free = 0;
Which seems like a strange place to set auto_free as
it is not where the rest of base_work is initialized.

In the default version of bdi_split_work_to_wbs, if a
successful malloc happens, base_work is copied and
auto_free is set to 1, else the base_work is
copied to another local valarible and its auto_free
is set to 0.

So move the clearing of auto_free to the
initialization of the local base_work structures.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 fs/fs-writeback.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index a605c3dddabc..fa1106de2ab0 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -881,7 +881,6 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
 		work = &fallback_work;
 		*work = *base_work;
 		work->nr_pages = nr_pages;
-		work->auto_free = 0;
 		work->done = &fallback_work_done;
 
 		wb_queue_work(wb, work);
@@ -1055,10 +1054,8 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
 {
 	might_sleep();
 
-	if (!skip_if_busy || !writeback_in_progress(&bdi->wb)) {
-		base_work->auto_free = 0;
+	if (!skip_if_busy || !writeback_in_progress(&bdi->wb))
 		wb_queue_work(&bdi->wb, base_work);
-	}
 }
 
 #endif	/* CONFIG_CGROUP_WRITEBACK */
@@ -2459,6 +2456,7 @@ static void __writeback_inodes_sb_nr(struct super_block *sb, unsigned long nr,
 		.done			= &done,
 		.nr_pages		= nr,
 		.reason			= reason,
+		.auto_free		= 0,
 	};
 
 	if (!bdi_has_dirty_io(bdi) || bdi == &noop_backing_dev_info)
@@ -2538,6 +2536,7 @@ void sync_inodes_sb(struct super_block *sb)
 		.done		= &done,
 		.reason		= WB_REASON_SYNC,
 		.for_sync	= 1,
+		.auto_free	= 0,
 	};
 
 	/*
-- 
2.18.1


             reply	other threads:[~2020-08-18 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 14:13 trix [this message]
2020-08-26 16:11 ` [PATCH] writeback: clear auto_free in initializaiton Jan Kara
2020-09-02 14:49   ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200818141330.29134-1-trix@redhat.com \
    --to=trix@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.