Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4270569pxb; Mon, 27 Sep 2021 13:07:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf3RODPUFqTMojLCb6wAtSnIF7XrGtdHz/KSj3VcdTGqqD6Zk8OvAoIp+Q9ZyckYX9DjZJ X-Received: by 2002:a17:902:7781:b0:13d:c9fe:6184 with SMTP id o1-20020a170902778100b0013dc9fe6184mr1473200pll.25.1632773271979; Mon, 27 Sep 2021 13:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632773271; cv=none; d=google.com; s=arc-20160816; b=D3L6OU/moqos05rZbrBz2IUtClZ3riDKO7Z01UHwHhUUnJbef7NCse8sYHF2s/xu4y u0bBbAC0cL+BPr/LOqmMQ1JkX4Ww3aD00n8jofNhjE/gWMpexT9jSrSrk79+A9GV+4WN pGb3dpQosAAR0QVkaU9ixBNbjlLXs2A4EVYHpwIUMwRgcZCHvDGRmS1zeA8sC0YFYdT8 n88mum7Fuz+FAGoioIi/TyS/WhUlYyzfDcZDOTX101LTVLOJs6B3opaAP43vmDWzFaHH UPYZFqYc195yboQjzgDoB6cexHESCnbm4hu57IZybfI8jZBrFfgPbfgxpUEqJgnELCN0 tc9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=kxAIhH1YVtxRZIYXNVbyWMpsZD18tjPURBL8yhlODKY=; b=u4H47ly/ArNLQPmKtWnJOiruSmCyGdNmv+ekqmo+Yk/Qkt53M3Xtb73S2muMGYt71Y 0kU/kxh9940xYlzHwrzT4r64KYv8xibDH1/sgXDLdbvxTVj/KJD1ccY0uG/yUxTBsOnT KExwfrwXsUXYSfXEdDzJCdGdWDF2xitv6AWraR/9xhS1ho+bE0ZLfhikxvTcltslZoiv qBcLjFLGFm9QqebFLd0+kwTWUmSDhCECp9PadlvPolLoXFVqHxUA7KeBYQ+giSWhIFe4 Cjw3gDOkBxfDYU6RmBX6M93obPs2upF3Fq7UF5VSjHyfSEPF2zndISScp8DYrTQ6lT/O 67DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="rqCL/Zfa"; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si21398479pgu.329.2021.09.27.13.07.35; Mon, 27 Sep 2021 13:07:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="rqCL/Zfa"; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236779AbhI0UJJ (ORCPT + 99 others); Mon, 27 Sep 2021 16:09:09 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:39998 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236733AbhI0UJG (ORCPT ); Mon, 27 Sep 2021 16:09:06 -0400 Received: from relay1.suse.de (relay1.suse.de [149.44.160.133]) by smtp-out2.suse.de (Postfix) with ESMTP id AE35B1FF7C; Mon, 27 Sep 2021 20:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1632773245; h=from:from:reply-to:reply-to: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=kxAIhH1YVtxRZIYXNVbyWMpsZD18tjPURBL8yhlODKY=; b=rqCL/ZfaKLBBJ11Lvyjkmko7G0IT9x86WIcCx9OduTjm1NgsLZkg1W4/Fe1cCG/Qk9Yn8S 4UptkV/P2rPm+amFEtaKPN0FQNf0vfitqRtoMdyT/aUQpEjjB27ybGR9tRkeTK0IWi6EvT 6Aqpa+pvsMRplJz18xNNO1ZRkBSH1D8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1632773245; h=from:from:reply-to:reply-to: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=kxAIhH1YVtxRZIYXNVbyWMpsZD18tjPURBL8yhlODKY=; b=QEbbg8qe4mXGT8/Upe6yCLvS822wAxZpuHOGT5K9AL53fjW4hFZgMNlgvVQ4RqvbLrzxR0 6bmSu51+HcRz6eCA== Received: from ds.suse.cz (ds.suse.cz [10.100.12.205]) by relay1.suse.de (Postfix) with ESMTP id 389D425D42; Mon, 27 Sep 2021 20:07:24 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 862D3DA799; Mon, 27 Sep 2021 22:07:08 +0200 (CEST) Date: Mon, 27 Sep 2021 22:07:08 +0200 From: David Sterba To: David Howells Cc: willy@infradead.org, hch@lst.de, trond.myklebust@primarydata.com, Theodore Ts'o , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, Trond Myklebust , "Darrick J. Wong" , Jeff Layton , Andreas Dilger , Anna Schumaker , linux-mm@kvack.org, Bob Liu , "Darrick J. Wong" , Josef Bacik , Seth Jennings , Jens Axboe , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-cifs@vger.kernel.org, Chris Mason , David Sterba , Minchan Kim , Steve French , NeilBrown , Dan Magenheimer , linux-nfs@vger.kernel.org, Ilya Dryomov , linux-btrfs@vger.kernel.org, viro@zeniv.linux.org.uk, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH v3 0/9] mm: Use DIO for swap and fix NFS swapfiles Message-ID: <20210927200708.GI9286@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, David Howells , willy@infradead.org, hch@lst.de, trond.myklebust@primarydata.com, Theodore Ts'o , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, Trond Myklebust , "Darrick J. Wong" , Jeff Layton , Andreas Dilger , Anna Schumaker , linux-mm@kvack.org, Bob Liu , "Darrick J. Wong" , Josef Bacik , Seth Jennings , Jens Axboe , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-cifs@vger.kernel.org, Chris Mason , David Sterba , Minchan Kim , Steve French , NeilBrown , Dan Magenheimer , linux-nfs@vger.kernel.org, Ilya Dryomov , linux-btrfs@vger.kernel.org, viro@zeniv.linux.org.uk, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org References: <163250387273.2330363.13240781819520072222.stgit@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <163250387273.2330363.13240781819520072222.stgit@warthog.procyon.org.uk> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Sep 24, 2021 at 06:17:52PM +0100, David Howells wrote: > > Hi Willy, Trond, Christoph, > > Here's v3 of a change to make reads and writes from the swapfile use async > DIO, adding a new ->swap_rw() address_space method, rather than readpage() > or direct_IO(), as requested by Willy. This allows NFS to bypass the write > checks that prevent swapfiles from working, plus a bunch of other checks > that may or may not be necessary. > > Whilst trying to make this work, I found that NFS's support for swapfiles > seems to have been non-functional since Aug 2019 (I think), so the first > patch fixes that. Question is: do we actually *want* to keep this > functionality, given that it seems that no one's tested it with an upstream > kernel in the last couple of years? > > There are additional patches to get rid of noop_direct_IO and replace it > with a feature bitmask, to make btrfs, ext4, xfs and raw blockdevs use the > new ->swap_rw method and thence remove the direct BIO submission paths from > swap. > > I kept the IOCB_SWAP flag, using it to enable REQ_SWAP. I'm not sure if > that's necessary, but it seems accounting related. > > The synchronous DIO I/O code on NFS, raw blockdev, ext4 swapfile and xfs > swapfile all seem to work fine. Btrfs refuses to swapon because the file > might be CoW'd. I've tried doing "chattr +C", but that didn't help. There was probably some step missing. The file must not have holes, so either do 'dd' to the right size or use fallocate (which is recommended in manual page btrfs(5) SWAPFILE SUPPORT). There are some fstests exercising swapfile (grep -l _format_swapfile tests/generic/*) so you could try that without having to set up the swapfile manually.