From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796502304; b=F+XtbNtVuYW8b/ltvqzjsmKS+6jw+1YzZYuVe9mLI72QY5TSZ9g0yH9s5PjIRbYQcQMz 5x+cs8nJP1onpg/Dy44Tetq82Pz/GCu3ZG3v7haOCwqljZqgu8uMA9wkXrHUeXOv39nZX rbVq/CBaM6gUmP0n1C8+sGZfqvsMaoSJ7hqwkbkAYd0e/H32MKjBs60XwmC8/f/L4rEI6 OTmqT861RDklyArW8h6LZhzj4lxFvbwZpVvEI5Tcjt9xiR2W3LL4HmNOyZFlv5wWD33rh CycPaqe1eGeUEJw7w6DbpwF5yDvfHiDo4H8E7Wmlv8hZn7yv4vsD9LfrR75/ojk8IJg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796502304; 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=mY/abq81uIPRJCh9ZPVQUO6IWEPqkq4bDd/jIX7HgyOZtaxJcK8MihMBUL8xIo6m+fNr i3RHJk1/Jyak3WD6dsVQ/6sIBlOPoyDY8OjkSxbqBAtMiD+Ca6AP48ngMunraIKeM0sDg Mq2bSvcgcDOh+cPLcJD+oaBX9Lm3Spythc0OOqEjBwplRGbOnbasXIp3W0/kGJY78l2W0 4bYj6Kpp81TjuwCaD9OVf9n/EidkQAGTWVX5jV20ufExfLKuPFXNBPuPtuiiW6rK9i2zV yPNRRfyniNz8t6qw1wjGKVoFoOd7QETYFUVgYqY/nsmzI4RgnQRJKT28fOYqsFlT3Qg== 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=95.215.58.42 Received: from mta1.migadu.com (out-42.mta1.migadu.com [95.215.58.42]) (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 3A1F6606A31F for ; Sat, 5 Dec 2026 20:25:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3A1F6606A31F 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-xfs@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-xfs@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-xfs@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