writeback: fix WB_SYNC_NONE writeback from umount
When umount calls sync_filesystem(), we first do a WB_SYNC_NONE writeback to kick off writeback of pending dirty inodes, then follow that up with a WB_SYNC_ALL to wait for it. Since umount already holds the sb s_umount mutex, WB_SYNC_NONE ends up doing nothing and all writeback happens as WB_SYNC_ALL. This can greatly slow down umount, since WB_SYNC_ALL writeback is a data integrity operation and thus a bigger hammer than simple WB_SYNC_NONE. For barrier aware file systems it's a lot slower. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
@@ -65,6 +65,15 @@ struct writeback_control {
|
||||
* so we use a single control to update them
|
||||
*/
|
||||
unsigned no_nrwrite_index_update:1;
|
||||
|
||||
/*
|
||||
* For WB_SYNC_ALL, the sb must always be pinned. For WB_SYNC_NONE,
|
||||
* the writeback code will pin the sb for the caller. However,
|
||||
* for eg umount, the caller does WB_SYNC_NONE but already has
|
||||
* the sb pinned. If the below is set, caller already has the
|
||||
* sb pinned.
|
||||
*/
|
||||
unsigned sb_pinned:1;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -73,6 +82,7 @@ struct writeback_control {
|
||||
struct bdi_writeback;
|
||||
int inode_wait(void *);
|
||||
void writeback_inodes_sb(struct super_block *);
|
||||
void writeback_inodes_sb_locked(struct super_block *);
|
||||
int writeback_inodes_sb_if_idle(struct super_block *);
|
||||
void sync_inodes_sb(struct super_block *);
|
||||
void writeback_inodes_wbc(struct writeback_control *wbc);
|
||||
|
Reference in New Issue
Block a user