From patchwork Wed Oct 19 08:23:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212636wrs; Wed, 19 Oct 2022 02:07:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cE4QMndo6gCccGU9whQKBI44DJXWN1hKkITee2y8SLJnYBF8ae7zt/fNESAp2HqEOV5xO X-Received: by 2002:a17:907:c03:b0:781:fd5a:c093 with SMTP id ga3-20020a1709070c0300b00781fd5ac093mr5876021ejc.89.1666170477724; Wed, 19 Oct 2022 02:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170477; cv=none; d=google.com; s=arc-20160816; b=OSLm2As4ym6DqXEIvvAzKPKwGPq7HSs17men/+KA7ypXV+zGi4zrJOxj6SKtTbV5P/ FIW9/poiUmKR18epXEIdVDCbRe+oVwJSye0cQ3FHOqUz7/X6qTIgBRQD9U1ZwYkY6Xcd JdruBXYYK3s4EPvvjR00oAhRxK2AB8YtQlMH2zSqt5Ul+xFS1xOtwueg1410TpSG0eJp ihBWfD6uCVddS9IT4Z7uEyvDFsiIzQkV8EKl9Q7d5k0d8KCQizX529vYvZO7meFYUpD5 H7YweYg7olZUlrt9hWrAnDQS01NyvQDWlg0iEQpcooWX/B+x1WFqtWhNG+dQkaawvCCS og1A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a19-20020a50e713000000b00458d23f9fd5si12963310edn.242.2022.10.19.02.07.24; Wed, 19 Oct 2022 02:07:57 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106374704015357?= X-GMAIL-MSGID: =?utf-8?q?1747106374704015357?= 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;