0001
0002
0003
0004
0005
0006
0007 #ifndef __QUOTA_DOT_H__
0008 #define __QUOTA_DOT_H__
0009
0010 #include <linux/list_lru.h>
0011
0012 struct gfs2_inode;
0013 struct gfs2_sbd;
0014
0015 #define NO_UID_QUOTA_CHANGE INVALID_UID
0016 #define NO_GID_QUOTA_CHANGE INVALID_GID
0017
0018 extern int gfs2_qa_get(struct gfs2_inode *ip);
0019 extern void gfs2_qa_put(struct gfs2_inode *ip);
0020 extern int gfs2_quota_hold(struct gfs2_inode *ip, kuid_t uid, kgid_t gid);
0021 extern void gfs2_quota_unhold(struct gfs2_inode *ip);
0022
0023 extern int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid);
0024 extern void gfs2_quota_unlock(struct gfs2_inode *ip);
0025
0026 extern int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid,
0027 struct gfs2_alloc_parms *ap);
0028 extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
0029 kuid_t uid, kgid_t gid);
0030
0031 extern int gfs2_quota_sync(struct super_block *sb, int type);
0032 extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, struct kqid qid);
0033
0034 extern int gfs2_quota_init(struct gfs2_sbd *sdp);
0035 extern void gfs2_quota_cleanup(struct gfs2_sbd *sdp);
0036 extern int gfs2_quotad(void *data);
0037
0038 extern void gfs2_wake_up_statfs(struct gfs2_sbd *sdp);
0039
0040 static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,
0041 struct gfs2_alloc_parms *ap)
0042 {
0043 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
0044 int ret;
0045
0046 ap->allowed = UINT_MAX;
0047 if (capable(CAP_SYS_RESOURCE) ||
0048 sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
0049 return 0;
0050 ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
0051 if (ret)
0052 return ret;
0053 if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
0054 return 0;
0055 ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid, ap);
0056 if (ret)
0057 gfs2_quota_unlock(ip);
0058 return ret;
0059 }
0060
0061 extern const struct quotactl_ops gfs2_quotactl_ops;
0062 extern struct shrinker gfs2_qd_shrinker;
0063 extern struct list_lru gfs2_qd_lru;
0064 extern void __init gfs2_quota_hash_init(void);
0065
0066 #endif