From patchwork Sat Oct 22 07:20:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089507wrr; Sat, 22 Oct 2022 00:43:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UJCqAFIa0bKeNxjtwUka/f2d5qN3F97VFFmxL9klEZ5gmcpetOZPEVdWVvPLPBVo47dsN X-Received: by 2002:a17:902:8a97:b0:178:1939:c721 with SMTP id p23-20020a1709028a9700b001781939c721mr23429596plo.108.1666424611128; Sat, 22 Oct 2022 00:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424611; cv=none; d=google.com; s=arc-20160816; b=v5LTft7ktuBkPrHV20HJJjMpJJGMRoXVRqPa+qALr/RUdmZt5SJJpV2rX2rORFmfpg CdK/1T1pXJqW+X3PIsuFY8zgCWRmvuA4OFixZX5ZwH3AO3/InisXpYV8bTtQSXS8p6lw 82md6q2nOdzYgPNRrhZfpeft7qTyiTS6ITtL6BG9qoAkww9xKZnyIiO/3NOlRW/2yurx RPWLUEgTtrq2I3RT8Asj8K/QX9rI35BmS7F0Rpp4KRg4mi/nwMPBpMwnU9qkigpSSibs etdK5k8XRq2mMAUampL6II4skbpHbr+8QcIrE70Dy7XoSzjg894mLfhemWmUCfY/0Egh bkQQ== 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=Wr4tvOHydMt15RLQxF11BjwOutoPS2EPEwgFSjQOsjs=; b=oHvFEae+MNSkPFi46enuc+8XzdboB7V9+TZCJBx5Rd3Tg8g1b4bosQY4ATNnd9Kb0d +PU8a0Uf/NmhuH6C8uHFeYNzSQF5OT6unl0pA1TNHceV+bR8H2Q/gDA9SDoss8fi7usM Z26Ma59iN0ozcU1ZUTj0tJAkRrGDGHqxaRfHI8MjQXtC+Ey452S2E9dBs35O2vta7Gsa p12wzrjLK59wWf9CrWbqMlNgOlDY+j9nWjbLR9XU2nG7q+pjS7WHWEoOEydu/Irt1Dm/ bn92W84oXVkiB77rFuAvpVDnA1fBphT8qCSk5x4hEn7or5QrweOMlUVdocMuixePeZCn WkRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uyd8xgUz; 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 u41-20020a056a0009a900b0052f9293affcsi30579412pfg.335.2022.10.22.00.43.18; Sat, 22 Oct 2022 00:43:31 -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=uyd8xgUz; 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 S231245AbiJVHmx (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230525AbiJVHmH (ORCPT ); Sat, 22 Oct 2022 03:42:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585AF45F48; Sat, 22 Oct 2022 00:40:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id 919A3B82E03; Sat, 22 Oct 2022 07:39:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C261EC43142; Sat, 22 Oct 2022 07:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424394; bh=bbFpRihJWwhXIesk1QCoyltPVOvk8RcBygayX4+sTF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyd8xgUzSTdIxCqV/Ag66QvSXTKmbRiVmwxEykKsIP/Ol+1XJAIBdn2z4smEeQTpS V3vxirf9CEfLCeXz3HPiC0qmZGa8V02946RL+r2qNFpyECEo3ybdytSu0pYY+TVRyd E4Ght+7Elb3dIsRtjVbDHhjRppsi3aQO6VnFYx2o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Dave Chinner , Benjamin Coddington , Christoph Hellwig , "Darrick J. Wong" , Jeff Layton , Lukas Czerner , "Christian Brauner (Microsoft)" , Jan Kara , Theodore Tso Subject: [PATCH 5.19 128/717] ext4: unconditionally enable the i_version counter Date: Sat, 22 Oct 2022 09:20:07 +0200 Message-Id: <20221022072438.137591238@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372853245105838?= X-GMAIL-MSGID: =?utf-8?q?1747372853245105838?= From: Jeff Layton commit 1ff20307393e17dc57fde62226df625a3a3c36e9 upstream. The original i_version implementation was pretty expensive, requiring a log flush on every change. Because of this, it was gated behind a mount option (implemented via the MS_I_VERSION mountoption flag). Commit ae5e165d855d (fs: new API for handling inode->i_version) made the i_version flag much less expensive, so there is no longer a performance penalty from enabling it. xfs and btrfs already enable it unconditionally when the on-disk format can support it. Have ext4 ignore the SB_I_VERSION flag, and just enable it unconditionally. While we're in here, mark the i_version mount option Opt_removed. [ Removed leftover bits of i_version from ext4_apply_options() since it now can't ever be set in ctx->mask_s_flags -- lczerner ] Cc: stable@kernel.org Cc: Dave Chinner Cc: Benjamin Coddington Cc: Christoph Hellwig Cc: Darrick J. Wong Signed-off-by: Jeff Layton Signed-off-by: Lukas Czerner Reviewed-by: Christian Brauner (Microsoft) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220824160349.39664-3-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 5 ++--- fs/ext4/super.c | 22 +++++----------------- 2 files changed, 7 insertions(+), 20 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5425,7 +5425,7 @@ int ext4_setattr(struct user_namespace * return -EINVAL; } - if (IS_I_VERSION(inode) && attr->ia_size != inode->i_size) + if (attr->ia_size != inode->i_size) inode_inc_iversion(inode); if (shrink) { @@ -5735,8 +5735,7 @@ int ext4_mark_iloc_dirty(handle_t *handl * ea_inodes are using i_version for storing reference count, don't * mess with it */ - if (IS_I_VERSION(inode) && - !(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) + if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) inode_inc_iversion(inode); /* the do_update_inode consumes one bh->b_count */ --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1585,7 +1585,7 @@ enum { Opt_inlinecrypt, Opt_usrjquota, Opt_grpjquota, Opt_quota, Opt_noquota, Opt_barrier, Opt_nobarrier, Opt_err, - Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_i_version, + Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_dax, Opt_dax_always, Opt_dax_inode, Opt_dax_never, Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_warn_on_error, Opt_nowarn_on_error, Opt_mblk_io_submit, Opt_debug_want_extra_isize, @@ -1694,7 +1694,7 @@ static const struct fs_parameter_spec ex fsparam_flag ("barrier", Opt_barrier), fsparam_u32 ("barrier", Opt_barrier), fsparam_flag ("nobarrier", Opt_nobarrier), - fsparam_flag ("i_version", Opt_i_version), + fsparam_flag ("i_version", Opt_removed), fsparam_flag ("dax", Opt_dax), fsparam_enum ("dax", Opt_dax_type, ext4_param_dax), fsparam_u32 ("stripe", Opt_stripe), @@ -2140,11 +2140,6 @@ static int ext4_parse_param(struct fs_co case Opt_abort: ctx_set_mount_flag(ctx, EXT4_MF_FS_ABORTED); return 0; - case Opt_i_version: - ext4_msg(NULL, KERN_WARNING, deprecated_msg, param->key, "5.20"); - ext4_msg(NULL, KERN_WARNING, "Use iversion instead\n"); - ctx_set_flags(ctx, SB_I_VERSION); - return 0; case Opt_inlinecrypt: #ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT ctx_set_flags(ctx, SB_INLINECRYPT); @@ -2814,14 +2809,6 @@ static void ext4_apply_options(struct fs sb->s_flags &= ~ctx->mask_s_flags; sb->s_flags |= ctx->vals_s_flags; - /* - * i_version differs from common mount option iversion so we have - * to let vfs know that it was set, otherwise it would get cleared - * on remount - */ - if (ctx->mask_s_flags & SB_I_VERSION) - fc->sb_flags |= SB_I_VERSION; - #define APPLY(X) ({ if (ctx->spec & EXT4_SPEC_##X) sbi->X = ctx->X; }) APPLY(s_commit_interval); APPLY(s_stripe); @@ -2970,8 +2957,6 @@ static int _ext4_show_options(struct seq SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time); if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME) SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time); - if (sb->s_flags & SB_I_VERSION) - SEQ_OPTS_PUTS("i_version"); if (nodefs || sbi->s_stripe) SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe); if (nodefs || EXT4_MOUNT_DATA_FLAGS & @@ -4631,6 +4616,9 @@ static int __ext4_fill_super(struct fs_c sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); + /* i_version is always enabled now */ + sb->s_flags |= SB_I_VERSION; + if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV && (ext4_has_compat_features(sb) || ext4_has_ro_compat_features(sb) ||