From f7b80313dfc731d02c93c296fa74706115092ac2 Mon Sep 17 00:00:00 2001 From: Manish Bhardwaj Date: Fri, 30 Sep 2022 10:47:02 +0530 Subject: [PATCH] nvidia: vblk: fix compilation error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in linux below patches remove the support for QUEUE_FLAG_DISCARD and QUEUE_FLAG_SECERASE. commit 70200574cc229f6ba038259e8142af2aa09e6976 Author: Christoph Hellwig Date: Fri Apr 15 06:52:55 2022 +0200 block: remove QUEUE_FLAG_DISCARD Just use a non-zero max_discard_sectors as an indicator for discard support, similar to what is done for write zeroes. The only places where needs special attention is the RAID5 driver, which must clear discard support for security reasons by default, even if the default stacking rules would allow for it. commit 44abff2c0b970ae3d310b97617525dc01f248d7c Author: Christoph Hellwig Date: Fri Apr 15 06:52:57 2022 +0200 block: decouple REQ_OP_SECURE_ERASE from REQ_OP_DISCARD Secure erase is a very different operation from discard in that it is a data integrity operation vs hint. Fully split the limits and helper infrastructure to make the separation more clear. we are fixing below compilation error using this patch. nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:921:22: error: ‘QUEUE_FLAG_DISCARD’ undeclared (first use in this function); did you mean ‘QUEUE_FLAG_DEAD’? 921 | blk_queue_flag_set(QUEUE_FLAG_DISCARD, vblkdev->queue); | ^~~~~~~~~~~~~~~~~~ | QUEUE_FLAG_DEAD nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:921:22: note: each undeclared identifier is reported only once for each function it appears in nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:928:23: error: ‘QUEUE_FLAG_SECERASE’ undeclared (first use in this function); did you mean ‘QUEUE_FLAG_NOMERGES’? 928 | blk_queue_flag_set(QUEUE_FLAG_SECERASE, vblkdev->queue); Bug 3733730 Signed-off-by: Manish Bhardwaj Change-Id: I47ad13be833fdd7ec7f0d2127699e28311fbeb83 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2784741 Reviewed-by: Jonathan Hunter Reviewed-by: Bitan Biswas GVS: Gerrit_Virtual_Submit --- drivers/block/tegra_virt_storage/tegra_hv_vblk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/block/tegra_virt_storage/tegra_hv_vblk.c b/drivers/block/tegra_virt_storage/tegra_hv_vblk.c index 481d0a38..0d34f48b 100644 --- a/drivers/block/tegra_virt_storage/tegra_hv_vblk.c +++ b/drivers/block/tegra_virt_storage/tegra_hv_vblk.c @@ -918,14 +918,18 @@ static void setup_device(struct vblk_dev *vblkdev) if (vblkdev->config.blk_config.req_ops_supported & VS_BLK_DISCARD_OP_F) { +#if KERNEL_VERSION(5, 19, 0) > LINUX_VERSION_CODE blk_queue_flag_set(QUEUE_FLAG_DISCARD, vblkdev->queue); +#endif blk_queue_max_discard_sectors(vblkdev->queue, vblkdev->config.blk_config.max_erase_blks_per_io); vblkdev->queue->limits.discard_granularity = vblkdev->config.blk_config.hardblk_size; +#if KERNEL_VERSION(5, 19, 0) > LINUX_VERSION_CODE if (vblkdev->config.blk_config.req_ops_supported & VS_BLK_SECURE_ERASE_OP_F) blk_queue_flag_set(QUEUE_FLAG_SECERASE, vblkdev->queue); +#endif } /* And the gendisk structure. */