Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp229779lqe; Tue, 9 Apr 2024 23:22:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3hNUBswKzY0mr1a920educD1VRblf2WE55PvmPzHQ0+Fv2QiU/l9xqV56jcTyInyoieJM2UPlP7OHfadJ6GgBrF5i8agkbR9lo/NBOg== X-Google-Smtp-Source: AGHT+IHywlFN0IOYBBUaMaOaiwx06NNow5dHoyIeQJ0AMbAFHfPePOSM0U+h1o4Yc6UfOqTur2Jb X-Received: by 2002:a05:6a20:394b:b0:1a7:a3cb:78f3 with SMTP id r11-20020a056a20394b00b001a7a3cb78f3mr1919083pzg.12.1712730142684; Tue, 09 Apr 2024 23:22:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712730142; cv=pass; d=google.com; s=arc-20160816; b=oj9ulg5qsfYCkLuvbRm9HQ3zL3YcD1Qjbd/uHRyz6O6jKW8Xx9xWV5HZPdGgWJCR0R 7JqcM9EVQDdq11UYrL2hVbngvqBKzWtI9+qXuZ7sx44U6uwMR0ksyfFNstEkleTW1KMi 6H64UYrejIoDQzlhKHfq5HLVJXDG1w+iRUhP3m8AQWi1enSFZ8ELT03a+6mUHewPtLR0 71k88FSt5+s2eirGpy5aoL3QKjgx56a1hpqnVQ4zdmBPSJheUtYUyQeu3jgskDatww1d la/NyTkQL33jziDpZAiN5P9kaVrbW7F4VHke4pB6aBxCIA+/9xEDzEMbc3OUncWyE07r na6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=yJIujaH3RXIktcRv88URJI4c3MW1XPtMbHZWqI5VmXc=; fh=a0XGKsb8XS9vW6gQFqxRdX2MVCavHeDbELfI0h0hLLw=; b=FrQY5rdiUSKR23JjirN9sHn78NsQv2vzZAUWPqa6J95RGnwJiQPVEwEJIdFKD8SjDC dYLt7YKxcakrgZhjIk0VQPzmt+Q6rYSEf4n8XUPHKWE1omsU/oNkZkPm6oJ9ZTdqN/8E MTQx+hp+hSvCaL5mTLjy7VSxaOUmVPI4za8TzZCjjvp7koqnyVnMur6yqzc4w5j1ttJn 63ygCp6PmtIIu9DkSsYndnewx7GA1r/6OXS2eEsOe9ia6+MoX24Q17bkmLJ9vg3vCkzm //uQgG9/t4JnTPMPLK1MZQpsSqGV+GgNmaRZ7g4EPxne4g3Va/XWC5n8cWyeM/l2HFU8 22rQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DRH5op6+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="0jV/eoo4"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DRH5op6+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-137977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bt4-20020a17090af00400b002a46f059bf0si901859pjb.41.2024.04.09.23.22.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 23:22:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DRH5op6+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="0jV/eoo4"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DRH5op6+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-137977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1E61FB230E4 for ; Wed, 10 Apr 2024 06:21:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F30038DF1; Wed, 10 Apr 2024 06:20:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DRH5op6+"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="0jV/eoo4"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DRH5op6+"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="0jV/eoo4" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 668ED20304; Wed, 10 Apr 2024 06:20:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712730044; cv=none; b=O9Mp0poj9kWHym7tiVHOLGZlTwmcqgS/NyAqeVfHRiOUP+NcK4+pLXbKi2i48A73Fv6AUhj2Aty/8beISjwEwfpbbdmLdrBV2jmd2gbvpsxIg9l1YQzxkVWTLD1lU7ohqwuuW5rsdUYi1E74VvozmIHXKeakYwGJrVl10DnvfGQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712730044; c=relaxed/simple; bh=SVgnyvJn4+dftj5N9qiNFUfNLaC+N6iSxocInF85y/8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JpTyfPXzWkiF/JUek0khNCnccF2tIkjLKMedKyK21Csq42rDMlIuzkHLrm3KmMT01PRftCn1sIFFcOABCnED/r3bhHHAkgXQ5thCR0cnqJjqgwb8NknwuBQYuk48kFIqqAI7XzICE7Pm3jDXN6/w1I4UGF2Qeuiep8Rez8OQopk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=DRH5op6+; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=0jV/eoo4; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=DRH5op6+; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=0jV/eoo4; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8A4D3349E5; Wed, 10 Apr 2024 06:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712730040; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yJIujaH3RXIktcRv88URJI4c3MW1XPtMbHZWqI5VmXc=; b=DRH5op6+qgu/ZbeaZUaYpnIYWqjeWpHK8OW0+kwvqDCMEwaguq5aqaXafgAjwJ6zywhusF tsgFsWgaCMMY4NaTEaGk3lDtHCR73mjQ4SRA1LnqLj9EF0l+PnSJ2BlijBLHcS98VKUP8t Vf4bNVGD5TMPNXoHOH52Hod45ruzXX8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712730040; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yJIujaH3RXIktcRv88URJI4c3MW1XPtMbHZWqI5VmXc=; b=0jV/eoo4drBjtHKjxE/GtnE1W1+NVg3WllILQl+VLv9gNYfTXrOGjwpUFYpLOwg0GRsGjF 4Wxv4HCZCDpVodDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712730040; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yJIujaH3RXIktcRv88URJI4c3MW1XPtMbHZWqI5VmXc=; b=DRH5op6+qgu/ZbeaZUaYpnIYWqjeWpHK8OW0+kwvqDCMEwaguq5aqaXafgAjwJ6zywhusF tsgFsWgaCMMY4NaTEaGk3lDtHCR73mjQ4SRA1LnqLj9EF0l+PnSJ2BlijBLHcS98VKUP8t Vf4bNVGD5TMPNXoHOH52Hod45ruzXX8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712730040; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yJIujaH3RXIktcRv88URJI4c3MW1XPtMbHZWqI5VmXc=; b=0jV/eoo4drBjtHKjxE/GtnE1W1+NVg3WllILQl+VLv9gNYfTXrOGjwpUFYpLOwg0GRsGjF 4Wxv4HCZCDpVodDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CECBE13691; Wed, 10 Apr 2024 06:20:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id InaALLYvFmaJGQAAD6G6ig (envelope-from ); Wed, 10 Apr 2024 06:20:38 +0000 Message-ID: <94d6d88b-b0e7-491d-94e8-dc9e5fba5620@suse.de> Date: Wed, 10 Apr 2024 08:20:37 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 00/10] block atomic writes Content-Language: en-US To: Matthew Wilcox , Luis Chamberlain Cc: John Garry , Pankaj Raghav , Daniel Gomez , =?UTF-8?Q?Javier_Gonz=C3=A1lez?= , axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, jejb@linux.ibm.com, martin.petersen@oracle.com, djwong@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, dchinner@redhat.com, jack@suse.cz, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, jbongio@google.com, linux-scsi@vger.kernel.org, ojaswin@linux.ibm.com, linux-aio@kvack.org, linux-btrfs@vger.kernel.org, io-uring@vger.kernel.org, nilay@linux.ibm.com, ritesh.list@gmail.com References: <20240326133813.3224593-1-john.g.garry@oracle.com> From: Hannes Reinecke In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spamd-Result: default: False [-2.79 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[30]; TAGGED_RCPT(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_RATELIMIT(0.00)[to_ip_from(RLusjj3u5c53i6g8q6enupwtij)]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[oracle.com,samsung.com,kernel.dk,kernel.org,lst.de,grimberg.me,linux.ibm.com,zeniv.linux.org.uk,redhat.com,suse.cz,vger.kernel.org,lists.infradead.org,mit.edu,google.com,kvack.org,gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email] X-Spam-Score: -2.79 X-Spam-Flag: NO On 4/10/24 06:05, Matthew Wilcox wrote: > On Mon, Apr 08, 2024 at 10:50:47AM -0700, Luis Chamberlain wrote: >> On Fri, Apr 05, 2024 at 11:06:00AM +0100, John Garry wrote: >>> On 04/04/2024 17:48, Matthew Wilcox wrote: >>>>>> The thing is that there's no requirement for an interface as complex as >>>>>> the one you're proposing here. I've talked to a few database people >>>>>> and all they want is to increase the untorn write boundary from "one >>>>>> disc block" to one database block, typically 8kB or 16kB. >>>>>> >>>>>> So they would be quite happy with a much simpler interface where they >>>>>> set the inode block size at inode creation time, >>>>> We want to support untorn writes for bdev file operations - how can we set >>>>> the inode block size there? Currently it is based on logical block size. >>>> ioctl(BLKBSZSET), I guess? That currently limits to PAGE_SIZE, but I >>>> think we can remove that limitation with the bs>PS patches. >> >> I can say a bit more on this, as I explored that. Essentially Matthew, >> yes, I got that to work but it requires a set of different patches. We have >> what we tried and then based on feedback from Chinner we have a >> direction on what to try next. The last effort on that front was having the >> iomap aops for bdev be used and lifting the PAGE_SIZE limit up to the >> page cache limits. The crux on that front was that we end requiring >> disabling BUFFER_HEAD and that is pretty limitting, so my old >> implementation had dynamic aops so to let us use the buffer-head aops >> only when using filesystems which require it and use iomap aops >> otherwise. But as Chinner noted we learned through the DAX experience >> that's not a route we want to again try, so the real solution is to >> extend iomap bdev aops code with buffer-head compatibility. > > Have you tried just using the buffer_head code? I think you heard bad > advice at last LSFMM. Since then I've landed a bunch of patches which > remove PAGE_SIZE assumptions throughout the buffer_head code, and while > I haven't tried it, it might work. And it might be easier to make work > than adding more BH hacks to the iomap code. > > A quick audit for problems ... > > __getblk_slow: > if (unlikely(size & (bdev_logical_block_size(bdev)-1) || > (size < 512 || size > PAGE_SIZE))) { > > cont_expand_zero (not used by bdev code) > cont_write_begin (ditto) > > That's all I spot from a quick grep for PAGE, offset_in_page() and kmap. > > You can't do a lot of buffer_heads per folio, because you'll overrun > struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; > in block_read_full_folio(), but you can certainly do _one_ buffer_head > per folio, and that's all you need for bs>PS. > Indeed; I got a patch here to just restart the submission loop if one reaches the end of the array. But maybe submitting one bh at a time and using plugging should achieve that same thing. Let's see. >> I suspect this is a use case where perhaps the max folio order could be >> set for the bdev in the future, the logical block size the min order, >> and max order the large atomic. > > No, that's not what we want to do at all! Minimum writeback size needs > to be the atomic size, otherwise we have to keep track of which writes > are atomic and which ones aren't. So, just set the logical block size > to the atomic size, and we're done. > +1. My thoughts all along. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich