From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.238 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796502305; b=BnPhppVATcRY4F56joqcDMviCZriwDCKJTf30oldFwICF5MJ2a2qfWPmtQmE1j4BtE6q Y2TWsejN25mBYaUqpBlrN1bqocLWxUilmh7a3E3dLPBDyh9IoOVqgRyemBwF09qUU0D21 9Q963tlO8fwEOxbOqWyE45ecDffERnkLfUvVIo4IGZeCq2haaOapF4LWHhM8z7IZFMexQ 5CHgxrETgdANyXLJqfpVWMlaQ5fkahYBJ7CP7G6vH/mo7tU1tnBfkyFNCL7nJxLUbMwAU QbHutacJXbz1NJNDv4iACVnBMHsEVKXGGpzVmTmxcFZoHbewxJMG+ltOCqBeCk9Fm2g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796502305; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:From:To:Cc:References:Content-Language:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=uhCI48ka5yMI+ivMb8pKOlYApp7G0cLLZrpGdobY0XQ=; b=tsNa/NQp+f5ZjNlghbH9ybJaqzlNJBwyNiKQHUale5nVLHVSUm2MNDwBEaMkilnesGMM zl5XkphyIDz2l9jX2y2mM6fOhyUXnvr2Ff0XzE64JD4bRpvSVZauukNZVkdPM9keijkcg G/p2Mp5S8iRVm3V5PeoEPUjT7QK49toFfwXUiskprCeM/iYVAutfR9+38lMkEsq1ZaMSJ 3McAIr1GU5apYP8v6lKsqqlAID5tcq0U3houbLXlm6s1ueMXI794ra5xloOcOFIVPxYns eK+7mil4jWaS0o3hKq2GkCNA7M4uMygn39YY4gvS/eTevunwemKOvO0YLmzllsbrdfA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b="fOZ3/xuf"; arc=none smtp.remote-ip=91.218.175.238 Received: from mta0.migadu.com (out-238.mta0.migadu.com [91.218.175.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95578606A322 for ; Sat, 5 Dec 2026 20:25:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 95578606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fOZ3/xuf X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=5DAc17Wcl28OZqw+duH7KnuTg5iQkEF9VAcHlA0r4zc=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796502302; v=1; x=1797107102; b=fOZ3/xufFkJwHoEPvYkUY2/mSDEDUn4CTpLnqtXLC4FdBvB6fYxGREV5Wrxf5rq2y+JgLHSf 8DNFnPIYafcNDhUviD7AQ7wK9NO4i+0MKCfVrqYHzH/gqN4mOwv/7l5UTgPuGYD0mQ2syhhyP+x Rr5AWQKGv9mftUDGpP8JNPsU= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta12.migadu.com with ESMTPS id 037887ebb5709291; Sat, 05 Dec 2026 20:25:01 +0000 X-Mizu-Trace-ID: 037887ebb5709291 X-Migadu-Flow: FLOW_OUT Message-ID: Date: Sat, 5 Dec 2026 20:24:58 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: (2) (2) [PATCH v2] xfs: check the disk address for hardware atomic writes From: John Garry To: daejun7.park@samsung.com, Carlos Maiolino , "linux-xfs@vger.kernel.org" Cc: Pankaj Raghav Partha Sarathy , Pankaj Raghav , "Darrick J. Wong" , Christoph Hellwig , Dave Chinner , "linux-kernel@vger.kernel.org" References: <20261112-xfs-hw-atomic-align-v2-1-c90394805e7b@samsung.com> <20261113025544epcms2p575490538b97c26387515f8b5fc90c321@epcms2p5> <20261116073903epcms2p13ca5bac24c591ae487f0b30dc45b87f8@epcms2p1> <96330e94-d3c0-447c-aef0-7c56b24e122b@linux.dev> Content-Language: en-US In-Reply-To: <96330e94-d3c0-447c-aef0-7c56b24e122b@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/16/26 08:11, John Garry wrote: >>> t_awu_max is the HW max, and you are saying that it is not aligned with >>> the AG size (and so need a disk alignment check). However, opt max >>> should be (aligned to AG size), so we could check that vs size instead. >> > > uhhh... I thought about this a bit more, and I am really not sure on the > best solution. On one hand, atomic writes whose length is above opt max > should not use HW atomics. Or, more specifically, the user can't expect > HW atomics to be used. However, if HW atomic is possible, then it would > be silly not to use it. > >> Thanks, agreed. v3 will check the size instead of the disk address, >> in both xfs_file_dio_write_atomic() and >> xfs_bmap_hw_atomic_write_possible(). The limit is the one max_opt >> applies: the smaller of bt_awu_max and the largest power-of-two factor >> of the group size. Below that limit the existing br_startblock check is >> enough, so v3 drops the disk address check. >> >> v3 puts this limit in a helper that xfs_get_atomic_write_max_opt() also >> uses, so max_opt and the checks use the same hardware limit. The checks >> call the helper rather than max_opt, since max_opt is 0 on a filesystem >> without reflink. When I tried max_opt there, the one-block atomic >> writes went to COW and failed with -EINVAL. The helper returns >> bt_awu_max when there are no groups, which is the rt device without >> rtgroups. >> >>> BTW, with your proposed change, since HW size is not aligned to AG size >>> and we only check the size vs HW size for HW offload, it is in theory >>> possible to have an atomic write which straddles the AG and is rejected, >>> right? >> >> Userspace does not see a rejection. Such a write maps to two extents, >> so xfs_bmap_hw_atomic_write_possible() returns false and the write goes >> through COW. > > Yeah, I was really asking if HW atomic could span 2x extents before we > catch it. > >> This is the same in v2 and v3. In v3, a write sent to the >> hardware is also aligned and no larger than the group alignment, so it >> cannot cross a group boundary. >> > Maybe what you have in this patch is ok. I'll wait for v3 and consider > it more. Sorry for the hesitancy. Hi Daejun, Were you planning on progressing this? I don't remember seeing anything lately. I am still thinking that limiting atomic opt max to always be aligned with the AG size would be best. After all, we do recommend to format the FS for the desired atomic write size. Thanks, John