diff options
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 33eded00c5b1..3b080541098e 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1704,6 +1704,11 @@ generic_make_request_checks(struct bio *bio) | |||
1704 | goto end_io; | 1704 | goto end_io; |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | if (bio->bi_rw & REQ_WRITE_SAME && !bdev_write_same(bio->bi_bdev)) { | ||
1708 | err = -EOPNOTSUPP; | ||
1709 | goto end_io; | ||
1710 | } | ||
1711 | |||
1707 | /* | 1712 | /* |
1708 | * Various block parts want %current->io_context and lazy ioc | 1713 | * Various block parts want %current->io_context and lazy ioc |
1709 | * allocation ends up trading a lot of pain for a small amount of | 1714 | * allocation ends up trading a lot of pain for a small amount of |
@@ -1809,8 +1814,6 @@ EXPORT_SYMBOL(generic_make_request); | |||
1809 | */ | 1814 | */ |
1810 | void submit_bio(int rw, struct bio *bio) | 1815 | void submit_bio(int rw, struct bio *bio) |
1811 | { | 1816 | { |
1812 | int count = bio_sectors(bio); | ||
1813 | |||
1814 | bio->bi_rw |= rw; | 1817 | bio->bi_rw |= rw; |
1815 | 1818 | ||
1816 | /* | 1819 | /* |
@@ -1818,6 +1821,13 @@ void submit_bio(int rw, struct bio *bio) | |||
1818 | * go through the normal accounting stuff before submission. | 1821 | * go through the normal accounting stuff before submission. |
1819 | */ | 1822 | */ |
1820 | if (bio_has_data(bio)) { | 1823 | if (bio_has_data(bio)) { |
1824 | unsigned int count; | ||
1825 | |||
1826 | if (unlikely(rw & REQ_WRITE_SAME)) | ||
1827 | count = bdev_logical_block_size(bio->bi_bdev) >> 9; | ||
1828 | else | ||
1829 | count = bio_sectors(bio); | ||
1830 | |||
1821 | if (rw & WRITE) { | 1831 | if (rw & WRITE) { |
1822 | count_vm_events(PGPGOUT, count); | 1832 | count_vm_events(PGPGOUT, count); |
1823 | } else { | 1833 | } else { |