1b3b94faaSDavid Teigland /* 2b3b94faaSDavid Teigland * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 33a8a9a10SSteven Whitehouse * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4b3b94faaSDavid Teigland * 5b3b94faaSDavid Teigland * This copyrighted material is made available to anyone wishing to use, 6b3b94faaSDavid Teigland * modify, copy, or redistribute it subject to the terms and conditions 7e9fc2aa0SSteven Whitehouse * of the GNU General Public License version 2. 8b3b94faaSDavid Teigland */ 9b3b94faaSDavid Teigland 10b3b94faaSDavid Teigland #ifndef __QUOTA_DOT_H__ 11b3b94faaSDavid Teigland #define __QUOTA_DOT_H__ 12b3b94faaSDavid Teigland 132147dbfdSSteven Whitehouse #include <linux/list_lru.h> 142147dbfdSSteven Whitehouse 15f2f7ba52SSteven Whitehouse struct gfs2_inode; 16f2f7ba52SSteven Whitehouse struct gfs2_sbd; 17f2f7ba52SSteven Whitehouse 18f4108a60SEric W. Biederman #define NO_UID_QUOTA_CHANGE INVALID_UID 19f4108a60SEric W. Biederman #define NO_GID_QUOTA_CHANGE INVALID_GID 20b3b94faaSDavid Teigland 21b54e9a0bSBob Peterson extern int gfs2_qa_alloc(struct gfs2_inode *ip); 22b54e9a0bSBob Peterson extern void gfs2_qa_delete(struct gfs2_inode *ip); 237c06b5d6SEric W. Biederman extern int gfs2_quota_hold(struct gfs2_inode *ip, kuid_t uid, kgid_t gid); 249ac1b4d9SSteven Whitehouse extern void gfs2_quota_unhold(struct gfs2_inode *ip); 25b3b94faaSDavid Teigland 267c06b5d6SEric W. Biederman extern int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid); 279ac1b4d9SSteven Whitehouse extern void gfs2_quota_unlock(struct gfs2_inode *ip); 28b3b94faaSDavid Teigland 29b8fbf471SAbhi Das extern int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid, 30b8fbf471SAbhi Das struct gfs2_alloc_parms *ap); 319ac1b4d9SSteven Whitehouse extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change, 327c06b5d6SEric W. Biederman kuid_t uid, kgid_t gid); 33b3b94faaSDavid Teigland 34ceed1723SJan Kara extern int gfs2_quota_sync(struct super_block *sb, int type); 35ed87dabcSEric W. Biederman extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, struct kqid qid); 36b3b94faaSDavid Teigland 379ac1b4d9SSteven Whitehouse extern int gfs2_quota_init(struct gfs2_sbd *sdp); 389ac1b4d9SSteven Whitehouse extern void gfs2_quota_cleanup(struct gfs2_sbd *sdp); 399ac1b4d9SSteven Whitehouse extern int gfs2_quotad(void *data); 40b3b94faaSDavid Teigland 413d3c10f2SBenjamin Marzinski extern void gfs2_wake_up_statfs(struct gfs2_sbd *sdp); 423d3c10f2SBenjamin Marzinski 43b8fbf471SAbhi Das static inline int gfs2_quota_lock_check(struct gfs2_inode *ip, 44b8fbf471SAbhi Das struct gfs2_alloc_parms *ap) 45d82661d9SSteven Whitehouse { 46d82661d9SSteven Whitehouse struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 47d82661d9SSteven Whitehouse int ret; 48d82661d9SSteven Whitehouse if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) 49d82661d9SSteven Whitehouse return 0; 50f4108a60SEric W. Biederman ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE); 51d82661d9SSteven Whitehouse if (ret) 52d82661d9SSteven Whitehouse return ret; 53d82661d9SSteven Whitehouse if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON) 54d82661d9SSteven Whitehouse return 0; 55b8fbf471SAbhi Das ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid, ap); 56d82661d9SSteven Whitehouse if (ret) 57d82661d9SSteven Whitehouse gfs2_quota_unlock(ip); 58d82661d9SSteven Whitehouse return ret; 59d82661d9SSteven Whitehouse } 60d82661d9SSteven Whitehouse 61cc632e7fSSteven Whitehouse extern const struct quotactl_ops gfs2_quotactl_ops; 622147dbfdSSteven Whitehouse extern struct shrinker gfs2_qd_shrinker; 632147dbfdSSteven Whitehouse extern struct list_lru gfs2_qd_lru; 64c754fbbbSSteven Whitehouse extern void __init gfs2_quota_hash_init(void); 650a7ab79cSAbhijith Das 66b3b94faaSDavid Teigland #endif /* __QUOTA_DOT_H__ */ 67