• Tejun Heo's avatar
    writeback: restructure try_writeback_inodes_sb[_nr]() · f30a7d0c
    Tejun Heo authored
    try_writeback_inodes_sb_nr() wraps writeback_inodes_sb_nr() so that it
    handles s_umount locking and skips if writeback is already in
    progress.  The in progress test is performed on the root wb
    (bdi_writeback) which isn't sufficient for cgroup writeback support.
    The test must be done per-wb.
    
    To prepare for the change, this patch factors out
    __writeback_inodes_sb_nr() from writeback_inodes_sb_nr() and adds
    @skip_if_busy and moves the in progress test right before queueing the
    wb_writeback_work.  try_writeback_inodes_sb_nr() now just grabs
    s_umount and invokes __writeback_inodes_sb_nr() with asserted
    @skip_if_busy.  This way, later addition of multiple wb handling can
    skip only the wb's which already have writeback in progress.
    
    This swaps the order between in progress test and s_umount test which
    can flip the return value when writeback is in progress and s_umount
    is being held by someone else but this shouldn't cause any meaningful
    difference.  It's a fringe condition and the return value is an
    unsynchronized hint anyway.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Jan Kara <jack@suse.cz>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    f30a7d0c
fs-writeback.c 49.4 KB