• J
    mm: fix writeback_in_progress() · 81d73a32
    Jan Kara 提交于
    Commit 83ba7b07 ("writeback: simplify the write back thread queue")
    broke writeback_in_progress() as in that commit we started to remove work
    items from the list at the moment we start working on them and not at the
    moment they are finished.  Thus if the flusher thread was doing some work
    but there was no other work queued, writeback_in_progress() returned
    false.  This could in particular cause unnecessary queueing of background
    writeback from balance_dirty_pages() or writeout work from
    writeback_sb_if_idle().
    
    This patch fixes the problem by introducing a bit in the bdi state which
    indicates that the flusher thread is processing some work and uses this
    bit for writeback_in_progress() test.
    
    NOTE: Both callsites of writeback_in_progress() (namely,
    writeback_inodes_sb_if_idle() and balance_dirty_pages()) would actually
    need a different information than what writeback_in_progress() provides.
    They would need to know whether *the kind of writeback they are going to
    submit* is already queued.  But this information isn't that simple to
    provide so let's fix writeback_in_progress() for the time being.
    Signed-off-by: NJan Kara <jack@suse.cz>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Wu Fengguang <fengguang.wu@intel.com>
    Acked-by: NJens Axboe <jaxboe@fusionio.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    81d73a32
fs-writeback.c 30.9 KB