From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BC8339150E for ; Fri, 14 Aug 2026 19:35:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786736134; cv=none; b=jN+/ZsAD2z8OxjsSMgtwvORF2puBLoLg2BdO+Oogrn8TIh1XvGzGMImRD0HCApqFVPRZ0f/cTAnvT8GZbhlYVPTNryjnEeCl21PcMbWxGS98foyLejL6bLkOwrBj+ctnat8aG3NaG4qG6s7txyQeQn+HBLwyop3B8uhh6Fg1Ulk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786736134; c=relaxed/simple; bh=i5d9ZXjVbFVw2IAyarL45/jKamKGLhjVLY2+/Tgubrg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L4uRLgYgEOdEFsqgAfh2+HsHM4DCcFL8tcFCMFMeeE1l9DmGBKGScT+VwpP1/6+QsuunlSvyeyC4xi+espH0LAb0+94whnzZEq7/MSrGWO/5x3fM6acuhLIWPjcNGk/JaXk8JZFZL1co4RXFnIb2Ib6Egt7vE3OzkV6UcWYPv4w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=K0gDrBzj; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="K0gDrBzj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786736132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LUb9dhVio4DSRlBYDRsE8kJk432qxKPW9ktdvsEm2bs=; b=K0gDrBzjK24cNjInbqVyT9RLu53YBFWA1Oc+4IZr9A8I8xhc0tAaZ3U4s+bn/Ls595HqK8 6b0Ri9gztBtFY5IO8Tfsj2T8Q/jrDrkPfz3ppzJIpCsGU0PzIKn7vYXyqE/izySbMhbb1S 8q61TIx/mMIoGEE+prXqvXyNoHdGnlE= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-331-V3ufYIMEP-2_Ouiv-EAoMQ-1; Fri, 14 Aug 2026 15:35:28 -0400 X-MC-Unique: V3ufYIMEP-2_Ouiv-EAoMQ-1 X-Mimecast-MFC-AGG-ID: V3ufYIMEP-2_Ouiv-EAoMQ_1786736126 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7C2A1180064C; Fri, 14 Aug 2026 19:35:26 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 14D391800346; Fri, 14 Aug 2026 19:35:25 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.17.1) with ESMTPS id 67EJZOq11707320 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 14 Aug 2026 15:35:24 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.18.1/Submit) id 67EJZOVN1707319; Fri, 14 Aug 2026 15:35:24 -0400 Date: Fri, 14 Aug 2026 15:35:24 -0400 From: Benjamin Marzinski To: Matthias Goergens Cc: dm-devel@lists.linux.dev, agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dm-delay: advertise flush support Message-ID: References: <20260814045813.3148127-1-matthias.goergens@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260814045813.3148127-1-matthias.goergens@gmail.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 On Fri, Aug 14, 2026 at 12:58:12PM +0800, Matthias Goergens wrote: > dm-delay parses and reports a flush delay class (the 9-argument table > form's ), delay_map() routes > REQ_PREFLUSH bios to it, the target sets num_flush_bios = 1, and > Documentation/admin-guide/device-mapper/delay.rst documents flush > delays. But the target never sets ti->flush_supported, so > dm_table_supports_flush() is false: the block layer strips REQ_PREFLUSH > as a no-op before the bio ever reaches the target (blk_insert_flush()), > REQ_FUA is stripped too, and the flush delay class is dead code. Anyone > who configures a flush delay on dm-delay (e.g. to model slow-flush > devices in tests) silently measures nothing. > > Set ti->flush_supported = true so the flush delay class is actually > reachable. dm core clones empty flushes with > REQ_OP_WRITE | REQ_PREFLUSH | REQ_SYNC (__send_empty_flush), which > delay_map() already routes to the flush class, and delayed completion > is already handled for every class by the delay worker. > > Verified with dm-delay over a virtio-scsi disk: without this change > REQ_PREFLUSH completes immediately and REQ_FUA writes are stripped by > the block layer; with it, flushes take the configured delay and FUA > writes reach the wire (measured as device-time per MB at D_f = 200 ms > and 800 ms flush delays). > The code seems fine, but could you please change the commit message. It's not true that "Anyone who configures a flush delay on dm-delay silently measures nothing". dm-delay doesn't *force* the dm device to support flushes. It works just like most of the dm targets: linear, stripe, raid, etc. If an underlying device sets BLK_FEAT_WRITE_CACHE or BLK_FEAT_FUA, the dm device will as well (see blk_stack_limits, called by dm_set_device_limits). I assume if you look at /sys/block//queue/write_cache, you see "write through". -Ben > Signed-off-by: Matthias Goergens > --- > drivers/md/dm-delay.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c > --- a/drivers/md/dm-delay.c > +++ b/drivers/md/dm-delay.c > @@ -301,6 +301,7 @@ > } > > ti->num_flush_bios = 1; > + ti->flush_supported = true; > ti->num_discard_bios = 1; > ti->accounts_remapped_io = true; > ti->per_io_data_size = sizeof(struct dm_delay_info); > @@ -451,7 +452,7 @@ > > static struct target_type delay_target = { > .name = "delay", > - .version = {1, 5, 0}, > + .version = {1, 5, 1}, > .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_ZONED_HM, > .module = THIS_MODULE, > .ctr = delay_ctr,