From patchwork Wed Feb 28 11:18:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 10247299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 181F860211 for ; Wed, 28 Feb 2018 11:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 086A128CAA for ; Wed, 28 Feb 2018 11:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0D1528CC3; Wed, 28 Feb 2018 11:20:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8554228CC5 for ; Wed, 28 Feb 2018 11:20:28 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1SBH93r082015; Wed, 28 Feb 2018 11:18:44 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2gdqgvs21p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Feb 2018 11:18:44 +0000 Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1SBIgnx032235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Feb 2018 11:18:43 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1eqzkw-0000iK-Pe; Wed, 28 Feb 2018 03:18:42 -0800 Received: from userv0021.oracle.com ([156.151.31.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1eqzkX-0000fe-RF for ocfs2-devel@oss.oracle.com; Wed, 28 Feb 2018 03:18:17 -0800 Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1SBIHp3031420 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Wed, 28 Feb 2018 11:18:17 GMT Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1SBGqUu007609 for ; Wed, 28 Feb 2018 11:18:17 GMT Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by userp2040.oracle.com with ESMTP id 2gdtur8hy3-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Feb 2018 11:18:17 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B18DDACFB; Wed, 28 Feb 2018 11:18:10 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 9D3CD1E0505; Wed, 28 Feb 2018 12:18:09 +0100 (CET) From: Jan Kara To: ocfs2-devel@oss.oracle.com Date: Wed, 28 Feb 2018 12:18:00 +0100 Message-Id: <20180228111802.23967-5-jack@suse.cz> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180228111802.23967-1-jack@suse.cz> References: <20180228111802.23967-1-jack@suse.cz> X-CLX-Shades: MLX X-CLX-Response: 1TFkXGxMZEQpMehccGhEKWU0XZ2ZyEQpZSRcacRoQGncGGx0ZcR8ZEBp3Bhg aBhoRClleF2hueREKSUYXRVhLSUZPdVpYRU5fSV5DRUQZdU9LEQpDThdTZh5aUn1ne2lbe0Voem NhRkUSXmIbS2V5c0Jve3kbGhEKWFwXHwQaBBsYHAdLSxgYHx5PGQUbGgQbGhoEHhIEGxAbHhofG hEKXlkXeFBueX8RCk1cFx4ZHhEKTFoXaGlCTV0RCk1OF2gRCkxGF2xraxEKQ1oXGxMfBBsZHwQY GBoEGx8RCkJeFxsRCkRJFx8RCkJGF2xOXkQFeB1+XhJ+EQpCXBcaEQpCRRdgAWF7W1p7QAFibRE KQk4XZRp4GwUFcHN7U1kRCkJMF21keGJ8T3thQ19fEQpCbBdpfhh8QF9IHE5rUhEKQkAXbxNGf2 MFbnlkf1wRCkJYF2J9b3kBTxgZcHB7EQpaWBcbEQpwaBdneExTXmt9aU9ERBAaEQpwaBdhBVodf n9SbExdcxAaEQpwaBdrU0AbQgVvW3J7BRAaEQpwaBdlZXMTYVhHR3wYcBAaEQpwaBdha2Z/aR96 eUVwYhAaEQpwbBdiQFptUEFDY3BfbRAZGhEKbX4XGhEKWE0XSxEg X-PDR: PASS X-Source-IP: 195.135.220.15 X-ServerName: mx2.suse.de X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:137.65.0.0/16 ip4:151.155.28.0/17 ip4:149.44.0.0/16 ip4:147.2.0.0/16 ip4:164.99.0.0/16 ip4:130.57.0.0/16 ip4:192.31.114.0/24 ip4:195.135.221.0/24 ip4:195.135.220.0/24 ip4:69.7.179.0/24 ip4:150.215.214.0/24 include:mailcontrol.com ~all X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8817 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=60 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=193 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802280137 X-Spam: Clean Cc: Jan Kara Subject: [Ocfs2-devel] [PATCH 4/6] ocfs2: Move scheduling of dqi_sync_work up in call stack 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: , MIME-Version: 1.0 Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8817 signatures=668681 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802280137 X-Virus-Scanned: ClamAV using ClamSMTP Move scheduling of dqi_sync_work up in the call stack to ocfs2_enable_quotas() and ocfs2_susp_quotas(). This will later allow us to not schedule this work when quotas are enabled on read-only filesystem and also makes scheduling & canceling of dqi_sync_work more symmetric. Signed-off-by: Jan Kara --- fs/ocfs2/quota_global.c | 3 --- fs/ocfs2/super.c | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index 7a922190a8c7..0098914dde88 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -401,9 +401,6 @@ int ocfs2_global_read_info(struct super_block *sb, int type) OCFS2_QBLK_RESERVED_SPACE; oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi); INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn); - schedule_delayed_work(&oinfo->dqi_sync_work, - msecs_to_jiffies(oinfo->dqi_syncms)); - out_err: return status; out_unlock: diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 14c3d5ee6e24..39b62569e7ff 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -910,22 +910,25 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) OCFS2_FEATURE_RO_COMPAT_USRQUOTA, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; int status = 0; + struct ocfs2_mem_dqinfo *oinfo; for (type = 0; type < OCFS2_MAXQUOTAS; type++) { if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) continue; - if (unsuspend) + oinfo = sb_dqinfo(sb, type)->dqi_priv; + if (unsuspend) { status = dquot_resume(sb, type); - else { - struct ocfs2_mem_dqinfo *oinfo; - + if (status < 0) + break; + schedule_delayed_work(&oinfo->dqi_sync_work, + msecs_to_jiffies(oinfo->dqi_syncms)); + } else { /* Cancel periodic syncing before suspending */ - oinfo = sb_dqinfo(sb, type)->dqi_priv; cancel_delayed_work_sync(&oinfo->dqi_sync_work); status = dquot_suspend(sb, type); + if (status < 0) + break; } - if (status < 0) - break; } if (status < 0) mlog(ML_ERROR, "Failed to suspend/unsuspend quotas on " @@ -943,6 +946,7 @@ static int ocfs2_enable_quotas(struct ocfs2_super *osb) unsigned int ino[OCFS2_MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, LOCAL_GROUP_QUOTA_SYSTEM_INODE }; + struct ocfs2_mem_dqinfo *oinfo; int status; int type; @@ -960,6 +964,9 @@ static int ocfs2_enable_quotas(struct ocfs2_super *osb) DQUOT_USAGE_ENABLED); if (status < 0) goto out_quota_off; + oinfo = sb_dqinfo(sb, type)->dqi_priv; + schedule_delayed_work(&oinfo->dqi_sync_work, + msecs_to_jiffies(oinfo->dqi_syncms)); } for (type = 0; type < OCFS2_MAXQUOTAS; type++)