]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/gfs2/quota.h
xen: measure how long spinlocks spend blocking
[linux-2.6-omap-h63xx.git] / fs / gfs2 / quota.h
index d93c61c99365efff7bd1fccc18bca1dd99e1d29f..3b7f4b0e5dfe0fee9e155f01f2fc3fa224ddabfc 100644 (file)
@@ -10,6 +10,9 @@
 #ifndef __QUOTA_DOT_H__
 #define __QUOTA_DOT_H__
 
+struct gfs2_inode;
+struct gfs2_sbd;
+
 #define NO_QUOTA_CHANGE ((u32)-1)
 
 int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid);
@@ -29,4 +32,21 @@ int gfs2_quota_init(struct gfs2_sbd *sdp);
 void gfs2_quota_scan(struct gfs2_sbd *sdp);
 void gfs2_quota_cleanup(struct gfs2_sbd *sdp);
 
+static inline int gfs2_quota_lock_check(struct gfs2_inode *ip)
+{
+       struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
+       int ret;
+       if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
+               return 0;
+       ret = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
+       if (ret)
+               return ret;
+       if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
+               return 0;
+       ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
+       if (ret)
+               gfs2_quota_unlock(ip);
+       return ret;
+}
+
 #endif /* __QUOTA_DOT_H__ */