diff options
Diffstat (limited to 'drivers/md/dm-bufio.c')
-rw-r--r-- | drivers/md/dm-bufio.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index d724459860d9..ab472c557d18 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -615,16 +615,6 @@ static void write_endio(struct bio *bio, int error) | |||
615 | } | 615 | } |
616 | 616 | ||
617 | /* | 617 | /* |
618 | * This function is called when wait_on_bit is actually waiting. | ||
619 | */ | ||
620 | static int do_io_schedule(void *word) | ||
621 | { | ||
622 | io_schedule(); | ||
623 | |||
624 | return 0; | ||
625 | } | ||
626 | |||
627 | /* | ||
628 | * Initiate a write on a dirty buffer, but don't wait for it. | 618 | * Initiate a write on a dirty buffer, but don't wait for it. |
629 | * | 619 | * |
630 | * - If the buffer is not dirty, exit. | 620 | * - If the buffer is not dirty, exit. |
@@ -640,8 +630,7 @@ static void __write_dirty_buffer(struct dm_buffer *b, | |||
640 | return; | 630 | return; |
641 | 631 | ||
642 | clear_bit(B_DIRTY, &b->state); | 632 | clear_bit(B_DIRTY, &b->state); |
643 | wait_on_bit_lock(&b->state, B_WRITING, | 633 | wait_on_bit_lock_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE); |
644 | do_io_schedule, TASK_UNINTERRUPTIBLE); | ||
645 | 634 | ||
646 | if (!write_list) | 635 | if (!write_list) |
647 | submit_io(b, WRITE, b->block, write_endio); | 636 | submit_io(b, WRITE, b->block, write_endio); |
@@ -675,9 +664,9 @@ static void __make_buffer_clean(struct dm_buffer *b) | |||
675 | if (!b->state) /* fast case */ | 664 | if (!b->state) /* fast case */ |
676 | return; | 665 | return; |
677 | 666 | ||
678 | wait_on_bit(&b->state, B_READING, do_io_schedule, TASK_UNINTERRUPTIBLE); | 667 | wait_on_bit_io(&b->state, B_READING, TASK_UNINTERRUPTIBLE); |
679 | __write_dirty_buffer(b, NULL); | 668 | __write_dirty_buffer(b, NULL); |
680 | wait_on_bit(&b->state, B_WRITING, do_io_schedule, TASK_UNINTERRUPTIBLE); | 669 | wait_on_bit_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE); |
681 | } | 670 | } |
682 | 671 | ||
683 | /* | 672 | /* |
@@ -1030,7 +1019,7 @@ static void *new_read(struct dm_bufio_client *c, sector_t block, | |||
1030 | if (need_submit) | 1019 | if (need_submit) |
1031 | submit_io(b, READ, b->block, read_endio); | 1020 | submit_io(b, READ, b->block, read_endio); |
1032 | 1021 | ||
1033 | wait_on_bit(&b->state, B_READING, do_io_schedule, TASK_UNINTERRUPTIBLE); | 1022 | wait_on_bit_io(&b->state, B_READING, TASK_UNINTERRUPTIBLE); |
1034 | 1023 | ||
1035 | if (b->read_error) { | 1024 | if (b->read_error) { |
1036 | int error = b->read_error; | 1025 | int error = b->read_error; |
@@ -1209,15 +1198,13 @@ again: | |||
1209 | dropped_lock = 1; | 1198 | dropped_lock = 1; |
1210 | b->hold_count++; | 1199 | b->hold_count++; |
1211 | dm_bufio_unlock(c); | 1200 | dm_bufio_unlock(c); |
1212 | wait_on_bit(&b->state, B_WRITING, | 1201 | wait_on_bit_io(&b->state, B_WRITING, |
1213 | do_io_schedule, | 1202 | TASK_UNINTERRUPTIBLE); |
1214 | TASK_UNINTERRUPTIBLE); | ||
1215 | dm_bufio_lock(c); | 1203 | dm_bufio_lock(c); |
1216 | b->hold_count--; | 1204 | b->hold_count--; |
1217 | } else | 1205 | } else |
1218 | wait_on_bit(&b->state, B_WRITING, | 1206 | wait_on_bit_io(&b->state, B_WRITING, |
1219 | do_io_schedule, | 1207 | TASK_UNINTERRUPTIBLE); |
1220 | TASK_UNINTERRUPTIBLE); | ||
1221 | } | 1208 | } |
1222 | 1209 | ||
1223 | if (!test_bit(B_DIRTY, &b->state) && | 1210 | if (!test_bit(B_DIRTY, &b->state) && |
@@ -1321,15 +1308,15 @@ retry: | |||
1321 | 1308 | ||
1322 | __write_dirty_buffer(b, NULL); | 1309 | __write_dirty_buffer(b, NULL); |
1323 | if (b->hold_count == 1) { | 1310 | if (b->hold_count == 1) { |
1324 | wait_on_bit(&b->state, B_WRITING, | 1311 | wait_on_bit_io(&b->state, B_WRITING, |
1325 | do_io_schedule, TASK_UNINTERRUPTIBLE); | 1312 | TASK_UNINTERRUPTIBLE); |
1326 | set_bit(B_DIRTY, &b->state); | 1313 | set_bit(B_DIRTY, &b->state); |
1327 | __unlink_buffer(b); | 1314 | __unlink_buffer(b); |
1328 | __link_buffer(b, new_block, LIST_DIRTY); | 1315 | __link_buffer(b, new_block, LIST_DIRTY); |
1329 | } else { | 1316 | } else { |
1330 | sector_t old_block; | 1317 | sector_t old_block; |
1331 | wait_on_bit_lock(&b->state, B_WRITING, | 1318 | wait_on_bit_lock_io(&b->state, B_WRITING, |
1332 | do_io_schedule, TASK_UNINTERRUPTIBLE); | 1319 | TASK_UNINTERRUPTIBLE); |
1333 | /* | 1320 | /* |
1334 | * Relink buffer to "new_block" so that write_callback | 1321 | * Relink buffer to "new_block" so that write_callback |
1335 | * sees "new_block" as a block number. | 1322 | * sees "new_block" as a block number. |
@@ -1341,8 +1328,8 @@ retry: | |||
1341 | __unlink_buffer(b); | 1328 | __unlink_buffer(b); |
1342 | __link_buffer(b, new_block, b->list_mode); | 1329 | __link_buffer(b, new_block, b->list_mode); |
1343 | submit_io(b, WRITE, new_block, write_endio); | 1330 | submit_io(b, WRITE, new_block, write_endio); |
1344 | wait_on_bit(&b->state, B_WRITING, | 1331 | wait_on_bit_io(&b->state, B_WRITING, |
1345 | do_io_schedule, TASK_UNINTERRUPTIBLE); | 1332 | TASK_UNINTERRUPTIBLE); |
1346 | __unlink_buffer(b); | 1333 | __unlink_buffer(b); |
1347 | __link_buffer(b, old_block, b->list_mode); | 1334 | __link_buffer(b, old_block, b->list_mode); |
1348 | } | 1335 | } |