From patchwork Fri Jan 16 12:47:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 5648271 Return-Path: X-Original-To: patchwork-ocfs2-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B66ADC058E for ; Fri, 16 Jan 2015 12:50:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA2DE201E4 for ; Fri, 16 Jan 2015 12:50:20 +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 CA9A6201CD for ; Fri, 16 Jan 2015 12:50:19 +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 t0GCnhK2029180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 16 Jan 2015 12:49:44 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t0GCnh3C000866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Jan 2015 12:49: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 1YC6LP-0003Px-4g; Fri, 16 Jan 2015 04:49:43 -0800 Received: from ucsinet21.oracle.com ([156.151.31.93]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1YC6Jt-0003Jb-MA for ocfs2-devel@oss.oracle.com; Fri, 16 Jan 2015 04:48:09 -0800 Received: from aserp1020.oracle.com (aserp1020.oracle.com [141.146.126.67]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t0GCm8CK000385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Jan 2015 12:48:09 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserp1020.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t0GCm8w3029207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 16 Jan 2015 12:48:08 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.14.7/8.14.7) with SMTP id t0GCm04s001000 for ; Fri, 16 Jan 2015 12:48:07 GMT Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by userp2030.oracle.com with ESMTP id 1rxpsp4ktb-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NOT) for ; Fri, 16 Jan 2015 12:48:07 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CC5DFADD2; Fri, 16 Jan 2015 12:48:01 +0000 (UTC) Received: by quack.suse.cz (Postfix, from userid 1000) id CB72C8295C; Fri, 16 Jan 2015 13:48:00 +0100 (CET) From: Jan Kara To: linux-fsdevel@vger.kernel.org Date: Fri, 16 Jan 2015 13:47:50 +0100 Message-Id: <1421412471-4747-17-git-send-email-jack@suse.cz> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1421412471-4747-1-git-send-email-jack@suse.cz> References: <1421412471-4747-1-git-send-email-jack@suse.cz> X-ServerName: cantor2.suse.de X-Proofpoint-Virus-Version: vendor=nai engine=5600 definitions=7682 signatures=670500 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1501160124 Cc: cluster-devel@redhat.com, Jan Kara , ocfs2-devel@oss.oracle.com, xfs@oss.sgi.com Subject: [Ocfs2-devel] [PATCH 16/17] xfs: Add support for Q_SETINFO 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-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 Add support to XFS so that time limits can be set through Q_SETINFO quotactl. Signed-off-by: Jan Kara --- fs/xfs/xfs_qm.h | 2 ++ fs/xfs/xfs_qm_syscalls.c | 25 +++++++++++++++++++++++++ fs/xfs/xfs_quotaops.c | 16 ++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h index d308e9610548..c1a9761d37db 100644 --- a/fs/xfs/xfs_qm.h +++ b/fs/xfs/xfs_qm.h @@ -170,6 +170,8 @@ extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, struct qc_dqblk *); extern int xfs_qm_scall_getstate(struct xfs_mount *, struct qc_state *); +extern int xfs_qm_scall_setinfo(struct xfs_mount *, uint, + struct qc_info *); extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint); extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint); diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 5ccafb4c7e79..9ede1ffec8d8 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c @@ -451,6 +451,31 @@ int xfs_qm_scall_getstate(struct xfs_mount *mp, struct qc_state *state) return 0; } +#define XFS_QC_SETINFO_MASK (QC_TIMER_MASK | QC_WARNS_MASK) + +/* + * Adjust quota timers & warnings + */ +int xfs_qm_scall_setinfo(struct xfs_mount *mp, uint type, struct qc_info *info) +{ + struct qc_dqblk newlim; + + if (info->i_fieldmask & ~XFS_QC_SETINFO_MASK) + return -EINVAL; + if ((info->i_fieldmask & XFS_QC_SETINFO_MASK) == 0) + return 0; + + newlim.d_fieldmask = info->i_fieldmask; + newlim.d_spc_timer = info->i_spc_timelimit; + newlim.d_ino_timer = info->i_ino_timelimit; + newlim.d_rt_spc_timer = info->i_rt_spc_timelimit; + newlim.d_ino_warns = info->i_ino_warnlimit; + newlim.d_spc_warns = info->i_spc_warnlimit; + newlim.d_rt_spc_warns = info->i_rt_spc_warnlimit; + + return xfs_qm_scall_setqlim(mp, 0, type, &newlim); +} + #define XFS_QC_MASK \ (QC_LIMIT_MASK | QC_TIMER_MASK | QC_WARNS_MASK) diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c index 698e6faac519..a25f482955a7 100644 --- a/fs/xfs/xfs_quotaops.c +++ b/fs/xfs/xfs_quotaops.c @@ -45,6 +45,21 @@ static int xfs_fs_get_quota_state(struct super_block *sb, struct qc_state *s) return xfs_qm_scall_getstate(XFS_M(sb), s); } +static int xfs_fs_set_info(struct super_block *sb, int type, + struct qc_info *info) +{ + struct xfs_mount *mp = XFS_M(sb); + + if (sb->s_flags & MS_RDONLY) + return -EROFS; + if (!XFS_IS_QUOTA_RUNNING(mp)) + return -ENOSYS; + if (!XFS_IS_QUOTA_ON(mp)) + return -ESRCH; + + return xfs_qm_scall_setinfo(mp, xfs_quota_type(type), info); +} + static unsigned int xfs_quota_flags(unsigned int uflags) { unsigned int flags = 0; @@ -159,6 +174,7 @@ xfs_fs_set_dqblk( const struct quotactl_ops xfs_quotactl_operations = { .get_state = xfs_fs_get_quota_state, + .set_info = xfs_fs_set_info, .quota_enable = xfs_quota_enable, .quota_disable = xfs_quota_disable, .rm_xquota = xfs_fs_rm_xquota,