summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-05-11 00:00:29 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-11 00:00:29 -0400
commite4d35be584be88a3db3fa5635a97c62a2ec5aafe (patch)
treefc22a7fb65697306edd71411959ccee6df60c64d /block
parent99d825822eade8d827a1817357cbf3f889a552d6 (diff)
parent38b78a5f18584db6fa7441e0f4531b283b0e6725 (diff)
Merge branch 'ovl-fixes' into for-linus
Diffstat (limited to 'block')
-rw-r--r--block/bio.c12
-rw-r--r--block/blk-core.c2
-rw-r--r--block/blk-settings.c12
-rw-r--r--block/blk-sysfs.c8
-rw-r--r--block/cfq-iosched.c2
-rw-r--r--block/compat_ioctl.c4
-rw-r--r--block/ioctl.c4
-rw-r--r--block/partition-generic.c21
8 files changed, 36 insertions, 29 deletions
diff --git a/block/bio.c b/block/bio.c
index f124a0a624fc..807d25e466ec 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1339,7 +1339,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
1339 * release the pages we didn't map into the bio, if any 1339 * release the pages we didn't map into the bio, if any
1340 */ 1340 */
1341 while (j < page_limit) 1341 while (j < page_limit)
1342 page_cache_release(pages[j++]); 1342 put_page(pages[j++]);
1343 } 1343 }
1344 1344
1345 kfree(pages); 1345 kfree(pages);
@@ -1365,7 +1365,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
1365 for (j = 0; j < nr_pages; j++) { 1365 for (j = 0; j < nr_pages; j++) {
1366 if (!pages[j]) 1366 if (!pages[j])
1367 break; 1367 break;
1368 page_cache_release(pages[j]); 1368 put_page(pages[j]);
1369 } 1369 }
1370 out: 1370 out:
1371 kfree(pages); 1371 kfree(pages);
@@ -1385,7 +1385,7 @@ static void __bio_unmap_user(struct bio *bio)
1385 if (bio_data_dir(bio) == READ) 1385 if (bio_data_dir(bio) == READ)
1386 set_page_dirty_lock(bvec->bv_page); 1386 set_page_dirty_lock(bvec->bv_page);
1387 1387
1388 page_cache_release(bvec->bv_page); 1388 put_page(bvec->bv_page);
1389 } 1389 }
1390 1390
1391 bio_put(bio); 1391 bio_put(bio);
@@ -1615,8 +1615,8 @@ static void bio_release_pages(struct bio *bio)
1615 * the BIO and the offending pages and re-dirty the pages in process context. 1615 * the BIO and the offending pages and re-dirty the pages in process context.
1616 * 1616 *
1617 * It is expected that bio_check_pages_dirty() will wholly own the BIO from 1617 * It is expected that bio_check_pages_dirty() will wholly own the BIO from
1618 * here on. It will run one page_cache_release() against each page and will 1618 * here on. It will run one put_page() against each page and will run one
1619 * run one bio_put() against the BIO. 1619 * bio_put() against the BIO.
1620 */ 1620 */
1621 1621
1622static void bio_dirty_fn(struct work_struct *work); 1622static void bio_dirty_fn(struct work_struct *work);
@@ -1658,7 +1658,7 @@ void bio_check_pages_dirty(struct bio *bio)
1658 struct page *page = bvec->bv_page; 1658 struct page *page = bvec->bv_page;
1659 1659
1660 if (PageDirty(page) || PageCompound(page)) { 1660 if (PageDirty(page) || PageCompound(page)) {
1661 page_cache_release(page); 1661 put_page(page);
1662 bvec->bv_page = NULL; 1662 bvec->bv_page = NULL;
1663 } else { 1663 } else {
1664 nr_clean_pages++; 1664 nr_clean_pages++;
diff --git a/block/blk-core.c b/block/blk-core.c
index 827f8badd143..b60537b2c35b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -706,7 +706,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
706 goto fail_id; 706 goto fail_id;
707 707
708 q->backing_dev_info.ra_pages = 708 q->backing_dev_info.ra_pages =
709 (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; 709 (VM_MAX_READAHEAD * 1024) / PAGE_SIZE;
710 q->backing_dev_info.capabilities = BDI_CAP_CGROUP_WRITEBACK; 710 q->backing_dev_info.capabilities = BDI_CAP_CGROUP_WRITEBACK;
711 q->backing_dev_info.name = "block"; 711 q->backing_dev_info.name = "block";
712 q->node = node_id; 712 q->node = node_id;
diff --git a/block/blk-settings.c b/block/blk-settings.c
index c7bb666aafd1..331e4eee0dda 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -239,8 +239,8 @@ void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto
239 struct queue_limits *limits = &q->limits; 239 struct queue_limits *limits = &q->limits;
240 unsigned int max_sectors; 240 unsigned int max_sectors;
241 241
242 if ((max_hw_sectors << 9) < PAGE_CACHE_SIZE) { 242 if ((max_hw_sectors << 9) < PAGE_SIZE) {
243 max_hw_sectors = 1 << (PAGE_CACHE_SHIFT - 9); 243 max_hw_sectors = 1 << (PAGE_SHIFT - 9);
244 printk(KERN_INFO "%s: set to minimum %d\n", 244 printk(KERN_INFO "%s: set to minimum %d\n",
245 __func__, max_hw_sectors); 245 __func__, max_hw_sectors);
246 } 246 }
@@ -329,8 +329,8 @@ EXPORT_SYMBOL(blk_queue_max_segments);
329 **/ 329 **/
330void blk_queue_max_segment_size(struct request_queue *q, unsigned int max_size) 330void blk_queue_max_segment_size(struct request_queue *q, unsigned int max_size)
331{ 331{
332 if (max_size < PAGE_CACHE_SIZE) { 332 if (max_size < PAGE_SIZE) {
333 max_size = PAGE_CACHE_SIZE; 333 max_size = PAGE_SIZE;
334 printk(KERN_INFO "%s: set to minimum %d\n", 334 printk(KERN_INFO "%s: set to minimum %d\n",
335 __func__, max_size); 335 __func__, max_size);
336 } 336 }
@@ -760,8 +760,8 @@ EXPORT_SYMBOL_GPL(blk_queue_dma_drain);
760 **/ 760 **/
761void blk_queue_segment_boundary(struct request_queue *q, unsigned long mask) 761void blk_queue_segment_boundary(struct request_queue *q, unsigned long mask)
762{ 762{
763 if (mask < PAGE_CACHE_SIZE - 1) { 763 if (mask < PAGE_SIZE - 1) {
764 mask = PAGE_CACHE_SIZE - 1; 764 mask = PAGE_SIZE - 1;
765 printk(KERN_INFO "%s: set to minimum %lx\n", 765 printk(KERN_INFO "%s: set to minimum %lx\n",
766 __func__, mask); 766 __func__, mask);
767 } 767 }
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index dd93763057ce..995b58d46ed1 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -76,7 +76,7 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
76static ssize_t queue_ra_show(struct request_queue *q, char *page) 76static ssize_t queue_ra_show(struct request_queue *q, char *page)
77{ 77{
78 unsigned long ra_kb = q->backing_dev_info.ra_pages << 78 unsigned long ra_kb = q->backing_dev_info.ra_pages <<
79 (PAGE_CACHE_SHIFT - 10); 79 (PAGE_SHIFT - 10);
80 80
81 return queue_var_show(ra_kb, (page)); 81 return queue_var_show(ra_kb, (page));
82} 82}
@@ -90,7 +90,7 @@ queue_ra_store(struct request_queue *q, const char *page, size_t count)
90 if (ret < 0) 90 if (ret < 0)
91 return ret; 91 return ret;
92 92
93 q->backing_dev_info.ra_pages = ra_kb >> (PAGE_CACHE_SHIFT - 10); 93 q->backing_dev_info.ra_pages = ra_kb >> (PAGE_SHIFT - 10);
94 94
95 return ret; 95 return ret;
96} 96}
@@ -117,7 +117,7 @@ static ssize_t queue_max_segment_size_show(struct request_queue *q, char *page)
117 if (blk_queue_cluster(q)) 117 if (blk_queue_cluster(q))
118 return queue_var_show(queue_max_segment_size(q), (page)); 118 return queue_var_show(queue_max_segment_size(q), (page));
119 119
120 return queue_var_show(PAGE_CACHE_SIZE, (page)); 120 return queue_var_show(PAGE_SIZE, (page));
121} 121}
122 122
123static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page) 123static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page)
@@ -198,7 +198,7 @@ queue_max_sectors_store(struct request_queue *q, const char *page, size_t count)
198{ 198{
199 unsigned long max_sectors_kb, 199 unsigned long max_sectors_kb,
200 max_hw_sectors_kb = queue_max_hw_sectors(q) >> 1, 200 max_hw_sectors_kb = queue_max_hw_sectors(q) >> 1,
201 page_kb = 1 << (PAGE_CACHE_SHIFT - 10); 201 page_kb = 1 << (PAGE_SHIFT - 10);
202 ssize_t ret = queue_var_store(&max_sectors_kb, page, count); 202 ssize_t ret = queue_var_store(&max_sectors_kb, page, count);
203 203
204 if (ret < 0) 204 if (ret < 0)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index e3c591dd8f19..4a349787bc62 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -4075,7 +4075,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
4075 * idle timer unplug to continue working. 4075 * idle timer unplug to continue working.
4076 */ 4076 */
4077 if (cfq_cfqq_wait_request(cfqq)) { 4077 if (cfq_cfqq_wait_request(cfqq)) {
4078 if (blk_rq_bytes(rq) > PAGE_CACHE_SIZE || 4078 if (blk_rq_bytes(rq) > PAGE_SIZE ||
4079 cfqd->busy_queues > 1) { 4079 cfqd->busy_queues > 1) {
4080 cfq_del_timer(cfqd, cfqq); 4080 cfq_del_timer(cfqd, cfqq);
4081 cfq_clear_cfqq_wait_request(cfqq); 4081 cfq_clear_cfqq_wait_request(cfqq);
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index f678c733df40..556826ac7cb4 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -710,7 +710,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
710 return -EINVAL; 710 return -EINVAL;
711 bdi = blk_get_backing_dev_info(bdev); 711 bdi = blk_get_backing_dev_info(bdev);
712 return compat_put_long(arg, 712 return compat_put_long(arg,
713 (bdi->ra_pages * PAGE_CACHE_SIZE) / 512); 713 (bdi->ra_pages * PAGE_SIZE) / 512);
714 case BLKROGET: /* compatible */ 714 case BLKROGET: /* compatible */
715 return compat_put_int(arg, bdev_read_only(bdev) != 0); 715 return compat_put_int(arg, bdev_read_only(bdev) != 0);
716 case BLKBSZGET_32: /* get the logical block size (cf. BLKSSZGET) */ 716 case BLKBSZGET_32: /* get the logical block size (cf. BLKSSZGET) */
@@ -729,7 +729,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
729 if (!capable(CAP_SYS_ADMIN)) 729 if (!capable(CAP_SYS_ADMIN))
730 return -EACCES; 730 return -EACCES;
731 bdi = blk_get_backing_dev_info(bdev); 731 bdi = blk_get_backing_dev_info(bdev);
732 bdi->ra_pages = (arg * 512) / PAGE_CACHE_SIZE; 732 bdi->ra_pages = (arg * 512) / PAGE_SIZE;
733 return 0; 733 return 0;
734 case BLKGETSIZE: 734 case BLKGETSIZE:
735 size = i_size_read(bdev->bd_inode); 735 size = i_size_read(bdev->bd_inode);
diff --git a/block/ioctl.c b/block/ioctl.c
index d8996bbd7f12..4ff1f92f89ca 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -550,7 +550,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
550 if (!arg) 550 if (!arg)
551 return -EINVAL; 551 return -EINVAL;
552 bdi = blk_get_backing_dev_info(bdev); 552 bdi = blk_get_backing_dev_info(bdev);
553 return put_long(arg, (bdi->ra_pages * PAGE_CACHE_SIZE) / 512); 553 return put_long(arg, (bdi->ra_pages * PAGE_SIZE) / 512);
554 case BLKROGET: 554 case BLKROGET:
555 return put_int(arg, bdev_read_only(bdev) != 0); 555 return put_int(arg, bdev_read_only(bdev) != 0);
556 case BLKBSZGET: /* get block device soft block size (cf. BLKSSZGET) */ 556 case BLKBSZGET: /* get block device soft block size (cf. BLKSSZGET) */
@@ -578,7 +578,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
578 if(!capable(CAP_SYS_ADMIN)) 578 if(!capable(CAP_SYS_ADMIN))
579 return -EACCES; 579 return -EACCES;
580 bdi = blk_get_backing_dev_info(bdev); 580 bdi = blk_get_backing_dev_info(bdev);
581 bdi->ra_pages = (arg * 512) / PAGE_CACHE_SIZE; 581 bdi->ra_pages = (arg * 512) / PAGE_SIZE;
582 return 0; 582 return 0;
583 case BLKBSZSET: 583 case BLKBSZSET:
584 return blkdev_bszset(bdev, mode, argp); 584 return blkdev_bszset(bdev, mode, argp);
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 5d8701941054..d7eb77e1e3a8 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -361,15 +361,20 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
361 goto out_del; 361 goto out_del;
362 } 362 }
363 363
364 err = hd_ref_init(p);
365 if (err) {
366 if (flags & ADDPART_FLAG_WHOLEDISK)
367 goto out_remove_file;
368 goto out_del;
369 }
370
364 /* everything is up and running, commence */ 371 /* everything is up and running, commence */
365 rcu_assign_pointer(ptbl->part[partno], p); 372 rcu_assign_pointer(ptbl->part[partno], p);
366 373
367 /* suppress uevent if the disk suppresses it */ 374 /* suppress uevent if the disk suppresses it */
368 if (!dev_get_uevent_suppress(ddev)) 375 if (!dev_get_uevent_suppress(ddev))
369 kobject_uevent(&pdev->kobj, KOBJ_ADD); 376 kobject_uevent(&pdev->kobj, KOBJ_ADD);
370 377 return p;
371 if (!hd_ref_init(p))
372 return p;
373 378
374out_free_info: 379out_free_info:
375 free_part_info(p); 380 free_part_info(p);
@@ -378,6 +383,8 @@ out_free_stats:
378out_free: 383out_free:
379 kfree(p); 384 kfree(p);
380 return ERR_PTR(err); 385 return ERR_PTR(err);
386out_remove_file:
387 device_remove_file(pdev, &dev_attr_whole_disk);
381out_del: 388out_del:
382 kobject_put(p->holder_dir); 389 kobject_put(p->holder_dir);
383 device_del(pdev); 390 device_del(pdev);
@@ -566,8 +573,8 @@ static struct page *read_pagecache_sector(struct block_device *bdev, sector_t n)
566{ 573{
567 struct address_space *mapping = bdev->bd_inode->i_mapping; 574 struct address_space *mapping = bdev->bd_inode->i_mapping;
568 575
569 return read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), 576 return read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_SHIFT-9)),
570 NULL); 577 NULL);
571} 578}
572 579
573unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) 580unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
@@ -584,9 +591,9 @@ unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
584 if (PageError(page)) 591 if (PageError(page))
585 goto fail; 592 goto fail;
586 p->v = page; 593 p->v = page;
587 return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9); 594 return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_SHIFT - 9)) - 1)) << 9);
588fail: 595fail:
589 page_cache_release(page); 596 put_page(page);
590 } 597 }
591 p->v = NULL; 598 p->v = NULL;
592 return NULL; 599 return NULL;