Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4417056ybc; Tue, 26 Nov 2019 08:37:10 -0800 (PST) X-Google-Smtp-Source: APXvYqyS0fyepznEujC97Rj4/qfjfdtr2hayImjxzAFQ5+2c+LomZR+DiNWmFKsQ0y6BcCEgjiTH X-Received: by 2002:a17:906:1e16:: with SMTP id g22mr29296974ejj.78.1574786230418; Tue, 26 Nov 2019 08:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574786230; cv=none; d=google.com; s=arc-20160816; b=lVyhUXH2+F68EIBNJulEasmbeZ9SHXeO6nPGnyFQKZ+oxNorO63F1rfVZIGnyObo0G IyNgQ80e/PpWsQwEqNqsBOENZSz3PsQyCBfQzukyfp+dug1kSEo/MiQo6ZMVPqaKMuLk nfi/azDsRPBSbCu3Xl30pdn4q/OrJIE5P5qP4XkuYC6TG2jC/ARmKNrtPiFRFCYfPQZd K2k85zpn3gtTJlXxTvlUdCVAiop5Z7jY5pjcfNt1/I/0+em9PWbdXmZlsm5iwM2DPEW9 COIk/4L5Muok1cOW6lKqJbMWdvPHLE6iD9tHU3WDBuCBzOmMKFrtYHp5kLeYTgef2w8x uliQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cP6D8d93btaoA8qKKMvE5cAQ11moEVEbDuB/dLF9EyE=; b=zVLElAxS+8GgTscVSLKt9mdajq9rU/nCnAmcAuugoMEYjfsL30Jusq+4awWickBlki UgQeQWZqOqGoiMQFZEQm+s8biSXvH/dBt4jv+Xebr61fO4IUsOpizkUfat26jNm/fy3/ n5BWUl2pb07J/tJTwoKoB6hCJZoz+/wkUjH9Kpk1kCWI450YDAaLydU/8WWAtEw09vsr 7nlRZ6VWJVQbcUHWqoX+vBFpatFqponVcK7bC+aO8Ug7qJkmOsHS8Pa6/LL9rXR7sMi1 uyMit9grWuJrl2IaX4dTDHrO7VzQvJJFI1anOub5GDrZMjx5DKzfki4Zc6Y/oLjopt+s TNvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=O865r2R5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2si9155792edd.140.2019.11.26.08.36.44; Tue, 26 Nov 2019 08:37:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=O865r2R5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727756AbfKZQdR (ORCPT + 99 others); Tue, 26 Nov 2019 11:33:17 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:57696 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbfKZQdR (ORCPT ); Tue, 26 Nov 2019 11:33:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cP6D8d93btaoA8qKKMvE5cAQ11moEVEbDuB/dLF9EyE=; b=O865r2R5Df3+XvnupVgKsHKR7 N+KUqyQTu01ck0k+RGuNCnvWDOXz7KHLCfS8l/GsJyvXcmIQ6RBDborEb6f0ta0fPiQDiIaVtsl2n iFvwBw8eA0/Z0sQ4qintTOrKzZbOzr56Rd/Jn15ThIhKWQ8N9HfajwHZ4vLTBm2ee7++zRj7QcnGD ROfwSDHIaVb7+UFgFQxUgequQ6/OY0xQGr0ihFwX+MqOJ9Di0d6e3TbsmfDPWrAj0KX+AFWh4ffv7 Vug3oVJnr52Eav3PwickrC1puoquU+b/ti23rL5+SsQa6lYYe6uM3Je87dd9aoAKevQCasRMROtcX jyBhJcMWw==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iZdm7-0005YJ-4G; Tue, 26 Nov 2019 16:33:15 +0000 Date: Tue, 26 Nov 2019 08:33:15 -0800 From: Christoph Hellwig To: Damien Le Moal Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-fsdevel@vger.kernel.org, Javier Gonzalez , Shinichiro Kawasaki Subject: Re: [PATCH] f2fs: Fix direct IO handling Message-ID: <20191126163315.GB3794@infradead.org> References: <20191126075719.1046485-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191126075719.1046485-1-damien.lemoal@wdc.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 26, 2019 at 04:57:19PM +0900, Damien Le Moal wrote: > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index 5755e897a5f0..8ac2d3b70022 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -1073,6 +1073,8 @@ int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from) > int flag; > int err = 0; > bool direct_io = iocb->ki_flags & IOCB_DIRECT; > + bool do_direct_io = direct_io && > + !f2fs_force_buffered_io(inode, iocb, from); I don't think this is the right fix. The proper fix is to clear IOCB_DIRECT when falling back to buffered I/O, preferably in the filemap.c helpers as well.