Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp313419qtb; Wed, 19 Oct 2022 02:37:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zKs9n0731iQMTl3sFMpY/5Ounz+dh4cmxEWrZLE0zF4otoKPPsw9y6wnFWQdFmsjGYO1y X-Received: by 2002:a05:6402:1587:b0:458:fbea:436c with SMTP id c7-20020a056402158700b00458fbea436cmr6544575edv.407.1666172228438; Wed, 19 Oct 2022 02:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172228; cv=none; d=google.com; s=arc-20160816; b=pywEqaugi3pE4/jEwXsxLq+c9H03Gr+IHMqLoA/bqT/WFpjndzrjFQ37RbzbUw55fE foiO83tXstUk9NdyNL43vPRLf8OoM3iCUIvvFKHc8iA0DyBNd7cfR6CHR8P0a0JPgvAz ssjYaz7perg+7bhsDhZoEvc/gq1MJbu6kI41zW3qJY7cnTC+u1f9cwVFykMHAql0O6dS 0CgW0nF4VImOXvDY38ez8BPp7oPXCsZysk7AzRg07/YGEycLMz+At5adps/Z16CtuZVX nN5YtqJZDSdM1CQJGeN0OJQpP4PB/N6y847/rhfreEBundmgULyYuzMZuUk3q9ls/9YS WF1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+Ca/JK1ES9XxIARCe7m69jxOtMtlGDlkjsaKrT2kj3A=; b=xlPhkLAcPKJlvSChb6P50kOKVjNc3Pk7ZzXUU9I4oExcNfRf7DrPyS6+AYqYTiizhZ acmNNTt4MAYooFmNC0ZGv3+xULpwKLRQ0I9BDCRugLQpHXK7iEv488GoNu2ZjbsbYYjw 3Tg1CJQHdEh+v5qiGo511S/X/QS2jGfKmaclIdtAyORajNQ9nlp+6GeCmVCGCkr99umf L+2BDqAerX7lJkrwG49+5PwSEok2CPJR7oX+o7gjMCpYCeJTZLHGyEVdx4+J8ZhwodhX WtDE567zO7vZKx3GA9rjCrjWqGvZ0BYSeevrRoocNcKF9FEfv5LIBi4NtmcMRy2jKf4H Y5Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rZry+AhE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a170906500500b0078255525a6fsi12646809ejj.671.2022.10.19.02.36.42; Wed, 19 Oct 2022 02:37:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rZry+AhE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232216AbiJSJBK (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232147AbiJSI7B (ORCPT ); Wed, 19 Oct 2022 04:59:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3601C915E8; Wed, 19 Oct 2022 01:54:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C555561812; Wed, 19 Oct 2022 08:43:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB02DC433B5; Wed, 19 Oct 2022 08:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169014; bh=tI+zdfLWq2WDPFJtTUntPD5m6A/o/lCJZwMbVoHVPPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZry+AhEsa/edDmHgT5wKfTTr+XNoZsoYADt9sG8o7mj7Re2Y8VGsKj8O/otqKLL1 32iCKA4sfwyUmMgYm6Lih6IxFiPGPjJwoE3Td79wLVnsFkytSmvt8qWuRMgu4TV49H 3sqNHvqXapiy9/1e6kEzHX4dZsnMPX36DSN/49hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eunhee Rho , Chao Yu , Jaegeuk Kim Subject: [PATCH 6.0 129/862] f2fs: allow direct read for zoned device Date: Wed, 19 Oct 2022 10:23:36 +0200 Message-Id: <20221019083255.670387512@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jaegeuk Kim commit 689fe57e7ecefd2eeba76c32aa569bb3e1e790d9 upstream. This reverts dbf8e63f48af ("f2fs: remove device type check for direct IO"), and apply the below first version, since it contributed out-of-order DIO writes. For zoned devices, f2fs forbids direct IO and forces buffered IO to serialize write IOs. However, the constraint does not apply to read IOs. Cc: stable@vger.kernel.org Fixes: dbf8e63f48af ("f2fs: remove device type check for direct IO") Signed-off-by: Eunhee Rho Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/f2fs.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4513,7 +4513,12 @@ static inline bool f2fs_force_buffered_i /* disallow direct IO if any of devices has unaligned blksize */ if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize) return true; - + /* + * for blkzoned device, fallback direct IO to buffered IO, so + * all IOs can be serialized by log-structured write. + */ + if (f2fs_sb_has_blkzoned(sbi) && (rw == WRITE)) + return true; if (f2fs_lfs_mode(sbi) && (rw == WRITE)) { if (block_unaligned_IO(inode, iocb, iter)) return true;