Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2682328rwe; Sun, 16 Apr 2023 03:12:07 -0700 (PDT) X-Google-Smtp-Source: AKy350bgpo0Y1xbGZCe3xOo87dGNwEBqxpxVvdZM56TdczkO2HZm+QOF3EwqXDyteib6uITDi2Pv X-Received: by 2002:a05:6a20:4c05:b0:ec:2446:9322 with SMTP id fm5-20020a056a204c0500b000ec24469322mr10522747pzb.53.1681639927754; Sun, 16 Apr 2023 03:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681639927; cv=none; d=google.com; s=arc-20160816; b=wC7TJKzg4OTdm8spOwlSwnDmkR/3Ue/Q5R7QF2VHw5diUBw3sczp9rUPofeCb00quy 0SZkBSv8Jpr6iYbtlbG306e2f1CWJPGPomkm1xb6a3VpSPX7/SBBZWXmMAmutwNI1xbh +z6rnj2Jy/uPQIT+1Llmj76Zy1whDOhOVZ+l/A8sM3TDVn/M/QSAoCDPvAwWoml0GyKU f1gB59Lf17xnx6lmb8mwvSB9RiUqjTbU7cPWv++tDABCnaIcU5NX729rYSQk9Xh1ptTR KJqGwx57czFZYD0y4YQ2aWJOurgSxaPbRiGNuDcKV5ot1SVzd6BOryzRnH31mpoqGmAL a08g== 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=LMu2Z6KXv/0ceszG2jht7fa1feJSyyCUFNwC5P7U1ig=; b=d1radz6oLkPvD5rr3KlgvMDF9aJlObbFgbDBdoAeNU9R3Cfgy64y8UahOlVNKmHwld IxGcFHJUw+Eu3Vq3csxohmuh9UaeCEF/iIAtAxb9ddPpaYTz87KSJsGqQcjqXEfYFxUP PZeNUaX0TFMjqsprZzCn3inIT2qBAJCSkOHheVr9q2gqUncU54EpOjEx1VoUK1RHMs/P C3BSuBqZqiZLSUHNTr3dA2Z4kZTNZuMTVOZE668yNPaXwJrpdsAWFiMSPzLtyYqK6w/5 +zJ4UMvweM8yIfpozFoR8IEpqhIjxB7tfJuwHOfi9o0X+0HA6T1oYsEilJn0ah46odiu vv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=bLgqLIAC; 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 196-20020a6302cd000000b00513a662096fsi9550964pgc.775.2023.04.16.03.11.52; Sun, 16 Apr 2023 03:12:07 -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=20221208 header.b=bLgqLIAC; 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 S230024AbjDPKJg (ORCPT + 99 others); Sun, 16 Apr 2023 06:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbjDPKJU (ORCPT ); Sun, 16 Apr 2023 06:09:20 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 328EE10D4; Sun, 16 Apr 2023 03:09:08 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id v21-20020a17090a459500b0024776162815so1705629pjg.2; Sun, 16 Apr 2023 03:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681639747; x=1684231747; 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=LMu2Z6KXv/0ceszG2jht7fa1feJSyyCUFNwC5P7U1ig=; b=bLgqLIACS1CCHmGinY8/zBtdiUFCZp4cqyIzQ++wFfJe5pVx8xIsTTHiRRr6mPPQVA 1m9HUbVZH4Lk3hEbtQ1MVOnwCottahR8itjg2A+nKh8lj6PK17R/Dun4RZkUBmzpRjpl 38RAeHMmTFxZYB/EkFNehWlPib/fEQ/9RhJBkvZJPiabRSVFri5h7eXVBIdSAcPLsmq1 VR0eTcoCrP5yn7fq3bwT4OumePc1XitaK8UBK0tm9kPXBlN1NdK8ynNYHH8eTq/Emg8d rd0VNVEqlT2ssedpovxXwbs0bVW9WJNoMs3fNgQsQB4BK0SlPeNx9qGIcGW0luBkTZ4M LUQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681639747; x=1684231747; 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=LMu2Z6KXv/0ceszG2jht7fa1feJSyyCUFNwC5P7U1ig=; b=M8vsvkWl/EV9l2ZiYQQC8vBGaoio+4+L0UI57P9HPbfzNo/nLKleNt0PyDkWgWxu9s jk4IAdEnoCHSUs+9FCp7EwToOtQIXA35YeRO337lvOf0EHCukQrQv6/rgpp+UJoDF8wt wj3tyF9w24y440w0bi5VsV9UEEelvJBrFQVYVTTufjlNOT72kztDyYZi+vkkxUoXTZ76 Akxn0UfnEiRZ9oOw5Kfhf/Ch1G2ZXqgHu0yzvB5Opjccmyv5pYABINu8TIYckzqU7dD7 qDLVLfhnR4YxJ/nQpE/SzKdY/njec7AmkLpSRVencSOGVrbK9o/886vEQh48tdoiWmI4 tSQg== X-Gm-Message-State: AAQBX9eW6piNQvwPrUyb45GfFSAQ7ljW9UjCKYTCdaxAWUwkyCLI2D+/ E/9PrQIsys0Zjq9zr53LovRo9MLXetg= X-Received: by 2002:a05:6a20:77af:b0:d9:237e:9d08 with SMTP id c47-20020a056a2077af00b000d9237e9d08mr10390217pzg.3.1681639747378; Sun, 16 Apr 2023 03:09:07 -0700 (PDT) Received: from rh-tp.. ([2406:7400:63:2dd2:1827:1d70:2273:8ee0]) by smtp.gmail.com with ESMTPSA id h9-20020aa786c9000000b0063b733fdd33sm3096057pfo.89.2023.04.16.03.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Apr 2023 03:09:07 -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 , Disha Goel , "Ritesh Harjani (IBM)" Subject: [PATCHv5 4/9] ext2: Use generic_buffer_fsync() implementation Date: Sun, 16 Apr 2023 15:38:39 +0530 Message-Id: <63f1a424daebbacd758f73425b2f3b3787c12738.1681639164.git.ritesh.list@gmail.com> 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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-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_buffer_fsync() which does not take any inode_lock() in ext2_fsync(). Tested-by: Disha Goel Signed-off-by: Ritesh Harjani (IBM) --- fs/ext2/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ext2/file.c b/fs/ext2/file.c index 6b4bebe982ca..7603427fb38f 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "ext2.h" #include "xattr.h" #include "acl.h" @@ -153,7 +154,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_buffer_fsync(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