Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5032135rwl; Mon, 10 Apr 2023 22:35:58 -0700 (PDT) X-Google-Smtp-Source: AKy350ZPew3cAV14bY/Z0PfPWp9fuPgyYjJlvW0G2Hk2k4ribZY1S/4U/2oe2vShCXcZnf49u6dq X-Received: by 2002:aa7:d985:0:b0:504:9b7e:1e5a with SMTP id u5-20020aa7d985000000b005049b7e1e5amr1137615eds.40.1681191357823; Mon, 10 Apr 2023 22:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681191357; cv=none; d=google.com; s=arc-20160816; b=UKBC8/qeIdInjjWpeELJsHmJiYoqsjrP5SSRbPr8+M98dlAAGIGMvb9osRKKH+nM/a 0eITtETx3eWIX+RnlUd5wca9i2MytLyjCi86R/BO7iaeXnFN1kDobduQCnQPlN+znhve 3oO8kVH1aqhNA+NQvQ0FJNesMhhDrEAAcAessdD4F2/BCYj77JccMJRMzcKOeNV5eUBu d8LC7Qx7kjGg4LXZPfvd/40LPcFyM92KNC77qJ1J6v1DCqgKyhXn0meANAhMnDp6mJxm 2oo8nMI4pKP0/PsJGLu7JCmP/Ha1OpXQYpB+paN6vgeIfVoMBo4h1eKwrNkMdPO1BHq/ uR6A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8sHHSgyf7JgSxNIge90EAWqHI+AZ4Hp4QV3xDqyTWSU=; b=jgmjeLUDKKYLGhgY3kwQ97Rb7lOkoD3O/W8duDyIa2jyVT0sg5AxmuGLFFijJQRShf 5DMef4MEO8jzGb+pt6W6Z0Wy47fkGKDXWh2Qy2uOhng7C2Z5Zyo7XSIwF79LnJCq5G9a Rzzp3vc0JJDD7X6x581JCt0EE9Vb1GpRmIcf4cFjShM9HvbSVtU72Gn37hYphsV53ddZ R7Qb6pew9VekX5Yl8VQ0YjahBUm+PCG6XFuSUGfMSDr01Zk56JPqomW84v0dI4iP6un1 eCRSc167jZiu6x4KaHBICIfLG64/tPNASRuNuwZFjAoLce9e5Ljdjw6mdkrY6IIdRPPs dJeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="He/XBW2r"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v26-20020a056402185a00b005046e05e3cbsi2124728edy.71.2023.04.10.22.35.34; Mon, 10 Apr 2023 22:35:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@gmail.com header.s=20210112 header.b="He/XBW2r"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbjDKFWl (ORCPT + 99 others); Tue, 11 Apr 2023 01:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbjDKFWY (ORCPT ); Tue, 11 Apr 2023 01:22:24 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FE122D48; Mon, 10 Apr 2023 22:22:22 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id d22-20020a17090a111600b0023d1b009f52so9762707pja.2; Mon, 10 Apr 2023 22:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681190541; x=1683782541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8sHHSgyf7JgSxNIge90EAWqHI+AZ4Hp4QV3xDqyTWSU=; b=He/XBW2rwYjIDOONpcwrXe8KOwmCl9ast0lIo3eGrALZsraMW+EwUdVMGU0GLPUEED 6GaDsnBcqx6tBinyW6pYxCzJPiBhcSFUYNF832txvsIqxdhGAI9QCxfvWO1oTsJ9jdFW zjQtb+UqcERGTI4J4a5EaYDkSeo5KE3xmze+8Aq6MV7ICBlzwrsOOoKsLrFjKUpHpVxV 2YHSmWo2li1PBib528SNOLpffDAWJeB48klsCcT3BEo7mBhRLqcrcTAD0LwtOim1P5kN wje3ZY0dDMYE65jLSCdeodJBvtWJCKeeZjz3qMgvzotzLhJpISnNA1uRkDWSNW0o7W9H chPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681190541; x=1683782541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8sHHSgyf7JgSxNIge90EAWqHI+AZ4Hp4QV3xDqyTWSU=; b=e/JvAu3536aORkD6+5wrke46WwvrWlT8296/dsL3FFmxbFK5zUKl/6DXhHBJQItED2 htfCQCViWz3YAHCBYJT7tjjS5pxTwSBz9fLFaGzJ6JZV6yWGW6iVn4iO3sEovTCpD15U zjy4o1ZeakjAnwvyLuqc6y4j+TqbFrYQ/IMwf+oBfxZfWJ1pETXwvjcwUOd8IIcdKF1S kLfzflCoLHp5q+/B/PV6WUtBrX4z6KCK64EPEZ6T7msX/Xega/BfjLXwEPp/BWTdf2EY sYMSOXoAw3Z7CBWC8kFbgkrOX/T0ZRzhsyFUVRYz2pNIhUzVWmgFrWWamXtfvoVyNIXS zCHg== X-Gm-Message-State: AAQBX9eWjZ7R1cTIDHvWWn2szljjYy3rv7bGCSnzsJiiu7M9IDCxrP3n LJ36CQbD8GzfSbxcqd3ub+GPpNJNz24= X-Received: by 2002:a17:90b:164c:b0:23d:1aae:29e5 with SMTP id il12-20020a17090b164c00b0023d1aae29e5mr17197608pjb.20.1681190541363; Mon, 10 Apr 2023 22:22:21 -0700 (PDT) Received: from rh-tp.ibmuc.com ([2406:7400:63:7035:9095:349e:5f0b:ded0]) by smtp.gmail.com with ESMTPSA id v19-20020a17090abb9300b00246d7cd7327sm646154pjr.51.2023.04.10.22.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 22:22:21 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Jan Kara , Christoph Hellwig , "Darrick J . Wong" , Ojaswin Mujoo , "Ritesh Harjani (IBM)" Subject: [RFCv2 4/8] ext2: Use __generic_file_fsync_nolock implementation Date: Tue, 11 Apr 2023 10:51:52 +0530 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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-ext4@vger.kernel.org Next patch converts ext2 to use iomap interface for DIO. iomap layer can call generic_write_sync() -> ext2_fsync() from iomap_dio_complete while still holding the inode_lock(). Now writeback from other paths doesn't need inode_lock(). It seems there is also no need of an inode_lock for sync_mapping_buffers(). It uses it's own mapping->private_lock for it's buffer list handling. Hence this patch is in preparation to move ext2 to iomap. This uses __generic_file_fsync_nolock() variant in ext2_fsync(). Signed-off-by: Ritesh Harjani (IBM) --- fs/ext2/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext2/file.c b/fs/ext2/file.c index 6b4bebe982ca..1d0bc3fc88bb 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -153,7 +153,9 @@ int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync) int ret; struct super_block *sb = file->f_mapping->host->i_sb; - ret = generic_file_fsync(file, start, end, datasync); + ret = __generic_file_fsync_nolock(file, start, end, datasync); + if (!ret) + ret = blkdev_issue_flush(sb->s_bdev); if (ret == -EIO) /* We don't really know where the IO error happened... */ ext2_error(sb, __func__, -- 2.39.2