{"id":2225008,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2225008/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260420083705.1009074-7-dhowells@redhat.com/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.1/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260420083705.1009074-7-dhowells@redhat.com>","date":"2026-04-20T08:36:57","name":"[06/11] netfs: Fix the trace displayed for the total overwrite of a streamed write","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"265c2662f57a10b6e603a3ebc37544f54f680cee","submitter":{"id":59,"url":"http://patchwork.ozlabs.org/api/1.1/people/59/?format=json","name":"David Howells","email":"dhowells@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260420083705.1009074-7-dhowells@redhat.com/mbox/","series":[{"id":500568,"url":"http://patchwork.ozlabs.org/api/1.1/series/500568/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=500568","date":"2026-04-20T08:36:52","name":"netfs: Further miscellaneous fixes","version":1,"mbox":"http://patchwork.ozlabs.org/series/500568/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225008/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2225008/checks/","tags":{},"headers":{"Return-Path":"\n <linux-cifs+bounces-10929-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=dWNnr1zb;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10929-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.b=\"dWNnr1zb\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=170.10.129.124","smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=redhat.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=redhat.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fzfCS6YDQz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 18:43:32 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 0F94C3081985\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 08:38:19 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4386638D01B;\n\tMon, 20 Apr 2026 08:37:54 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id C73C938CFE1\n\tfor <linux-cifs@vger.kernel.org>; Mon, 20 Apr 2026 08:37:52 +0000 (UTC)","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-63-G8XKq8e8P8akCl28AhsOsg-1; Mon,\n 20 Apr 2026 04:37:46 -0400","from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id B0F7819560A3;\n\tMon, 20 Apr 2026 08:37:44 +0000 (UTC)","from warthog.procyon.org.com (unknown [10.44.48.17])\n\tby mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id A4663195608E;\n\tMon, 20 Apr 2026 08:37:41 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776674274; cv=none;\n b=bmkLGsEhBdgWynsTscs9LGdsuzPv+cY5to6/vB7tYUuiV6u9KhXNZoswYoI867G1sewaG6bDc8B5kHMSGjerYKzglcOi01COkhb01v3vKCyPy9Rw1KE0jjcfwKXZxHTtlHi2E3oUvJfsrMURyydIxCu5e31Uy6FrONUMVtYxjnc=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776674274; c=relaxed/simple;\n\tbh=mtHnEjvRwJ+xdJf8DIqVxDhrtVHQt4N+eCpgfUIB8lY=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=FGEWtQXWvVcVe1+ts3EcKeZChzf3o89FpUM36EnFYx+3tVmgKn5R+4PLUq/tMnDyRSuAx7YbVFwxXgXDr+arJ7SX+ewYP9XwbglfuIbdHPNKIn2t7cbevTC5Tkdebn/btARf7tf67CtCCAcOAzkBkFMh1mjfsMqTjJfKqWxKjPQ=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=redhat.com;\n spf=pass smtp.mailfrom=redhat.com;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.b=dWNnr1zb; arc=none smtp.client-ip=170.10.129.124","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1776674271;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=Ob6xCMZuqNEj/Bt5UZPBU1fDVm9Ru5OkhDx15MsP/Ik=;\n\tb=dWNnr1zb2eQtWlaOyOu8vRTpJdz7WP7r/QvvcxC7slsfUMAM54/NP4Nn5nSt2SRzVzSfeR\n\t8juCM3x6tdJvXs8Ycqcjmq5zBjcYR4JZkXUDgX7fMGefOe3QpvhxB5nCET0iUgkAPv4fyp\n\t6uTXpMhMUsQ2+4V7Ii328JVJEJk2rjE=","X-MC-Unique":"G8XKq8e8P8akCl28AhsOsg-1","X-Mimecast-MFC-AGG-ID":"G8XKq8e8P8akCl28AhsOsg_1776674264","From":"David Howells <dhowells@redhat.com>","To":"Christian Brauner <christian@brauner.io>","Cc":"David Howells <dhowells@redhat.com>,\n\tPaulo Alcantara <pc@manguebit.org>,\n\tnetfs@lists.linux.dev,\n\tlinux-afs@lists.infradead.org,\n\tlinux-cifs@vger.kernel.org,\n\tceph-devel@vger.kernel.org,\n\tlinux-fsdevel@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tMatthew Wilcox <willy@infradead.org>","Subject":"[PATCH 06/11] netfs: Fix the trace displayed for the total overwrite\n of a streamed write","Date":"Mon, 20 Apr 2026 09:36:57 +0100","Message-ID":"<20260420083705.1009074-7-dhowells@redhat.com>","In-Reply-To":"<20260420083705.1009074-1-dhowells@redhat.com>","References":"<20260420083705.1009074-1-dhowells@redhat.com>","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.17"},"content":"Change netfs_perform_write() to carry the trace value in a variable and\nemit it later to make it easier to select the value displayed.\n\nFix the display of netfs_streaming_write_cont in the \"folio_now_filled:\"\nsection.  It should only be set to that if we come from the section that\nfilled in a gap in an already streamed write (and would otherwise display\nnetfs_streaming_write_cont).  If it came from the bit that just overwrites\nthe entire folio (which would ordinarily display netfs_whole_folio_modify),\nmake it display netfs_whole_folio_modify_filled instead.\n\nFixes: 1bfeb53e990b (\"netfs: Fix streaming write being overwritten\")\nCloses: https://sashiko.dev/#/patchset/20260414082004.3756080-1-dhowells%40redhat.com\nSigned-off-by: David Howells <dhowells@redhat.com>\ncc: Paulo Alcantara <pc@manguebit.org>\ncc: Matthew Wilcox <willy@infradead.org>\ncc: netfs@lists.linux.dev\ncc: linux-fsdevel@vger.kernel.org\n---\n fs/netfs/buffered_write.c    | 27 ++++++++++++++++-----------\n include/trace/events/netfs.h |  1 +\n 2 files changed, 17 insertions(+), 11 deletions(-)","diff":"diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c\nindex 6399141b4f0a..de82eb6ed473 100644\n--- a/fs/netfs/buffered_write.c\n+++ b/fs/netfs/buffered_write.c\n@@ -150,6 +150,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t}\n \n \tdo {\n+\t\tenum netfs_folio_trace trace;\n \t\tstruct netfs_folio *finfo;\n \t\tstruct netfs_group *group;\n \t\tunsigned long long fpos;\n@@ -223,7 +224,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\t\tif (unlikely(copied == 0))\n \t\t\t\tgoto copy_failed;\n \t\t\tnetfs_set_group(folio, netfs_group);\n-\t\t\ttrace_netfs_folio(folio, netfs_folio_is_uptodate);\n+\t\t\ttrace = netfs_folio_is_uptodate;\n \t\t\tgoto copied;\n \t\t}\n \n@@ -239,7 +240,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\t\tfolio_zero_segment(folio, offset + copied, flen);\n \t\t\t__netfs_set_group(folio, netfs_group);\n \t\t\tfolio_mark_uptodate(folio);\n-\t\t\ttrace_netfs_folio(folio, netfs_modify_and_clear);\n+\t\t\ttrace = netfs_modify_and_clear;\n \t\t\tgoto copied;\n \t\t}\n \n@@ -247,11 +248,13 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\tif (!maybe_trouble && offset == 0 && part >= flen) {\n \t\t\tcopied = copy_folio_from_iter_atomic(folio, offset, part, iter);\n \t\t\tif (likely(copied == part)) {\n-\t\t\t\tif (finfo)\n+\t\t\t\tif (finfo) {\n+\t\t\t\t\ttrace = netfs_whole_folio_modify_filled;\n \t\t\t\t\tgoto folio_now_filled;\n+\t\t\t\t}\n \t\t\t\t__netfs_set_group(folio, netfs_group);\n \t\t\t\tfolio_mark_uptodate(folio);\n-\t\t\t\ttrace_netfs_folio(folio, netfs_whole_folio_modify);\n+\t\t\t\ttrace = netfs_whole_folio_modify;\n \t\t\t\tgoto copied;\n \t\t\t}\n \t\t\tif (copied == 0)\n@@ -273,7 +276,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\t\tif (copied > finfo->dirty_len)\n \t\t\t\tfinfo->dirty_len = copied;\n \t\t\tfinfo->dirty_offset = 0;\n-\t\t\ttrace_netfs_folio(folio, netfs_whole_folio_modify_efault);\n+\t\t\ttrace = netfs_whole_folio_modify_efault;\n \t\t\tgoto copied;\n \t\t}\n \n@@ -299,7 +302,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\t\tif (unlikely(copied == 0))\n \t\t\t\tgoto copy_failed;\n \t\t\tnetfs_set_group(folio, netfs_group);\n-\t\t\ttrace_netfs_folio(folio, netfs_just_prefetch);\n+\t\t\ttrace = netfs_just_prefetch;\n \t\t\tgoto copied;\n \t\t}\n \n@@ -313,7 +316,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\t\tif (offset == 0 && copied == flen) {\n \t\t\t\t__netfs_set_group(folio, netfs_group);\n \t\t\t\tfolio_mark_uptodate(folio);\n-\t\t\t\ttrace_netfs_folio(folio, netfs_streaming_filled_page);\n+\t\t\t\ttrace = netfs_streaming_filled_page;\n \t\t\t\tgoto copied;\n \t\t\t}\n \n@@ -328,7 +331,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\t\tfinfo->dirty_len = copied;\n \t\t\tfolio_attach_private(folio, (void *)((unsigned long)finfo |\n \t\t\t\t\t\t\t     NETFS_FOLIO_INFO));\n-\t\t\ttrace_netfs_folio(folio, netfs_streaming_write);\n+\t\t\ttrace = netfs_streaming_write;\n \t\t\tgoto copied;\n \t\t}\n \n@@ -341,9 +344,11 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\t\tif (unlikely(copied == 0))\n \t\t\t\tgoto copy_failed;\n \t\t\tfinfo->dirty_len += copied;\n-\t\t\tif (finfo->dirty_offset == 0 && finfo->dirty_len == flen)\n+\t\t\tif (finfo->dirty_offset == 0 && finfo->dirty_len == flen) {\n+\t\t\t\ttrace = netfs_streaming_cont_filled_page;\n \t\t\t\tgoto folio_now_filled;\n-\t\t\ttrace_netfs_folio(folio, netfs_streaming_write_cont);\n+\t\t\t}\n+\t\t\ttrace = netfs_streaming_write_cont;\n \t\t\tgoto copied;\n \t\t}\n \n@@ -364,8 +369,8 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,\n \t\t\tfolio_detach_private(folio);\n \t\tfolio_mark_uptodate(folio);\n \t\tkfree(finfo);\n-\t\ttrace_netfs_folio(folio, netfs_streaming_cont_filled_page);\n \tcopied:\n+\t\ttrace_netfs_folio(folio, trace);\n \t\tflush_dcache_folio(folio);\n \n \t\t/* Update the inode size if we moved the EOF marker */\ndiff --git a/include/trace/events/netfs.h b/include/trace/events/netfs.h\nindex ee7fea84f055..67f6d56c94ce 100644\n--- a/include/trace/events/netfs.h\n+++ b/include/trace/events/netfs.h\n@@ -178,6 +178,7 @@\n \tEM(netfs_just_prefetch,\t\t\t\"mod-prefetch\")\t\\\n \tEM(netfs_whole_folio_modify,\t\t\"mod-whole-f\")\t\\\n \tEM(netfs_whole_folio_modify_efault,\t\"mod-whole-f!\")\t\\\n+\tEM(netfs_whole_folio_modify_filled,\t\"mod-whole-f+\")\t\\\n \tEM(netfs_modify_and_clear,\t\t\"mod-n-clear\")\t\\\n \tEM(netfs_streaming_write,\t\t\"mod-streamw\")\t\\\n \tEM(netfs_streaming_write_cont,\t\t\"mod-streamw+\")\t\\\n","prefixes":["06/11"]}