xfs
[Top] [All Lists]

[RFC PATCH v1 4/4] cgroup quota: validate and charge inode quota for XF

To: cgroups@xxxxxxxxxxxxxxx
Subject: [RFC PATCH v1 4/4] cgroup quota: validate and charge inode quota for XFS
From: Jeff Liu <jeff.liu@xxxxxxxxxx>
Date: Fri, 09 Mar 2012 19:21:22 +0800
Cc: lxc-devel@xxxxxxxxxxxxxxxxxxxxx, "linux-fsdevel@xxxxxxxxxxxxxxx" <linux-fsdevel@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, tj@xxxxxxxxxx, Li Zefan <lizf@xxxxxxxxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxx>, Ben Myers <bpm@xxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>, Chris Mason <chris.mason@xxxxxxxxxx>, Christopher Jones <christopher.jones@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, jack@xxxxxxx, tytso@xxxxxxx
Organization: Oracle
Reply-to: jeff.liu@xxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11
Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
---
 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

<Prev in Thread] Current Thread [Next in Thread>
  • [RFC PATCH v1 4/4] cgroup quota: validate and charge inode quota for XFS, Jeff Liu <=