quota.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  3. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
  4. *
  5. * This copyrighted material is made available to anyone wishing to use,
  6. * modify, copy, or redistribute it subject to the terms and conditions
  7. * of the GNU General Public License version 2.
  8. */
  9. #ifndef __QUOTA_DOT_H__
  10. #define __QUOTA_DOT_H__
  11. struct gfs2_inode;
  12. struct gfs2_sbd;
  13. struct shrink_control;
  14. #define NO_QUOTA_CHANGE ((u32)-1)
  15. extern int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid);
  16. extern void gfs2_quota_unhold(struct gfs2_inode *ip);
  17. extern int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid);
  18. extern void gfs2_quota_unlock(struct gfs2_inode *ip);
  19. extern int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid);
  20. extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
  21. u32 uid, u32 gid);
  22. extern int gfs2_quota_sync(struct super_block *sb, int type, int wait);
  23. extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id);
  24. extern int gfs2_quota_init(struct gfs2_sbd *sdp);
  25. extern void gfs2_quota_cleanup(struct gfs2_sbd *sdp);
  26. extern int gfs2_quotad(void *data);
  27. extern void gfs2_wake_up_statfs(struct gfs2_sbd *sdp);
  28. static inline int gfs2_quota_lock_check(struct gfs2_inode *ip)
  29. {
  30. struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
  31. int ret;
  32. if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
  33. return 0;
  34. ret = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
  35. if (ret)
  36. return ret;
  37. if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
  38. return 0;
  39. ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
  40. if (ret)
  41. gfs2_quota_unlock(ip);
  42. return ret;
  43. }
  44. extern int gfs2_shrink_qd_memory(struct shrinker *shrink,
  45. struct shrink_control *sc);
  46. extern const struct quotactl_ops gfs2_quotactl_ops;
  47. #endif /* __QUOTA_DOT_H__ */