From patchwork Wed Mar 19 21:10:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 3861361 Return-Path: X-Original-To: patchwork-ocfs2-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E03E9F373 for ; Wed, 19 Mar 2014 21:10:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFA6D201F4 for ; Wed, 19 Mar 2014 21:10:41 +0000 (UTC) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97F0F201E4 for ; Wed, 19 Mar 2014 21:10:40 +0000 (UTC) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s2JLAVh1001873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Mar 2014 21:10:31 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2JLAUZj014204 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Mar 2014 21:10:30 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1WQNks-0003Cw-LT; Wed, 19 Mar 2014 14:10:30 -0700 Received: from ucsinet22.oracle.com ([156.151.31.94]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1WQNkT-0003AM-D9 for ocfs2-devel@oss.oracle.com; Wed, 19 Mar 2014 14:10:05 -0700 Received: from userp1020.oracle.com (userp1020.oracle.com [156.151.31.79]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s2JLA4SB013952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 19 Mar 2014 21:10:04 GMT Received: from mail-oa0-f73.google.com (mail-oa0-f73.google.com [209.85.219.73]) by userp1020.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s2JLA3R2023167 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 19 Mar 2014 21:10:04 GMT Received: by mail-oa0-f73.google.com with SMTP id n16so1790525oag.4 for ; Wed, 19 Mar 2014 14:10:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:cc:from:date:mime-version :content-type:content-transfer-encoding:message-id; bh=adNmtzWQXW9I6A272n1gP9Nz6eE7w+zv51UtKvemR+g=; b=HBIPYF10L40DbvwacfL1xvmnG9fgXeHNTzRG4S12VGiiSx3GWFjlKqfCFyrtahot0o OzXfOsj32fD0qvDXRorM/W9PWCDxxP9L+XsuX0n3CNBITmHZiSwpZovTXuWhvLQo/UY6 8FgelxMt3ZfxuMOKNQGv+adcwqv/LKl+pTXM84IKgMF8sl7ZJDJeTByRUZIkha9V4gw0 /xlO3jnDmsEEEhEks/Kc/29HGH23pTAfs+KfbkOYfB3qV8gI94UXwyyaWFVGMr2o4+j/ SNIUMHVth8ttL9oRVfFaLS4yI2pQ3yWi16xYO70R99qa707KxZJr5r09FFMpkYSk3WGT xQMw== X-Gm-Message-State: ALoCoQlXoI+FKHVeG956GTA6zmwU1wa28JbQumtNP4YX6fszqxnXLFQAp5Gs7MPKmGRsvSoHhJV2 X-Received: by 10.42.240.19 with SMTP id ky19mr13904490icb.4.1395263403679; Wed, 19 Mar 2014 14:10:03 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id u30si3663839yhk.1.2014.03.19.14.10.03 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Mar 2014 14:10:03 -0700 (PDT) Received: from localhost.localdomain (akpm3.mtv.corp.google.com [172.17.131.127]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id D199A5A4217; Wed, 19 Mar 2014 14:10:02 -0700 (PDT) To: ocfs2-devel@oss.oracle.com From: akpm@linux-foundation.org Date: Wed, 19 Mar 2014 14:10:02 -0700 MIME-Version: 1.0 Message-Id: <20140319211002.D199A5A4217@corp2gmr1-2.hot.corp.google.com> X-Flow-Control-Info: class=Pass-to-MM reputation=ipRisk-All ip=209.85.219.73 ct-class=R5 ct-vol1=-97 ct-vol2=7 ct-vol3=6 ct-risk=54 ct-spam1=88 ct-spam2=8 ct-bulk=0 rcpts=1 size=8466 X-Sendmail-CM-Score: 0.00% X-Sendmail-CM-Analysis: v=2.1 cv=KOFjUj1o c=1 sm=1 tr=0 a=uFs/2XNcAMXJDfbKR0AwKQ==:117 a=dnutPBu8K2YA:10 a=NEiEQogP1MkA:10 a=os2CZ2fo8YAA:10 a=Z4Rwk6OoAAAA:8 a=1XWaLZrsAAAA:8 a=yPCof4ZbAAAA:8 a=IXr_WNlcAAAA:8 a=PMMkiqmEhQq_oIu2jXEA:9 a=e4xtJxf3HDoA:10 a=7DSvI1N PTFQA:10 a=0kPLrQdw3YYA:10 a=T5ZRoNnfl4MA:10 a=jbrJJM5MRmoA:10 X-Sendmail-CT-RefID: str=0001.0A090202.532A07AC.0106, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-Sendmail-CT-Classification: not spam Cc: mfasheh@suse.de, mfasheh@suse.com, greg.marsden@oracle.com Subject: [Ocfs2-devel] [patch 4/8] ocfs2: call ocfs2_update_inode_fsync_trans when updating any inode X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Darrick J. Wong" Subject: ocfs2: call ocfs2_update_inode_fsync_trans when updating any inode Ensure that ocfs2_update_inode_fsync_trans() is called any time we touch an inode in a given transaction. This is a follow-on to the previous patch to reduce lock contention and deadlocking during an fsync operation. Signed-off-by: Darrick J. Wong Cc: Mark Fasheh Cc: Joel Becker Cc: Wengang Cc: Greg Marsden Cc: Srinivas Eeda Signed-off-by: Andrew Morton --- fs/ocfs2/acl.c | 1 + fs/ocfs2/alloc.c | 2 ++ fs/ocfs2/dir.c | 2 ++ fs/ocfs2/file.c | 7 +++++++ fs/ocfs2/move_extents.c | 2 ++ fs/ocfs2/namei.c | 1 + fs/ocfs2/suballoc.c | 3 ++- fs/ocfs2/xattr.c | 3 +++ 8 files changed, 20 insertions(+), 1 deletion(-) diff -puN fs/ocfs2/acl.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode fs/ocfs2/acl.c --- a/fs/ocfs2/acl.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode +++ a/fs/ocfs2/acl.c @@ -205,6 +205,7 @@ static int ocfs2_acl_set_mode(struct ino di->i_mode = cpu_to_le16(inode->i_mode); di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); + ocfs2_update_inode_fsync_trans(handle, inode, 0); ocfs2_journal_dirty(handle, di_bh); diff -puN fs/ocfs2/alloc.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode fs/ocfs2/alloc.c --- a/fs/ocfs2/alloc.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode +++ a/fs/ocfs2/alloc.c @@ -5728,6 +5728,7 @@ int ocfs2_remove_btree_range(struct inod } ocfs2_et_update_clusters(et, -len); + ocfs2_update_inode_fsync_trans(handle, inode, 1); ocfs2_journal_dirty(handle, et->et_root_bh); @@ -7209,6 +7210,7 @@ int ocfs2_truncate_inline(struct inode * di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); + ocfs2_update_inode_fsync_trans(handle, inode, 1); ocfs2_journal_dirty(handle, di_bh); out_commit: diff -puN fs/ocfs2/dir.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode fs/ocfs2/dir.c --- a/fs/ocfs2/dir.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode +++ a/fs/ocfs2/dir.c @@ -3006,6 +3006,7 @@ static int ocfs2_expand_inline_dir(struc di->i_size = cpu_to_le64(sb->s_blocksize); di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); + ocfs2_update_inode_fsync_trans(handle, dir, 1); /* * This should never fail as our extent list is empty and all @@ -4405,6 +4406,7 @@ static int ocfs2_dx_dir_remove_index(str di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features); spin_unlock(&OCFS2_I(dir)->ip_lock); di->i_dx_root = cpu_to_le64(0ULL); + ocfs2_update_inode_fsync_trans(handle, dir, 1); ocfs2_journal_dirty(handle, di_bh); diff -puN fs/ocfs2/file.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode fs/ocfs2/file.c --- a/fs/ocfs2/file.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode +++ a/fs/ocfs2/file.c @@ -286,6 +286,7 @@ int ocfs2_update_inode_atime(struct inod inode->i_atime = CURRENT_TIME; di->i_atime = cpu_to_le64(inode->i_atime.tv_sec); di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); + ocfs2_update_inode_fsync_trans(handle, inode, 0); ocfs2_journal_dirty(handle, bh); out_commit: @@ -335,6 +336,7 @@ int ocfs2_simple_size_update(struct inod if (ret < 0) mlog_errno(ret); + ocfs2_update_inode_fsync_trans(handle, inode, 0); ocfs2_commit_trans(osb, handle); out: return ret; @@ -429,6 +431,7 @@ static int ocfs2_orphan_for_truncate(str di->i_size = cpu_to_le64(new_i_size); di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); + ocfs2_update_inode_fsync_trans(handle, inode, 0); ocfs2_journal_dirty(handle, fe_bh); @@ -737,6 +740,7 @@ static handle_t *ocfs2_zero_start_ordere OCFS2_JOURNAL_ACCESS_WRITE); if (ret) mlog_errno(ret); + ocfs2_update_inode_fsync_trans(handle, inode, 1); out: if (ret) { @@ -834,6 +838,7 @@ static int ocfs2_write_zero_page(struct di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); di->i_mtime_nsec = di->i_ctime_nsec; ocfs2_journal_dirty(handle, di_bh); + ocfs2_update_inode_fsync_trans(handle, inode, 1); ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); } @@ -1338,6 +1343,7 @@ static int __ocfs2_write_remove_suid(str di = (struct ocfs2_dinode *) bh->b_data; di->i_mode = cpu_to_le16(inode->i_mode); + ocfs2_update_inode_fsync_trans(handle, inode, 0); ocfs2_journal_dirty(handle, bh); @@ -1570,6 +1576,7 @@ static int ocfs2_zero_partial_clusters(s if (ret) mlog_errno(ret); } + ocfs2_update_inode_fsync_trans(handle, inode, 1); ocfs2_commit_trans(osb, handle); out: diff -puN fs/ocfs2/move_extents.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode fs/ocfs2/move_extents.c --- a/fs/ocfs2/move_extents.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode +++ a/fs/ocfs2/move_extents.c @@ -151,6 +151,7 @@ static int __ocfs2_move_extent(handle_t old_blkno, len); } + ocfs2_update_inode_fsync_trans(handle, inode, 0); out: ocfs2_free_path(path); return ret; @@ -954,6 +955,7 @@ static int ocfs2_move_extents(struct ocf inode->i_ctime = CURRENT_TIME; di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); + ocfs2_update_inode_fsync_trans(handle, inode, 0); ocfs2_journal_dirty(handle, di_bh); diff -puN fs/ocfs2/namei.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode fs/ocfs2/namei.c --- a/fs/ocfs2/namei.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode +++ a/fs/ocfs2/namei.c @@ -2578,6 +2578,7 @@ int ocfs2_mv_orphaned_inode_to_new(struc di->i_orphaned_slot = 0; set_nlink(inode, 1); ocfs2_set_links_count(di, inode->i_nlink); + ocfs2_update_inode_fsync_trans(handle, inode, 1); ocfs2_journal_dirty(handle, di_bh); status = ocfs2_add_entry(handle, dentry, inode, diff -puN fs/ocfs2/suballoc.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode fs/ocfs2/suballoc.c --- a/fs/ocfs2/suballoc.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode +++ a/fs/ocfs2/suballoc.c @@ -771,6 +771,7 @@ static int ocfs2_block_group_alloc(struc spin_unlock(&OCFS2_I(alloc_inode)->ip_lock); i_size_write(alloc_inode, le64_to_cpu(fe->i_size)); alloc_inode->i_blocks = ocfs2_inode_sector_count(alloc_inode); + ocfs2_update_inode_fsync_trans(handle, alloc_inode, 0); status = 0; @@ -2075,7 +2076,7 @@ int ocfs2_find_new_inode_loc(struct inod ac->ac_find_loc_priv = res; *fe_blkno = res->sr_blkno; - + ocfs2_update_inode_fsync_trans(handle, dir, 0); out: if (handle) ocfs2_commit_trans(OCFS2_SB(dir->i_sb), handle); diff -puN fs/ocfs2/xattr.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode fs/ocfs2/xattr.c --- a/fs/ocfs2/xattr.c~ocfs2-call-ocfs2_update_inode_fsync_trans-when-updating-any-inode +++ a/fs/ocfs2/xattr.c @@ -2602,6 +2602,7 @@ int ocfs2_xattr_remove(struct inode *ino oi->ip_dyn_features &= ~(OCFS2_INLINE_XATTR_FL | OCFS2_HAS_XATTR_FL); di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); spin_unlock(&oi->ip_lock); + ocfs2_update_inode_fsync_trans(handle, inode, 0); ocfs2_journal_dirty(handle, di_bh); out_commit: @@ -3614,6 +3615,7 @@ int ocfs2_xattr_set(struct inode *inode, } ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt); + ocfs2_update_inode_fsync_trans(ctxt.handle, inode, 0); ocfs2_commit_trans(osb, ctxt.handle); @@ -5476,6 +5478,7 @@ static int ocfs2_rm_xattr_cluster(struct ret = ocfs2_truncate_log_append(osb, handle, blkno, len); if (ret) mlog_errno(ret); + ocfs2_update_inode_fsync_trans(handle, inode, 0); out_commit: ocfs2_commit_trans(osb, handle);