[RHEL7,COMMIT] ploop: Allow to configure FUSE discard_granuality

Submitted by Vasily Averin on Sept. 4, 2020, 7:31 a.m.

Details

Message ID 202009040731.0847V0xR024836@vz7build.vvs.sw.ru
State New
Series "ploop: Rework queue_settings autoconfig and allow fuse 4K discard"
Headers show

Commit Message

Vasily Averin Sept. 4, 2020, 7:31 a.m.
The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.16
------>
commit a75b78cf05ad068f353d4d158ed0bf45a2e09aad
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Fri Sep 4 10:31:00 2020 +0300

    ploop: Allow to configure FUSE discard_granuality
    
    Also remove caching of discard_granuality in ext4
    since we moved autoconfiguration in previous patch.
    
    https://jira.sw.ru/browse/PSBM-107598
    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 86689f29..3358d70 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4269,7 +4269,6 @@  out_err:
 
 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 6cfd9a6..7d690db 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 ccf8ecc..b6875ba 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;