diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-10 17:29:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-10 17:29:58 -0400 |
commit | 69ca06c9454169c4a9303e8834adae9080f94859 (patch) | |
tree | d713fe8ac3ada06c0989706e237f6e6176396347 | |
parent | 9f2d8be4266f8861af806d964ae5db2949b670f3 (diff) | |
parent | 32f2e807a3938b24d0831211e6094f9e44b2fc83 (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
cfq-iosched: reset oom_cfqq in cfq_set_request()
block: fix sg SG_DXFER_TO_FROM_DEV regression
block: call blk_scsi_ioctl_init()
Fix congestion_wait() sync/async vs read/write confusion
-rw-r--r-- | arch/x86/lib/usercopy_32.c | 2 | ||||
-rw-r--r-- | block/cfq-iosched.c | 2 | ||||
-rw-r--r-- | block/scsi_ioctl.c | 1 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 10 | ||||
-rw-r--r-- | drivers/md/dm-crypt.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sg.c | 4 | ||||
-rw-r--r-- | fs/bio.c | 22 | ||||
-rw-r--r-- | fs/fat/file.c | 2 | ||||
-rw-r--r-- | fs/fuse/dev.c | 8 | ||||
-rw-r--r-- | fs/nfs/write.c | 8 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.c | 4 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 2 | ||||
-rw-r--r-- | include/linux/backing-dev.h | 6 | ||||
-rw-r--r-- | include/linux/blkdev.h | 9 | ||||
-rw-r--r-- | mm/backing-dev.c | 7 | ||||
-rw-r--r-- | mm/memcontrol.c | 2 | ||||
-rw-r--r-- | mm/page-writeback.c | 8 | ||||
-rw-r--r-- | mm/page_alloc.c | 4 | ||||
-rw-r--r-- | mm/vmscan.c | 8 |
20 files changed, 62 insertions, 51 deletions
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index 7c8ca91bb9ec..1f118d462acc 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -751,7 +751,7 @@ survive: | |||
751 | 751 | ||
752 | if (retval == -ENOMEM && is_global_init(current)) { | 752 | if (retval == -ENOMEM && is_global_init(current)) { |
753 | up_read(¤t->mm->mmap_sem); | 753 | up_read(¤t->mm->mmap_sem); |
754 | congestion_wait(WRITE, HZ/50); | 754 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
755 | goto survive; | 755 | goto survive; |
756 | } | 756 | } |
757 | 757 | ||
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 87276eb83f7f..fd7080ed7935 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -2311,7 +2311,7 @@ cfq_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask) | |||
2311 | goto queue_fail; | 2311 | goto queue_fail; |
2312 | 2312 | ||
2313 | cfqq = cic_to_cfqq(cic, is_sync); | 2313 | cfqq = cic_to_cfqq(cic, is_sync); |
2314 | if (!cfqq) { | 2314 | if (!cfqq || cfqq == &cfqd->oom_cfqq) { |
2315 | cfqq = cfq_get_queue(cfqd, is_sync, cic->ioc, gfp_mask); | 2315 | cfqq = cfq_get_queue(cfqd, is_sync, cic->ioc, gfp_mask); |
2316 | cic_set_cfqq(cic, cfqq, is_sync); | 2316 | cic_set_cfqq(cic, cfqq, is_sync); |
2317 | } | 2317 | } |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index f0e0ce0a607d..e5b10017a50b 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -680,3 +680,4 @@ int __init blk_scsi_ioctl_init(void) | |||
680 | blk_set_cmd_filter_defaults(&blk_default_cmd_filter); | 680 | blk_set_cmd_filter_defaults(&blk_default_cmd_filter); |
681 | return 0; | 681 | return 0; |
682 | } | 682 | } |
683 | fs_initcall(blk_scsi_ioctl_init); | ||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 83650e00632d..99a506f619b7 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -1372,8 +1372,10 @@ try_next_bio: | |||
1372 | wakeup = (pd->write_congestion_on > 0 | 1372 | wakeup = (pd->write_congestion_on > 0 |
1373 | && pd->bio_queue_size <= pd->write_congestion_off); | 1373 | && pd->bio_queue_size <= pd->write_congestion_off); |
1374 | spin_unlock(&pd->lock); | 1374 | spin_unlock(&pd->lock); |
1375 | if (wakeup) | 1375 | if (wakeup) { |
1376 | clear_bdi_congested(&pd->disk->queue->backing_dev_info, WRITE); | 1376 | clear_bdi_congested(&pd->disk->queue->backing_dev_info, |
1377 | BLK_RW_ASYNC); | ||
1378 | } | ||
1377 | 1379 | ||
1378 | pkt->sleep_time = max(PACKET_WAIT_TIME, 1); | 1380 | pkt->sleep_time = max(PACKET_WAIT_TIME, 1); |
1379 | pkt_set_state(pkt, PACKET_WAITING_STATE); | 1381 | pkt_set_state(pkt, PACKET_WAITING_STATE); |
@@ -2592,10 +2594,10 @@ static int pkt_make_request(struct request_queue *q, struct bio *bio) | |||
2592 | spin_lock(&pd->lock); | 2594 | spin_lock(&pd->lock); |
2593 | if (pd->write_congestion_on > 0 | 2595 | if (pd->write_congestion_on > 0 |
2594 | && pd->bio_queue_size >= pd->write_congestion_on) { | 2596 | && pd->bio_queue_size >= pd->write_congestion_on) { |
2595 | set_bdi_congested(&q->backing_dev_info, WRITE); | 2597 | set_bdi_congested(&q->backing_dev_info, BLK_RW_ASYNC); |
2596 | do { | 2598 | do { |
2597 | spin_unlock(&pd->lock); | 2599 | spin_unlock(&pd->lock); |
2598 | congestion_wait(WRITE, HZ); | 2600 | congestion_wait(BLK_RW_ASYNC, HZ); |
2599 | spin_lock(&pd->lock); | 2601 | spin_lock(&pd->lock); |
2600 | } while(pd->bio_queue_size > pd->write_congestion_off); | 2602 | } while(pd->bio_queue_size > pd->write_congestion_off); |
2601 | } | 2603 | } |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 9933eb861c71..529e2ba505c3 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -776,7 +776,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | |||
776 | * But don't wait if split was due to the io size restriction | 776 | * But don't wait if split was due to the io size restriction |
777 | */ | 777 | */ |
778 | if (unlikely(out_of_pages)) | 778 | if (unlikely(out_of_pages)) |
779 | congestion_wait(WRITE, HZ/100); | 779 | congestion_wait(BLK_RW_ASYNC, HZ/100); |
780 | 780 | ||
781 | /* | 781 | /* |
782 | * With async crypto it is unsafe to share the crypto context | 782 | * With async crypto it is unsafe to share the crypto context |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 4d6f2fe1cfe9..9230402c45af 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1656,6 +1656,10 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd) | |||
1656 | md->nr_entries = req_schp->k_use_sg; | 1656 | md->nr_entries = req_schp->k_use_sg; |
1657 | md->offset = 0; | 1657 | md->offset = 0; |
1658 | md->null_mapped = hp->dxferp ? 0 : 1; | 1658 | md->null_mapped = hp->dxferp ? 0 : 1; |
1659 | if (dxfer_dir == SG_DXFER_TO_FROM_DEV) | ||
1660 | md->from_user = 1; | ||
1661 | else | ||
1662 | md->from_user = 0; | ||
1659 | } | 1663 | } |
1660 | 1664 | ||
1661 | if (iov_count) { | 1665 | if (iov_count) { |
@@ -705,14 +705,13 @@ static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, | |||
705 | } | 705 | } |
706 | 706 | ||
707 | static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs, | 707 | static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs, |
708 | struct sg_iovec *iov, int iov_count, int uncopy, | 708 | struct sg_iovec *iov, int iov_count, |
709 | int do_free_page) | 709 | int to_user, int from_user, int do_free_page) |
710 | { | 710 | { |
711 | int ret = 0, i; | 711 | int ret = 0, i; |
712 | struct bio_vec *bvec; | 712 | struct bio_vec *bvec; |
713 | int iov_idx = 0; | 713 | int iov_idx = 0; |
714 | unsigned int iov_off = 0; | 714 | unsigned int iov_off = 0; |
715 | int read = bio_data_dir(bio) == READ; | ||
716 | 715 | ||
717 | __bio_for_each_segment(bvec, bio, i, 0) { | 716 | __bio_for_each_segment(bvec, bio, i, 0) { |
718 | char *bv_addr = page_address(bvec->bv_page); | 717 | char *bv_addr = page_address(bvec->bv_page); |
@@ -727,13 +726,14 @@ static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs, | |||
727 | iov_addr = iov[iov_idx].iov_base + iov_off; | 726 | iov_addr = iov[iov_idx].iov_base + iov_off; |
728 | 727 | ||
729 | if (!ret) { | 728 | if (!ret) { |
730 | if (!read && !uncopy) | 729 | if (to_user) |
731 | ret = copy_from_user(bv_addr, iov_addr, | ||
732 | bytes); | ||
733 | if (read && uncopy) | ||
734 | ret = copy_to_user(iov_addr, bv_addr, | 730 | ret = copy_to_user(iov_addr, bv_addr, |
735 | bytes); | 731 | bytes); |
736 | 732 | ||
733 | if (from_user) | ||
734 | ret = copy_from_user(bv_addr, iov_addr, | ||
735 | bytes); | ||
736 | |||
737 | if (ret) | 737 | if (ret) |
738 | ret = -EFAULT; | 738 | ret = -EFAULT; |
739 | } | 739 | } |
@@ -770,7 +770,8 @@ int bio_uncopy_user(struct bio *bio) | |||
770 | 770 | ||
771 | if (!bio_flagged(bio, BIO_NULL_MAPPED)) | 771 | if (!bio_flagged(bio, BIO_NULL_MAPPED)) |
772 | ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs, | 772 | ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs, |
773 | bmd->nr_sgvecs, 1, bmd->is_our_pages); | 773 | bmd->nr_sgvecs, bio_data_dir(bio) == READ, |
774 | 0, bmd->is_our_pages); | ||
774 | bio_free_map_data(bmd); | 775 | bio_free_map_data(bmd); |
775 | bio_put(bio); | 776 | bio_put(bio); |
776 | return ret; | 777 | return ret; |
@@ -875,8 +876,9 @@ struct bio *bio_copy_user_iov(struct request_queue *q, | |||
875 | /* | 876 | /* |
876 | * success | 877 | * success |
877 | */ | 878 | */ |
878 | if (!write_to_vm && (!map_data || !map_data->null_mapped)) { | 879 | if ((!write_to_vm && (!map_data || !map_data->null_mapped)) || |
879 | ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 0); | 880 | (map_data && map_data->from_user)) { |
881 | ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 1, 0); | ||
880 | if (ret) | 882 | if (ret) |
881 | goto cleanup; | 883 | goto cleanup; |
882 | } | 884 | } |
diff --git a/fs/fat/file.c b/fs/fat/file.c index b28ea646ff60..f042b965c95c 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -134,7 +134,7 @@ static int fat_file_release(struct inode *inode, struct file *filp) | |||
134 | if ((filp->f_mode & FMODE_WRITE) && | 134 | if ((filp->f_mode & FMODE_WRITE) && |
135 | MSDOS_SB(inode->i_sb)->options.flush) { | 135 | MSDOS_SB(inode->i_sb)->options.flush) { |
136 | fat_flush_inodes(inode->i_sb, inode, NULL); | 136 | fat_flush_inodes(inode->i_sb, inode, NULL); |
137 | congestion_wait(WRITE, HZ/10); | 137 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
138 | } | 138 | } |
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index f58ecbc416c8..6484eb75acd6 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -286,8 +286,8 @@ __releases(&fc->lock) | |||
286 | } | 286 | } |
287 | if (fc->num_background == FUSE_CONGESTION_THRESHOLD && | 287 | if (fc->num_background == FUSE_CONGESTION_THRESHOLD && |
288 | fc->connected && fc->bdi_initialized) { | 288 | fc->connected && fc->bdi_initialized) { |
289 | clear_bdi_congested(&fc->bdi, READ); | 289 | clear_bdi_congested(&fc->bdi, BLK_RW_SYNC); |
290 | clear_bdi_congested(&fc->bdi, WRITE); | 290 | clear_bdi_congested(&fc->bdi, BLK_RW_ASYNC); |
291 | } | 291 | } |
292 | fc->num_background--; | 292 | fc->num_background--; |
293 | fc->active_background--; | 293 | fc->active_background--; |
@@ -414,8 +414,8 @@ static void fuse_request_send_nowait_locked(struct fuse_conn *fc, | |||
414 | fc->blocked = 1; | 414 | fc->blocked = 1; |
415 | if (fc->num_background == FUSE_CONGESTION_THRESHOLD && | 415 | if (fc->num_background == FUSE_CONGESTION_THRESHOLD && |
416 | fc->bdi_initialized) { | 416 | fc->bdi_initialized) { |
417 | set_bdi_congested(&fc->bdi, READ); | 417 | set_bdi_congested(&fc->bdi, BLK_RW_SYNC); |
418 | set_bdi_congested(&fc->bdi, WRITE); | 418 | set_bdi_congested(&fc->bdi, BLK_RW_ASYNC); |
419 | } | 419 | } |
420 | list_add_tail(&req->list, &fc->bg_queue); | 420 | list_add_tail(&req->list, &fc->bg_queue); |
421 | flush_bg_queue(fc); | 421 | flush_bg_queue(fc); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index ce728829f79a..0a0a2ff767c3 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -202,8 +202,10 @@ static int nfs_set_page_writeback(struct page *page) | |||
202 | struct nfs_server *nfss = NFS_SERVER(inode); | 202 | struct nfs_server *nfss = NFS_SERVER(inode); |
203 | 203 | ||
204 | if (atomic_long_inc_return(&nfss->writeback) > | 204 | if (atomic_long_inc_return(&nfss->writeback) > |
205 | NFS_CONGESTION_ON_THRESH) | 205 | NFS_CONGESTION_ON_THRESH) { |
206 | set_bdi_congested(&nfss->backing_dev_info, WRITE); | 206 | set_bdi_congested(&nfss->backing_dev_info, |
207 | BLK_RW_ASYNC); | ||
208 | } | ||
207 | } | 209 | } |
208 | return ret; | 210 | return ret; |
209 | } | 211 | } |
@@ -215,7 +217,7 @@ static void nfs_end_page_writeback(struct page *page) | |||
215 | 217 | ||
216 | end_page_writeback(page); | 218 | end_page_writeback(page); |
217 | if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) | 219 | if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) |
218 | clear_bdi_congested(&nfss->backing_dev_info, WRITE); | 220 | clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC); |
219 | } | 221 | } |
220 | 222 | ||
221 | /* | 223 | /* |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 77f5bb746bf0..90622200b39c 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -997,7 +997,7 @@ static int reiserfs_async_progress_wait(struct super_block *s) | |||
997 | DEFINE_WAIT(wait); | 997 | DEFINE_WAIT(wait); |
998 | struct reiserfs_journal *j = SB_JOURNAL(s); | 998 | struct reiserfs_journal *j = SB_JOURNAL(s); |
999 | if (atomic_read(&j->j_async_throttle)) | 999 | if (atomic_read(&j->j_async_throttle)) |
1000 | congestion_wait(WRITE, HZ / 10); | 1000 | congestion_wait(BLK_RW_ASYNC, HZ / 10); |
1001 | return 0; | 1001 | return 0; |
1002 | } | 1002 | } |
1003 | 1003 | ||
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index 1cd3b55ee3d2..2d3f90afe5f1 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -53,7 +53,7 @@ kmem_alloc(size_t size, unsigned int __nocast flags) | |||
53 | printk(KERN_ERR "XFS: possible memory allocation " | 53 | printk(KERN_ERR "XFS: possible memory allocation " |
54 | "deadlock in %s (mode:0x%x)\n", | 54 | "deadlock in %s (mode:0x%x)\n", |
55 | __func__, lflags); | 55 | __func__, lflags); |
56 | congestion_wait(WRITE, HZ/50); | 56 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
57 | } while (1); | 57 | } while (1); |
58 | } | 58 | } |
59 | 59 | ||
@@ -130,7 +130,7 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags) | |||
130 | printk(KERN_ERR "XFS: possible memory allocation " | 130 | printk(KERN_ERR "XFS: possible memory allocation " |
131 | "deadlock in %s (mode:0x%x)\n", | 131 | "deadlock in %s (mode:0x%x)\n", |
132 | __func__, lflags); | 132 | __func__, lflags); |
133 | congestion_wait(WRITE, HZ/50); | 133 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
134 | } while (1); | 134 | } while (1); |
135 | } | 135 | } |
136 | 136 | ||
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 1418b916fc27..0c93c7ef3d18 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -412,7 +412,7 @@ _xfs_buf_lookup_pages( | |||
412 | 412 | ||
413 | XFS_STATS_INC(xb_page_retries); | 413 | XFS_STATS_INC(xb_page_retries); |
414 | xfsbufd_wakeup(0, gfp_mask); | 414 | xfsbufd_wakeup(0, gfp_mask); |
415 | congestion_wait(WRITE, HZ/50); | 415 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
416 | goto retry; | 416 | goto retry; |
417 | } | 417 | } |
418 | 418 | ||
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 0ec2c594868e..3a52a63c1351 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -229,9 +229,9 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi) | |||
229 | (1 << BDI_async_congested)); | 229 | (1 << BDI_async_congested)); |
230 | } | 230 | } |
231 | 231 | ||
232 | void clear_bdi_congested(struct backing_dev_info *bdi, int rw); | 232 | void clear_bdi_congested(struct backing_dev_info *bdi, int sync); |
233 | void set_bdi_congested(struct backing_dev_info *bdi, int rw); | 233 | void set_bdi_congested(struct backing_dev_info *bdi, int sync); |
234 | long congestion_wait(int rw, long timeout); | 234 | long congestion_wait(int sync, long timeout); |
235 | 235 | ||
236 | 236 | ||
237 | static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) | 237 | static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 49ae07951d55..0146e0fecf1a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -723,6 +723,7 @@ struct rq_map_data { | |||
723 | int nr_entries; | 723 | int nr_entries; |
724 | unsigned long offset; | 724 | unsigned long offset; |
725 | int null_mapped; | 725 | int null_mapped; |
726 | int from_user; | ||
726 | }; | 727 | }; |
727 | 728 | ||
728 | struct req_iterator { | 729 | struct req_iterator { |
@@ -779,18 +780,18 @@ extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, | |||
779 | * congested queues, and wake up anyone who was waiting for requests to be | 780 | * congested queues, and wake up anyone who was waiting for requests to be |
780 | * put back. | 781 | * put back. |
781 | */ | 782 | */ |
782 | static inline void blk_clear_queue_congested(struct request_queue *q, int rw) | 783 | static inline void blk_clear_queue_congested(struct request_queue *q, int sync) |
783 | { | 784 | { |
784 | clear_bdi_congested(&q->backing_dev_info, rw); | 785 | clear_bdi_congested(&q->backing_dev_info, sync); |
785 | } | 786 | } |
786 | 787 | ||
787 | /* | 788 | /* |
788 | * A queue has just entered congestion. Flag that in the queue's VM-visible | 789 | * A queue has just entered congestion. Flag that in the queue's VM-visible |
789 | * state flags and increment the global gounter of congested queues. | 790 | * state flags and increment the global gounter of congested queues. |
790 | */ | 791 | */ |
791 | static inline void blk_set_queue_congested(struct request_queue *q, int rw) | 792 | static inline void blk_set_queue_congested(struct request_queue *q, int sync) |
792 | { | 793 | { |
793 | set_bdi_congested(&q->backing_dev_info, rw); | 794 | set_bdi_congested(&q->backing_dev_info, sync); |
794 | } | 795 | } |
795 | 796 | ||
796 | extern void blk_start_queue(struct request_queue *q); | 797 | extern void blk_start_queue(struct request_queue *q); |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 493b468a5035..c86edd244294 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -283,7 +283,6 @@ static wait_queue_head_t congestion_wqh[2] = { | |||
283 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) | 283 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) |
284 | }; | 284 | }; |
285 | 285 | ||
286 | |||
287 | void clear_bdi_congested(struct backing_dev_info *bdi, int sync) | 286 | void clear_bdi_congested(struct backing_dev_info *bdi, int sync) |
288 | { | 287 | { |
289 | enum bdi_state bit; | 288 | enum bdi_state bit; |
@@ -308,18 +307,18 @@ EXPORT_SYMBOL(set_bdi_congested); | |||
308 | 307 | ||
309 | /** | 308 | /** |
310 | * congestion_wait - wait for a backing_dev to become uncongested | 309 | * congestion_wait - wait for a backing_dev to become uncongested |
311 | * @rw: READ or WRITE | 310 | * @sync: SYNC or ASYNC IO |
312 | * @timeout: timeout in jiffies | 311 | * @timeout: timeout in jiffies |
313 | * | 312 | * |
314 | * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit | 313 | * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit |
315 | * write congestion. If no backing_devs are congested then just wait for the | 314 | * write congestion. If no backing_devs are congested then just wait for the |
316 | * next write to be completed. | 315 | * next write to be completed. |
317 | */ | 316 | */ |
318 | long congestion_wait(int rw, long timeout) | 317 | long congestion_wait(int sync, long timeout) |
319 | { | 318 | { |
320 | long ret; | 319 | long ret; |
321 | DEFINE_WAIT(wait); | 320 | DEFINE_WAIT(wait); |
322 | wait_queue_head_t *wqh = &congestion_wqh[rw]; | 321 | wait_queue_head_t *wqh = &congestion_wqh[sync]; |
323 | 322 | ||
324 | prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); | 323 | prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); |
325 | ret = io_schedule_timeout(timeout); | 324 | ret = io_schedule_timeout(timeout); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e2fa20dadf40..e717964cb5a0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1973,7 +1973,7 @@ try_to_free: | |||
1973 | if (!progress) { | 1973 | if (!progress) { |
1974 | nr_retries--; | 1974 | nr_retries--; |
1975 | /* maybe some writeback is necessary */ | 1975 | /* maybe some writeback is necessary */ |
1976 | congestion_wait(WRITE, HZ/10); | 1976 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1977 | } | 1977 | } |
1978 | 1978 | ||
1979 | } | 1979 | } |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 7687879253b9..81627ebcd313 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -575,7 +575,7 @@ static void balance_dirty_pages(struct address_space *mapping) | |||
575 | if (pages_written >= write_chunk) | 575 | if (pages_written >= write_chunk) |
576 | break; /* We've done our duty */ | 576 | break; /* We've done our duty */ |
577 | 577 | ||
578 | congestion_wait(WRITE, HZ/10); | 578 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
579 | } | 579 | } |
580 | 580 | ||
581 | if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh && | 581 | if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh && |
@@ -669,7 +669,7 @@ void throttle_vm_writeout(gfp_t gfp_mask) | |||
669 | if (global_page_state(NR_UNSTABLE_NFS) + | 669 | if (global_page_state(NR_UNSTABLE_NFS) + |
670 | global_page_state(NR_WRITEBACK) <= dirty_thresh) | 670 | global_page_state(NR_WRITEBACK) <= dirty_thresh) |
671 | break; | 671 | break; |
672 | congestion_wait(WRITE, HZ/10); | 672 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
673 | 673 | ||
674 | /* | 674 | /* |
675 | * The caller might hold locks which can prevent IO completion | 675 | * The caller might hold locks which can prevent IO completion |
@@ -715,7 +715,7 @@ static void background_writeout(unsigned long _min_pages) | |||
715 | if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { | 715 | if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { |
716 | /* Wrote less than expected */ | 716 | /* Wrote less than expected */ |
717 | if (wbc.encountered_congestion || wbc.more_io) | 717 | if (wbc.encountered_congestion || wbc.more_io) |
718 | congestion_wait(WRITE, HZ/10); | 718 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
719 | else | 719 | else |
720 | break; | 720 | break; |
721 | } | 721 | } |
@@ -787,7 +787,7 @@ static void wb_kupdate(unsigned long arg) | |||
787 | writeback_inodes(&wbc); | 787 | writeback_inodes(&wbc); |
788 | if (wbc.nr_to_write > 0) { | 788 | if (wbc.nr_to_write > 0) { |
789 | if (wbc.encountered_congestion || wbc.more_io) | 789 | if (wbc.encountered_congestion || wbc.more_io) |
790 | congestion_wait(WRITE, HZ/10); | 790 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
791 | else | 791 | else |
792 | break; /* All the old data is written */ | 792 | break; /* All the old data is written */ |
793 | } | 793 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ad7cd1c56b07..a35eeab2724c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1666,7 +1666,7 @@ __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order, | |||
1666 | preferred_zone, migratetype); | 1666 | preferred_zone, migratetype); |
1667 | 1667 | ||
1668 | if (!page && gfp_mask & __GFP_NOFAIL) | 1668 | if (!page && gfp_mask & __GFP_NOFAIL) |
1669 | congestion_wait(WRITE, HZ/50); | 1669 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
1670 | } while (!page && (gfp_mask & __GFP_NOFAIL)); | 1670 | } while (!page && (gfp_mask & __GFP_NOFAIL)); |
1671 | 1671 | ||
1672 | return page; | 1672 | return page; |
@@ -1831,7 +1831,7 @@ rebalance: | |||
1831 | pages_reclaimed += did_some_progress; | 1831 | pages_reclaimed += did_some_progress; |
1832 | if (should_alloc_retry(gfp_mask, order, pages_reclaimed)) { | 1832 | if (should_alloc_retry(gfp_mask, order, pages_reclaimed)) { |
1833 | /* Wait for some write requests to complete then retry */ | 1833 | /* Wait for some write requests to complete then retry */ |
1834 | congestion_wait(WRITE, HZ/50); | 1834 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
1835 | goto rebalance; | 1835 | goto rebalance; |
1836 | } | 1836 | } |
1837 | 1837 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 54155268dfca..dea7abd31098 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1104,7 +1104,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan, | |||
1104 | */ | 1104 | */ |
1105 | if (nr_freed < nr_taken && !current_is_kswapd() && | 1105 | if (nr_freed < nr_taken && !current_is_kswapd() && |
1106 | lumpy_reclaim) { | 1106 | lumpy_reclaim) { |
1107 | congestion_wait(WRITE, HZ/10); | 1107 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1108 | 1108 | ||
1109 | /* | 1109 | /* |
1110 | * The attempt at page out may have made some | 1110 | * The attempt at page out may have made some |
@@ -1721,7 +1721,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
1721 | 1721 | ||
1722 | /* Take a nap, wait for some writeback to complete */ | 1722 | /* Take a nap, wait for some writeback to complete */ |
1723 | if (sc->nr_scanned && priority < DEF_PRIORITY - 2) | 1723 | if (sc->nr_scanned && priority < DEF_PRIORITY - 2) |
1724 | congestion_wait(WRITE, HZ/10); | 1724 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1725 | } | 1725 | } |
1726 | /* top priority shrink_zones still had more to do? don't OOM, then */ | 1726 | /* top priority shrink_zones still had more to do? don't OOM, then */ |
1727 | if (!sc->all_unreclaimable && scanning_global_lru(sc)) | 1727 | if (!sc->all_unreclaimable && scanning_global_lru(sc)) |
@@ -1960,7 +1960,7 @@ loop_again: | |||
1960 | * another pass across the zones. | 1960 | * another pass across the zones. |
1961 | */ | 1961 | */ |
1962 | if (total_scanned && priority < DEF_PRIORITY - 2) | 1962 | if (total_scanned && priority < DEF_PRIORITY - 2) |
1963 | congestion_wait(WRITE, HZ/10); | 1963 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1964 | 1964 | ||
1965 | /* | 1965 | /* |
1966 | * We do this so kswapd doesn't build up large priorities for | 1966 | * We do this so kswapd doesn't build up large priorities for |
@@ -2233,7 +2233,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages) | |||
2233 | goto out; | 2233 | goto out; |
2234 | 2234 | ||
2235 | if (sc.nr_scanned && prio < DEF_PRIORITY - 2) | 2235 | if (sc.nr_scanned && prio < DEF_PRIORITY - 2) |
2236 | congestion_wait(WRITE, HZ / 10); | 2236 | congestion_wait(BLK_RW_ASYNC, HZ / 10); |
2237 | } | 2237 | } |
2238 | } | 2238 | } |
2239 | 2239 | ||