aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-18 14:53:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-18 14:53:51 -0400
commitd3dc366bbaf07c125561e90d6da4bb147741101a (patch)
tree6eb7e79a8ec9df1fa705393c6d15ccea3d104661 /fs/block_dev.c
parent511c41d9e6665a07aca94eb00983cf6d77dd87ff (diff)
parente19a8a0ad2d255316830ead05b59c5a704434cbb (diff)
Merge branch 'for-3.18/core' of git://git.kernel.dk/linux-block
Pull core block layer changes from Jens Axboe: "This is the core block IO pull request for 3.18. Apart from the new and improved flush machinery for blk-mq, this is all mostly bug fixes and cleanups. - blk-mq timeout updates and fixes from Christoph. - Removal of REQ_END, also from Christoph. We pass it through the ->queue_rq() hook for blk-mq instead, freeing up one of the request bits. The space was overly tight on 32-bit, so Martin also killed REQ_KERNEL since it's no longer used. - blk integrity updates and fixes from Martin and Gu Zheng. - Update to the flush machinery for blk-mq from Ming Lei. Now we have a per hardware context flush request, which both cleans up the code should scale better for flush intensive workloads on blk-mq. - Improve the error printing, from Rob Elliott. - Backing device improvements and cleanups from Tejun. - Fixup of a misplaced rq_complete() tracepoint from Hannes. - Make blk_get_request() return error pointers, fixing up issues where we NULL deref when a device goes bad or missing. From Joe Lawrence. - Prep work for drastically reducing the memory consumption of dm devices from Junichi Nomura. This allows creating clone bio sets without preallocating a lot of memory. - Fix a blk-mq hang on certain combinations of queue depths and hardware queues from me. - Limit memory consumption for blk-mq devices for crash dump scenarios and drivers that use crazy high depths (certain SCSI shared tag setups). We now just use a single queue and limited depth for that" * 'for-3.18/core' of git://git.kernel.dk/linux-block: (58 commits) block: Remove REQ_KERNEL blk-mq: allocate cpumask on the home node bio-integrity: remove the needless fail handle of bip_slab creating block: include func name in __get_request prints block: make blk_update_request print prefix match ratelimited prefix blk-merge: don't compute bi_phys_segments from bi_vcnt for cloned bio block: fix alignment_offset math that assumes io_min is a power-of-2 blk-mq: Make bt_clear_tag() easier to read blk-mq: fix potential hang if rolling wakeup depth is too high block: add bioset_create_nobvec() block: use bio_clone_fast() in blk_rq_prep_clone() block: misplaced rq_complete tracepoint sd: Honor block layer integrity handling flags block: Replace strnicmp with strncasecmp block: Add T10 Protection Information functions block: Don't merge requests if integrity flags differ block: Integrity checksum flag block: Relocate bio integrity flags block: Add a disk flag to block integrity profile block: Add prefix to block integrity profile flags ...
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index e2f3ad0879ce..cc9d4114cda0 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -50,32 +50,22 @@ inline struct block_device *I_BDEV(struct inode *inode)
50EXPORT_SYMBOL(I_BDEV); 50EXPORT_SYMBOL(I_BDEV);
51 51
52/* 52/*
53 * Move the inode from its current bdi to a new bdi. If the inode is dirty we 53 * Move the inode from its current bdi to a new bdi. Make sure the inode
54 * need to move it onto the dirty list of @dst so that the inode is always on 54 * is clean before moving so that it doesn't linger on the old bdi.
55 * the right list.
56 */ 55 */
57static void bdev_inode_switch_bdi(struct inode *inode, 56static void bdev_inode_switch_bdi(struct inode *inode,
58 struct backing_dev_info *dst) 57 struct backing_dev_info *dst)
59{ 58{
60 struct backing_dev_info *old = inode->i_data.backing_dev_info; 59 while (true) {
61 bool wakeup_bdi = false; 60 spin_lock(&inode->i_lock);
62 61 if (!(inode->i_state & I_DIRTY)) {
63 if (unlikely(dst == old)) /* deadlock avoidance */ 62 inode->i_data.backing_dev_info = dst;
64 return; 63 spin_unlock(&inode->i_lock);
65 bdi_lock_two(&old->wb, &dst->wb); 64 return;
66 spin_lock(&inode->i_lock); 65 }
67 inode->i_data.backing_dev_info = dst; 66 spin_unlock(&inode->i_lock);
68 if (inode->i_state & I_DIRTY) { 67 WARN_ON_ONCE(write_inode_now(inode, true));
69 if (bdi_cap_writeback_dirty(dst) && !wb_has_dirty_io(&dst->wb))
70 wakeup_bdi = true;
71 list_move(&inode->i_wb_list, &dst->wb.b_dirty);
72 } 68 }
73 spin_unlock(&inode->i_lock);
74 spin_unlock(&old->wb.list_lock);
75 spin_unlock(&dst->wb.list_lock);
76
77 if (wakeup_bdi)
78 bdi_wakeup_thread_delayed(dst);
79} 69}
80 70
81/* Kill _all_ buffers and pagecache , dirty or not.. */ 71/* Kill _all_ buffers and pagecache , dirty or not.. */
@@ -1179,8 +1169,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1179 if (!ret) { 1169 if (!ret) {
1180 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); 1170 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
1181 bdi = blk_get_backing_dev_info(bdev); 1171 bdi = blk_get_backing_dev_info(bdev);
1182 if (bdi == NULL)
1183 bdi = &default_backing_dev_info;
1184 bdev_inode_switch_bdi(bdev->bd_inode, bdi); 1172 bdev_inode_switch_bdi(bdev->bd_inode, bdi);
1185 } 1173 }
1186 1174