[RH7,3/6] ploop: Allow to configure FUSE discard_granuality

Submitted by Kirill Tkhai on Sept. 3, 2020, 2:11 p.m.

Details

Message ID 159914230020.142757.18278337679447874516.stgit@localhost.localdomain
State New
Series "ploop: Rework queue_settings autoconfig and allow fuse 4K discard"
Headers show

Commit Message

Kirill Tkhai Sept. 3, 2020, 2:11 p.m.
Also remove caching of discard_granuality in ext4
since we moved autoconfiguration in previous patch.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/dev.c     |    6 ------
 drivers/block/ploop/io_kaio.c |   19 +------------------
 drivers/block/ploop/sysfs.c   |    7 +------
 3 files changed, 2 insertions(+), 30 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 86689f297064..3358d70a4211 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4269,7 +4269,6 @@  static int ploop_start(struct ploop_device * plo, struct block_device *bdev)
 
 static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 {
-	struct request_queue *q = plo->queue;
 	int p, active_reqs;
 	struct ploop_delta * delta;
 	int cnt;
@@ -4330,9 +4329,6 @@  static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 
 	plo->tune.trusted = 0;
 
-	q->limits.discard_granularity = 0;
-	q->limits.max_discard_sectors = 0;
-
 	clear_bit(PLOOP_S_PUSH_BACKUP, &plo->state);
 	ploop_pb_stop(plo->pbd, true);
 
@@ -5670,8 +5666,6 @@  static struct ploop_device *__ploop_dev_alloc(int index)
 	KOBJECT_INIT(&plo->kobj, &ploop_ktype);
 	atomic_inc(&plo_count);
 	bio_list_init(&plo->bio_discard_list);
-	plo->queue->limits.discard_granularity = 0;
-	plo->queue->limits.max_discard_sectors = 0;
 
 	dk->major		= ploop_major;
 	dk->first_minor		= index << PLOOP_PART_SHIFT;
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 6cfd9a63ab3f..7d690dbe9124 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -1138,25 +1138,8 @@  static void kaio_queue_settings(struct ploop_io * io, struct request_queue * q)
 	struct inode *inode = file->f_mapping->host;
 
 	if (inode->i_sb->s_magic == EXT4_SUPER_MAGIC) {
-		unsigned int max_discard_sectors = q->limits.max_discard_sectors;
-		unsigned int discard_granularity = q->limits.discard_granularity;
-
-		/*
-		 * It would be better to call this function not only on start
-		 * like now (on every top delta update, e.g. before start).
-		 * But this is difficult with two engines and different holes
-		 * policy. This should be reworked after we switch to io_kaio
-		 * completely.
-		 */
 		blk_queue_stack_limits(q, bdev_get_queue(io->files.bdev));
-		if (discard_granularity) {
-			/* Restore user values set before PLOOP_IOC_START */
-			q->limits.max_discard_sectors = max_discard_sectors;
-			q->limits.discard_granularity = discard_granularity;
-		} else {
-			/* Set defaults */
-			ploop_set_discard_limits(io->plo);
-		}
+		ploop_set_discard_limits(io->plo);
 		return;
 	}
 
diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c
index ccf8eccedb51..b6875ba971f0 100644
--- a/drivers/block/ploop/sysfs.c
+++ b/drivers/block/ploop/sysfs.c
@@ -396,18 +396,13 @@  static int store_discard_granularity(struct ploop_device *plo, u32 val)
 		goto unlock;
 	}
 
-	inode = delta->io.files.inode;
-	if (inode->i_sb->s_magic != EXT4_SUPER_MAGIC) {
-		ret = -EINVAL;
-		goto unlock;
-	}
-
 	if (val == cluster_size_in_bytes(plo)) {
 		ploop_set_discard_limits(plo);
 		plo->force_split_discard_reqs = false;
 		goto unlock;
 	}
 
+	inode = delta->io.files.inode;
 	if (val != inode->i_sb->s_blocksize) {
 		ret = -EINVAL;
 		goto unlock;