From: Christoph Hellwig <hch@infradead.org>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
chris.mason@oracle.com, david@fromorbit.com, hch@infradead.org,
tytso@mit.edu, akpm@linux-foundation.org, jack@suse.cz
Subject: Re: [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info
Date: Thu, 3 Sep 2009 22:56:09 -0400 [thread overview]
Message-ID: <20090904025609.GC3658@infradead.org> (raw)
In-Reply-To: <1251880967-1136-3-git-send-email-jens.axboe@oracle.com>
Clean bdi_start_writeback up a bit:
Index: linux-2.6/fs/fs-writeback.c
===================================================================
--- linux-2.6.orig/fs/fs-writeback.c 2009-09-03 23:50:12.880832607 -0300
+++ linux-2.6/fs/fs-writeback.c 2009-09-03 23:54:42.372832985 -0300
@@ -70,13 +70,6 @@ static inline void bdi_work_init(struct
work->state = WS_USED;
}
-static inline void bdi_work_init_on_stack(struct bdi_work *work,
- struct writeback_control *wbc)
-{
- bdi_work_init(work, wbc);
- work->state |= WS_ONSTACK;
-}
-
/**
* writeback_in_progress - determine whether there is writeback in progress
* @bdi: the device's backing_dev_info structure.
@@ -207,35 +200,26 @@ static struct bdi_work *bdi_alloc_work(s
void bdi_start_writeback(struct writeback_control *wbc)
{
- const bool must_wait = wbc->sync_mode == WB_SYNC_ALL;
- struct bdi_work work_stack, *work = NULL;
-
- if (!must_wait)
- work = bdi_alloc_work(wbc);
+ struct bdi_work work;
- if (!work) {
- work = &work_stack;
- bdi_work_init_on_stack(work, wbc);
+ if (wbc->sync_mode != WB_SYNC_ALL) {
+ struct bdi_work *w = bdi_alloc_work(wbc);
+ if (w) {
+ bdi_queue_work(wbc->bdi, w);
+ return;
+ }
}
- bdi_queue_work(wbc->bdi, work);
+ bdi_work_init(&work, wbc);
+ work.state |= WS_ONSTACK;
+ bdi_queue_work(wbc->bdi, &work);
/*
* If the sync mode is WB_SYNC_ALL, block waiting for the work to
- * complete. If not, we only need to wait for the work to be started,
- * if we allocated it on-stack. We use the same mechanism, if the
- * wait bit is set in the bdi_work struct, then threads will not
- * clear pending until after they are done.
- *
- * Note that work == &work_stack if must_wait is true, so we don't
- * need to do call_rcu() here ever, since the completion path will
- * have done that for us.
+ * complete.
*/
- if (must_wait || work == &work_stack) {
- bdi_wait_on_work_clear(work);
- if (work != &work_stack)
- call_rcu(&work->rcu_head, bdi_work_free);
- }
+ if (wbc->sync_mode == WB_SYNC_ALL)
+ bdi_wait_on_work_clear(&work);
}
/*
next prev parent reply other threads:[~2009-09-04 2:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-02 8:42 [PATCH 0/8] Per-bdi writeback flusher threads v17 Jens Axboe
2009-09-02 8:42 ` [PATCH 1/8] writeback: get rid of generic_sync_sb_inodes() export Jens Axboe
2009-09-02 10:13 ` Jan Kara
2009-09-02 10:26 ` Jens Axboe
2009-09-02 14:01 ` Jan Kara
2009-09-02 8:42 ` [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info Jens Axboe
2009-09-04 2:46 ` Christoph Hellwig
2009-09-04 2:50 ` Christoph Hellwig
2009-09-04 7:19 ` Jens Axboe
2009-09-04 2:56 ` Christoph Hellwig [this message]
2009-09-04 6:53 ` Jens Axboe
2009-09-04 15:43 ` Christoph Hellwig
2009-09-06 18:43 ` Jens Axboe
2009-09-08 18:44 ` Christoph Hellwig
2009-09-11 7:47 ` Jens Axboe
2009-09-02 8:42 ` [PATCH 3/8] writeback: switch to per-bdi threads for flushing data Jens Axboe
2009-09-02 8:42 ` [PATCH 4/8] writeback: get rid of pdflush completely Jens Axboe
2009-09-02 8:42 ` [PATCH 5/8] writeback: add some debug inode list counters to bdi stats Jens Axboe
2009-09-02 8:42 ` [PATCH 6/8] writeback: add name to backing_dev_info Jens Axboe
2009-09-02 8:42 ` [PATCH 7/8] writeback: check for registered bdi in flusher add and inode dirty Jens Axboe
2009-09-02 8:42 ` [PATCH 8/8] vm: Add an tuning knob for vm.max_writeback_pages Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2009-09-08 9:23 [PATCH 0/8] Per-bdi writeback flusher threads v19 Jens Axboe
2009-09-08 9:23 ` [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info Jens Axboe
2009-09-04 7:46 [PATCH 0/8] Per-bdi writeback flusher threads v18 Jens Axboe
2009-09-04 7:46 ` [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info Jens Axboe
2009-09-01 11:18 [PATCH 0/8] Per-bdi writeback flusher threads v16 Jens Axboe
2009-09-01 11:19 ` [PATCH 2/8] writeback: move dirty inodes from super_block to backing_dev_info Jens Axboe
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=20090904025609.GC3658@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=chris.mason@oracle.com \
--cc=david@fromorbit.com \
--cc=jack@suse.cz \
--cc=jens.axboe@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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.