Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1528938rwe; Sat, 15 Apr 2023 00:45:57 -0700 (PDT) X-Google-Smtp-Source: AKy350boZx9GLbq9ukedU0voQ/RQBOACrGD41UKx71CZW+S2C9yqGXqqzkA0s1CSaLPV1514bM9a X-Received: by 2002:a17:90b:1b48:b0:247:5d84:b6b8 with SMTP id nv8-20020a17090b1b4800b002475d84b6b8mr1153836pjb.37.1681544757443; Sat, 15 Apr 2023 00:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681544757; cv=none; d=google.com; s=arc-20160816; b=yEClRhpQQFRss2ip1mDuokk0T9/fSgZqYRA2x8TUzs3L1+Bv4ztV2cPnetTWajeqYq CbCNPHs5DjPAiBrtKrAkcS8QdJMXxlqsE9uD2mMy/9FFD7BzHkWJnglVhIvGRu/PzmWZ gqewvc1DH7E8dT3AwEUamxiJIfIfLwX52kNHXPmYBhBuXNgr1XugbTdYbYH2bu/KB0lp bsF06Ya4oolj6cojjIa/1Ypbu5KiMeTtcJ22dCPeuG1Wcz+d+WxUth9eMeFGkTgKCwdb DqoorZuJhuP2Gl3GYvNBYP8HiE84ipQtTu+H5y05lRjoAkzxCJzFrhuDFpsWrL31sD8E HmIg== 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=AjbCCQNxzn0GvhaG5GeV2Er2ZYYDIm3jJ1Ua/2hirrDR82vT06ZZwyKb/2W6/PYKIi pHzlui4AtDdww0xggtYkH9EwdO+5rSXTpWuBH43j5j/x0HTL0SkxoUvnhF+RsfVjKDzF gHsSsHclQD3LzjZ/Det2I4LJuB1R2gbkiAdqLQ2/xb4t77xXctU5XQ1AZz51H4zPc1CK oNYWWQrnApTSowqN5CRfm3mr4hWTsvi67/bnxBIJDS4cQSLKmtUDaFLDyth3kM+jtec3 uxdCMxzHP+bS4xzbEKhDUeJCl5YU0/nrWax5f+ngfazNHOPUMF+mXqoSsZm/KgsmGZAq 2OhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=R12mBpVI; 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 u59-20020a17090a51c100b00244af8c2956si8830863pjh.126.2023.04.15.00.45.43; Sat, 15 Apr 2023 00:45: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=20221208 header.b=R12mBpVI; 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 S229817AbjDOHo7 (ORCPT + 99 others); Sat, 15 Apr 2023 03:44:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229766AbjDOHow (ORCPT ); Sat, 15 Apr 2023 03:44:52 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BDDD83DF; Sat, 15 Apr 2023 00:44:50 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-51b6d0b9430so230219a12.2; Sat, 15 Apr 2023 00:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681544690; x=1684136690; 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=R12mBpVIScO/ybPKCDH+JA3H7SvOdnUIhGwGxVav53/bIcvfxai/+q0DQ6dvi2oLN2 qniiJBvJekfKVTBmhhnS5kN9OP1FaYQDDMoA2bTINwznRT+F0K0ZBYCBq+R2uvhR6EgD OE+HHJcyKcph9LQNn3r8FDCxzueT0+VYZbzgCrsicJIShA0iDF1nP755vYNN9MYYaW4W DUMV7QMMb7PDWuupfrlnoXOogHWKuOPLeXSktKyojtR2fIzTrIawSTM6CnjF/+eCnid4 zg8ak6lkMtuGnRmjUov95qXmy77hd9XIJg7F9y5HcGNFfvDm4l2y0qpP0eb5PBX11I1q 2gqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681544690; x=1684136690; 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=BbXFtOra9yOdv035l3+8yLyeQI6OHSFTtI1d8Vu0yM+hVxvwNzmYIj9HmbfUEgVILh F0iIKHYuWNpwG4Yl3gkVqZ4LBv3sDGN8Ls+Vxw1SLVbkhhGfVtw/1JBbH5Elr5PUPgHX G4uZTmUQ9G9u2M/JCi73lJEIkASIFeaZas3bHylvE+FB72g4q5+LVTq8HHTdsGyQD4CV HAxv+VwE7ij/KsW0lPl7gZx4u0bOoOLYM9YPHZE/6+q5qZCETouNEC0HX9xEaCyO/bpC JralMijfQnStbbC/Z2bmyEu7PLRyXzPMX/kE8UALvirmbrIAp8C0c0pHRtE2CwZPm2rc QcYg== X-Gm-Message-State: AAQBX9fWZ2KoPs2Gwxlh7oD/woFnjTvqJjO10orkauNmAwNqKqw4F8a7 OEv5HSpIeDf6Lycg+38JBtTVdeS+X/A= X-Received: by 2002:a05:6a00:16c1:b0:636:4523:da93 with SMTP id l1-20020a056a0016c100b006364523da93mr12289799pfc.12.1681544689698; Sat, 15 Apr 2023 00:44:49 -0700 (PDT) Received: from rh-tp.. ([2406:7400:63:2dd2:1827:1d70:2273:8ee0]) by smtp.gmail.com with ESMTPSA id e21-20020aa78255000000b0063b675f01a5sm2338789pfn.11.2023.04.15.00.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 00:44:49 -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: [RFCv4 4/9] ext2: Use generic_buffer_fsync() implementation Date: Sat, 15 Apr 2023 13:14:25 +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=-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