All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Liu <jeff.liu@oracle.com>
To: cgroups@vger.kernel.org
Cc: lxc-devel@lists.sourceforge.net,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	xfs@oss.sgi.com, tj@kernel.org, Li Zefan <lizf@cn.fujitsu.com>,
	Daniel Lezcano <daniel.lezcano@free.fr>, Ben Myers <bpm@sgi.com>,
	Christoph Hellwig <hch@infradead.org>,
	Chris Mason <chris.mason@oracle.com>,
	Christopher Jones <christopher.jones@oracle.com>,
	Dave Chinner <david@fromorbit.com>,
	jack@suse.cz, tytso@mit.edu
Subject: [RFC PATCH v1 4/4] cgroup quota: validate and charge  inode quota for XFS
Date: Fri, 09 Mar 2012 19:21:22 +0800	[thread overview]
Message-ID: <4F59E7B2.6090006@oracle.com> (raw)

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 fs/xfs/xfs_vnodeops.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index ce9268a..4824eef 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -50,6 +50,8 @@
 #include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 
+#include <linux/quota_cgroup.h>
+
 /*
  * The maximum pathlen is 1024 bytes. Since the minimum file system
  * blocksize is 512 bytes, we can get a max of 2 extents back from
@@ -853,6 +855,10 @@ xfs_create(
 	else
 		prid = XFS_PROJID_DEFAULT;
 
+	error = quota_cgroup_validate_pquota(QUOTA_NEW_INODE, prid, 1);
+	if (error)
+		return error;
+
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
 	 */
@@ -983,6 +989,8 @@ xfs_create(
 	 */
 	xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp);
 
+	quota_cgroup_charge_pquota(QUOTA_NEW_INODE, prid, 1);
+
 	error = xfs_bmap_finish(&tp, &free_list, &committed);
 	if (error)
 		goto out_bmap_cancel;
@@ -1354,6 +1362,8 @@ xfs_remove(
 	if (!is_dir && link_zero && xfs_inode_is_filestream(ip))
 		xfs_filestream_deassociate(ip);
 
+	quota_cgroup_charge_pquota(QUOTA_DROP_INODE, xfs_get_projid(ip), 1);
+
 	return 0;
 
  out_bmap_cancel:
-- 
1.7.9

WARNING: multiple messages have this Message-ID (diff)
From: Jeff Liu <jeff.liu@oracle.com>
To: cgroups@vger.kernel.org
Cc: jack@suse.cz, Daniel Lezcano <daniel.lezcano@free.fr>,
	Christopher Jones <christopher.jones@oracle.com>,
	Li Zefan <lizf@cn.fujitsu.com>,
	xfs@oss.sgi.com, Christoph Hellwig <hch@infradead.org>,
	tj@kernel.org, Ben Myers <bpm@sgi.com>,
	lxc-devel@lists.sourceforge.net,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	tytso@mit.edu, Chris Mason <chris.mason@oracle.com>
Subject: [RFC PATCH v1 4/4] cgroup quota: validate and charge  inode quota for XFS
Date: Fri, 09 Mar 2012 19:21:22 +0800	[thread overview]
Message-ID: <4F59E7B2.6090006@oracle.com> (raw)

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 fs/xfs/xfs_vnodeops.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index ce9268a..4824eef 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -50,6 +50,8 @@
 #include "xfs_vnodeops.h"
 #include "xfs_trace.h"
 
+#include <linux/quota_cgroup.h>
+
 /*
  * The maximum pathlen is 1024 bytes. Since the minimum file system
  * blocksize is 512 bytes, we can get a max of 2 extents back from
@@ -853,6 +855,10 @@ xfs_create(
 	else
 		prid = XFS_PROJID_DEFAULT;
 
+	error = quota_cgroup_validate_pquota(QUOTA_NEW_INODE, prid, 1);
+	if (error)
+		return error;
+
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
 	 */
@@ -983,6 +989,8 @@ xfs_create(
 	 */
 	xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp);
 
+	quota_cgroup_charge_pquota(QUOTA_NEW_INODE, prid, 1);
+
 	error = xfs_bmap_finish(&tp, &free_list, &committed);
 	if (error)
 		goto out_bmap_cancel;
@@ -1354,6 +1362,8 @@ xfs_remove(
 	if (!is_dir && link_zero && xfs_inode_is_filestream(ip))
 		xfs_filestream_deassociate(ip);
 
+	quota_cgroup_charge_pquota(QUOTA_DROP_INODE, xfs_get_projid(ip), 1);
+
 	return 0;
 
  out_bmap_cancel:
-- 
1.7.9

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2012-03-09 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09 11:21 Jeff Liu [this message]
2012-03-09 11:21 ` [RFC PATCH v1 4/4] cgroup quota: validate and charge inode quota for XFS Jeff Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F59E7B2.6090006@oracle.com \
    --to=jeff.liu@oracle.com \
    --cc=bpm@sgi.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chris.mason@oracle.com \
    --cc=christopher.jones@oracle.com \
    --cc=daniel.lezcano@free.fr \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=lxc-devel@lists.sourceforge.net \
    --cc=tj@kernel.org \
    --cc=tytso@mit.edu \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.