summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-06-17 12:54:50 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-06-25 12:36:42 +0200
commit12f20adf90b8cc10a9794556438293c1413808df (patch)
tree40f401ed85a5b7e814571eaeb4efd8812273498a /fs
parent32d714aeb0a2eb7c121b67038c5a86cb98d1372d (diff)
writeback: use spin_trylock() in bdi_writeback_all() for WB_SYNC_NONE
Not sure whether this is a good idea, hence it's at the back of the series as a separate patch. In theory it should be fine, since all WB_SYNC_NONE writeback is best-effort. No guarentees are made. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs-writeback.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index dfb4767d7ca4..e657d57e605f 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -471,9 +471,17 @@ void bdi_writeback_all(struct super_block *sb, struct writeback_control *wbc)
struct bdi_work *work;
LIST_HEAD(list);
-restart:
- spin_lock(&bdi_lock);
+ /*
+ * If this isn't a data integrity writeback, just drop it if
+ * someone is already holding the bdi_lock
+ */
+ if (!spin_trylock(&bdi_lock)) {
+ if (!must_wait)
+ return;
+ spin_lock(&bdi_lock);
+ }
+restart:
list_for_each_entry(bdi, &bdi_list, bdi_list) {
struct bdi_work *work;
@@ -500,6 +508,7 @@ restart:
__wbc = *wbc;
__wbc.bdi = bdi;
generic_sync_bdi_inodes(sb, &__wbc);
+ spin_lock(&bdi_lock);
goto restart;
}
if (must_wait)