All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volkan Unal <vunal@linux.ibm.com>
To: linux-s390@vger.kernel.org
Cc: oberpar@linux.ibm.com, sth@linux.ibm.com, hoeppner@linux.ibm.com,
	meted@linux.ibm.com
Subject: [PATCH 2/3] s390/dasd: Restrict discard support to virtual DASD devices
Date: Wed, 22 Jul 2026 16:16:50 +0100	[thread overview]
Message-ID: <20260722151651.292621-3-vunal@linux.ibm.com> (raw)
In-Reply-To: <20260722151651.292621-1-vunal@linux.ibm.com>

Enable discard operations only for virtual FBA DASD devices with
control unit type 0x6310. This includes:
 - Virtual disks (vdisk): Discard triggers page release in z/VM,
   allowing the hypervisor to reclaim memory pages
 - EDEV devices (SCSI/NVMe): Discard is accepted and results in
   zero-byte writes to the specified data range

Physical FBA DASD devices (CU type 0x3880) do not support discard.

Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Mete Durlu <meted@linux.ibm.com>
Signed-off-by: Volkan Unal <vunal@linux.ibm.com>
---
 drivers/s390/block/dasd_fba.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 45a488db897f..2869f93ac0ed 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -115,6 +115,11 @@ locate_record(struct ccw1 * ccw, struct LO_fba_data *data, int rw,
 	data->blk_ct = block_ct;
 }
 
+static bool cdev_is_virtual_or_edev(struct ccw_device *cdev)
+{
+	return cdev->id.cu_type == DASD_FBA_CU_TYPE_VIRTUAL;
+}
+
 static int
 dasd_fba_check_characteristics(struct dasd_device *device)
 {
@@ -167,8 +172,9 @@ dasd_fba_check_characteristics(struct dasd_device *device)
 	if (readonly)
 		set_bit(DASD_FLAG_DEVICE_RO, &device->flags);
 
-	/* FBA supports discard, set the according feature bit */
-	dasd_set_feature(cdev, DASD_FEATURE_DISCARD, 1);
+	/* Virtual and EDEV FBA supports discard, set the according feature bit */
+	if (cdev_is_virtual_or_edev(cdev))
+		dasd_set_feature(cdev, DASD_FEATURE_DISCARD, 1);
 
 	dev_info(&device->cdev->dev,
 		 "New FBA DASD %04X/%02X (CU %04X/%02X) with %d MB "
-- 
2.55.0


  parent reply	other threads:[~2026-07-22 15:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 15:16 [PATCH 0/3] s390/dasd: Restrict discard support to virtual DASD devices Volkan Unal
2026-07-22 15:16 ` [PATCH 1/3] s390/dasd: Add device type defines for FBA devices Volkan Unal
2026-07-22 15:20   ` sashiko-bot
2026-07-22 15:16 ` Volkan Unal [this message]
2026-07-22 15:33   ` [PATCH 2/3] s390/dasd: Restrict discard support to virtual DASD devices sashiko-bot
2026-07-22 15:16 ` [PATCH 3/3] s390/dasd: Make FBA discard support conditional per device Volkan Unal
2026-07-22 15:38   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260722151651.292621-3-vunal@linux.ibm.com \
    --to=vunal@linux.ibm.com \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=meted@linux.ibm.com \
    --cc=oberpar@linux.ibm.com \
    --cc=sth@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.