Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48920ff2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

block: remove the discard_zeroes_data flag



Now that we use the proper REQ_OP_WRITE_ZEROES operation everywhere we can
kill this hack.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 45c21793
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -213,14 +213,8 @@ What: /sys/block/<disk>/queue/discard_zeroes_data
Date:		May 2011
Contact:	Martin K. Petersen <martin.petersen@oracle.com>
Description:
		Devices that support discard functionality may return
		stale or random data when a previously discarded block
		is read back. This can cause problems if the filesystem
		expects discarded blocks to be explicitly cleared. If a
		device reports that it deterministically returns zeroes
		when a discarded area is read the discard_zeroes_data
		parameter will be set to one. Otherwise it will be 0 and
		the result of reading a discarded area is undefined.
		Will always return 0.  Don't rely on any specific behavior
		for discards, and don't read this file.

What:		/sys/block/<disk>/queue/write_same_max_bytes
Date:		January 2012
+0 −5
Original line number Diff line number Diff line
@@ -43,11 +43,6 @@ large discards are issued, setting this value lower will make Linux issue
smaller discards and potentially help reduce latencies induced by large
discard operations.

discard_zeroes_data (RO)
------------------------
When read, this file will show if the discarded block are zeroed by the
device or not. If its value is '1' the blocks are zeroed otherwise not.

hw_sector_size (RO)
-------------------
This is the hardware sector size of the device, in bytes.
+1 −6
Original line number Diff line number Diff line
@@ -37,17 +37,12 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
		return -ENXIO;

	if (flags & BLKDEV_DISCARD_SECURE) {
		if (flags & BLKDEV_DISCARD_ZERO)
			return -EOPNOTSUPP;
		if (!blk_queue_secure_erase(q))
			return -EOPNOTSUPP;
		op = REQ_OP_SECURE_ERASE;
	} else {
		if (!blk_queue_discard(q))
			return -EOPNOTSUPP;
		if ((flags & BLKDEV_DISCARD_ZERO) &&
		    !q->limits.discard_zeroes_data)
			return -EOPNOTSUPP;
		op = REQ_OP_DISCARD;
	}

@@ -126,7 +121,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
			&bio);
	if (!ret && bio) {
		ret = submit_bio_wait(bio);
		if (ret == -EOPNOTSUPP && !(flags & BLKDEV_DISCARD_ZERO))
		if (ret == -EOPNOTSUPP)
			ret = 0;
		bio_put(bio);
	}
+0 −3
Original line number Diff line number Diff line
@@ -103,7 +103,6 @@ void blk_set_default_limits(struct queue_limits *lim)
	lim->discard_granularity = 0;
	lim->discard_alignment = 0;
	lim->discard_misaligned = 0;
	lim->discard_zeroes_data = 0;
	lim->logical_block_size = lim->physical_block_size = lim->io_min = 512;
	lim->bounce_pfn = (unsigned long)(BLK_BOUNCE_ANY >> PAGE_SHIFT);
	lim->alignment_offset = 0;
@@ -127,7 +126,6 @@ void blk_set_stacking_limits(struct queue_limits *lim)
	blk_set_default_limits(lim);

	/* Inherit limits from component devices */
	lim->discard_zeroes_data = 1;
	lim->max_segments = USHRT_MAX;
	lim->max_discard_segments = 1;
	lim->max_hw_sectors = UINT_MAX;
@@ -609,7 +607,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
	t->io_opt = lcm_not_zero(t->io_opt, b->io_opt);

	t->cluster &= b->cluster;
	t->discard_zeroes_data &= b->discard_zeroes_data;

	/* Physical block size a multiple of the logical block size? */
	if (t->physical_block_size & (t->logical_block_size - 1)) {
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ static ssize_t queue_discard_max_store(struct request_queue *q,

static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *page)
{
	return queue_var_show(queue_discard_zeroes_data(q), page);
	return queue_var_show(0, page);
}

static ssize_t queue_write_same_max_show(struct request_queue *q, char *page)
Loading