diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-02 22:25:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-02 22:25:36 -0400 |
commit | 0e77a07ff9d18cdfc6c1fdd5b3c667ae79895489 (patch) | |
tree | 0b8b5a24f3c7081244b0a64625f6184733de43cf | |
parent | 23c0e4a2257051113a99e1377c49af224bd27bc8 (diff) | |
parent | 18ce3751ccd488c78d3827e9f6bf54e6322676fb (diff) |
Merge branch 'for-2.6.26' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.26' of git://git.kernel.dk/linux-2.6-block:
Properly notify block layer of sync writes
block: Fix the starving writes bug in the anticipatory IO scheduler
-rw-r--r-- | block/as-iosched.c | 2 | ||||
-rw-r--r-- | fs/buffer.c | 13 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
3 files changed, 11 insertions, 5 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c index 8c3946787dbb..743f33a01a07 100644 --- a/block/as-iosched.c +++ b/block/as-iosched.c | |||
@@ -831,6 +831,8 @@ static void as_completed_request(struct request_queue *q, struct request *rq) | |||
831 | } | 831 | } |
832 | 832 | ||
833 | if (ad->changed_batch && ad->nr_dispatched == 1) { | 833 | if (ad->changed_batch && ad->nr_dispatched == 1) { |
834 | ad->current_batch_expires = jiffies + | ||
835 | ad->batch_expire[ad->batch_data_dir]; | ||
834 | kblockd_schedule_work(&ad->antic_work); | 836 | kblockd_schedule_work(&ad->antic_work); |
835 | ad->changed_batch = 0; | 837 | ad->changed_batch = 0; |
836 | 838 | ||
diff --git a/fs/buffer.c b/fs/buffer.c index a073f3f4f013..0f51c0f7c266 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -821,7 +821,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list) | |||
821 | * contents - it is a noop if I/O is still in | 821 | * contents - it is a noop if I/O is still in |
822 | * flight on potentially older contents. | 822 | * flight on potentially older contents. |
823 | */ | 823 | */ |
824 | ll_rw_block(SWRITE, 1, &bh); | 824 | ll_rw_block(SWRITE_SYNC, 1, &bh); |
825 | brelse(bh); | 825 | brelse(bh); |
826 | spin_lock(lock); | 826 | spin_lock(lock); |
827 | } | 827 | } |
@@ -2940,16 +2940,19 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[]) | |||
2940 | for (i = 0; i < nr; i++) { | 2940 | for (i = 0; i < nr; i++) { |
2941 | struct buffer_head *bh = bhs[i]; | 2941 | struct buffer_head *bh = bhs[i]; |
2942 | 2942 | ||
2943 | if (rw == SWRITE) | 2943 | if (rw == SWRITE || rw == SWRITE_SYNC) |
2944 | lock_buffer(bh); | 2944 | lock_buffer(bh); |
2945 | else if (test_set_buffer_locked(bh)) | 2945 | else if (test_set_buffer_locked(bh)) |
2946 | continue; | 2946 | continue; |
2947 | 2947 | ||
2948 | if (rw == WRITE || rw == SWRITE) { | 2948 | if (rw == WRITE || rw == SWRITE || rw == SWRITE_SYNC) { |
2949 | if (test_clear_buffer_dirty(bh)) { | 2949 | if (test_clear_buffer_dirty(bh)) { |
2950 | bh->b_end_io = end_buffer_write_sync; | 2950 | bh->b_end_io = end_buffer_write_sync; |
2951 | get_bh(bh); | 2951 | get_bh(bh); |
2952 | submit_bh(WRITE, bh); | 2952 | if (rw == SWRITE_SYNC) |
2953 | submit_bh(WRITE_SYNC, bh); | ||
2954 | else | ||
2955 | submit_bh(WRITE, bh); | ||
2953 | continue; | 2956 | continue; |
2954 | } | 2957 | } |
2955 | } else { | 2958 | } else { |
@@ -2978,7 +2981,7 @@ int sync_dirty_buffer(struct buffer_head *bh) | |||
2978 | if (test_clear_buffer_dirty(bh)) { | 2981 | if (test_clear_buffer_dirty(bh)) { |
2979 | get_bh(bh); | 2982 | get_bh(bh); |
2980 | bh->b_end_io = end_buffer_write_sync; | 2983 | bh->b_end_io = end_buffer_write_sync; |
2981 | ret = submit_bh(WRITE, bh); | 2984 | ret = submit_bh(WRITE_SYNC, bh); |
2982 | wait_on_buffer(bh); | 2985 | wait_on_buffer(bh); |
2983 | if (buffer_eopnotsupp(bh)) { | 2986 | if (buffer_eopnotsupp(bh)) { |
2984 | clear_buffer_eopnotsupp(bh); | 2987 | clear_buffer_eopnotsupp(bh); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7c1080826832..d8e2762ed14d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -83,6 +83,7 @@ extern int dir_notify_enable; | |||
83 | #define READ_SYNC (READ | (1 << BIO_RW_SYNC)) | 83 | #define READ_SYNC (READ | (1 << BIO_RW_SYNC)) |
84 | #define READ_META (READ | (1 << BIO_RW_META)) | 84 | #define READ_META (READ | (1 << BIO_RW_META)) |
85 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) | 85 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) |
86 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) | ||
86 | #define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) | 87 | #define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) |
87 | 88 | ||
88 | #define SEL_IN 1 | 89 | #define SEL_IN 1 |