xfs: per-filesystem dquot LRU lists
[deliverable/linux.git] / fs / xfs / xfs_dquot.h
index a1d91d8f18027b9e217f07ff8769d9d4a21fe2a1..f291c25e5992630d1efa55fb303767fe854e298b 100644 (file)
@@ -47,7 +47,7 @@ struct xfs_trans;
  */
 typedef struct xfs_dquot {
        uint             dq_flags;      /* various flags (XFS_DQ_*) */
-       struct list_head q_freelist;    /* global free list of dquots */
+       struct list_head q_lru;         /* global free list of dquots */
        struct list_head q_mplist;      /* mount's list of dquots */
        struct list_head q_hashlist;    /* gloabl hash list of dquots */
        xfs_dqhash_t    *q_hash;        /* the hashchain header */
@@ -110,11 +110,37 @@ static inline void xfs_dqlock(struct xfs_dquot *dqp)
        mutex_lock(&dqp->q_qlock);
 }
 
-static inline void xfs_dqunlock_nonotify(struct xfs_dquot *dqp)
+static inline void xfs_dqunlock(struct xfs_dquot *dqp)
 {
        mutex_unlock(&dqp->q_qlock);
 }
 
+static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
+{
+       switch (type & XFS_DQ_ALLTYPES) {
+       case XFS_DQ_USER:
+               return XFS_IS_UQUOTA_ON(mp);
+       case XFS_DQ_GROUP:
+       case XFS_DQ_PROJ:
+               return XFS_IS_OQUOTA_ON(mp);
+       default:
+               return 0;
+       }
+}
+
+static inline xfs_dquot_t *xfs_inode_dquot(struct xfs_inode *ip, int type)
+{
+       switch (type & XFS_DQ_ALLTYPES) {
+       case XFS_DQ_USER:
+               return ip->i_udquot;
+       case XFS_DQ_GROUP:
+       case XFS_DQ_PROJ:
+               return ip->i_gdquot;
+       default:
+               return NULL;
+       }
+}
+
 #define XFS_DQ_IS_LOCKED(dqp)  (mutex_is_locked(&((dqp)->q_qlock)))
 #define XFS_DQ_IS_DIRTY(dqp)   ((dqp)->dq_flags & XFS_DQ_DIRTY)
 #define XFS_QM_ISUDQ(dqp)      ((dqp)->dq_flags & XFS_DQ_USER)
@@ -125,10 +151,6 @@ static inline void xfs_dqunlock_nonotify(struct xfs_dquot *dqp)
                                 XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \
                                 XFS_DQ_TO_QINF(dqp)->qi_gquotaip)
 
-#define XFS_IS_THIS_QUOTA_OFF(d) (! (XFS_QM_ISUDQ(d) ? \
-                                    (XFS_IS_UQUOTA_ON((d)->q_mount)) : \
-                                    (XFS_IS_OQUOTA_ON((d)->q_mount))))
-
 extern int             xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint,
                                        uint, struct xfs_dquot  **);
 extern void            xfs_qm_dqdestroy(xfs_dquot_t *);
@@ -144,7 +166,6 @@ extern int          xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *,
 extern void            xfs_qm_dqput(xfs_dquot_t *);
 
 extern void            xfs_dqlock2(struct xfs_dquot *, struct xfs_dquot *);
-extern void            xfs_dqunlock(struct xfs_dquot *);
 extern void            xfs_dqflock_pushbuf_wait(struct xfs_dquot *dqp);
 
 static inline struct xfs_dquot *xfs_qm_dqhold(struct xfs_dquot *dqp)
This page took 0.025262 seconds and 5 git commands to generate.