2005-04-17 02:20:36 +04:00
/*
2005-11-02 06:58:39 +03:00
* Copyright ( c ) 2000 - 2005 Silicon Graphics , Inc .
* All Rights Reserved .
2005-04-17 02:20:36 +04:00
*
2005-11-02 06:58:39 +03:00
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License as
2005-04-17 02:20:36 +04:00
* published by the Free Software Foundation .
*
2005-11-02 06:58:39 +03:00
* This program is distributed in the hope that it would be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
2005-04-17 02:20:36 +04:00
*
2005-11-02 06:58:39 +03:00
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write the Free Software Foundation ,
* Inc . , 51 Franklin St , Fifth Floor , Boston , MA 02110 - 1301 USA
2005-04-17 02:20:36 +04:00
*/
# ifndef __XFS_QUOTA_H__
# define __XFS_QUOTA_H__
2013-08-12 14:49:30 +04:00
# include "xfs_quota_defs.h"
2009-02-09 10:47:34 +03:00
2005-04-17 02:20:36 +04:00
/*
2013-08-12 14:49:30 +04:00
* Kernel only quota definitions and functions
2005-04-17 02:20:36 +04:00
*/
2005-06-21 09:38:48 +04:00
2013-08-12 14:49:30 +04:00
struct xfs_trans ;
2005-04-17 02:20:36 +04:00
/*
* This check is done typically without holding the inode lock ;
2006-03-29 02:55:14 +04:00
* that may seem racy , but it is harmless in the context that it is used .
2005-04-17 02:20:36 +04:00
* The inode cannot go inactive as long a reference is kept , and
* therefore if dquot ( s ) were attached , they ' ll stay consistent .
* If , for example , the ownership of the inode changes while
* we didn ' t have the inode locked , the appropriate dquot ( s ) will be
* attached atomically .
*/
2013-07-11 09:00:40 +04:00
# define XFS_NOT_DQATTACHED(mp, ip) \
( ( XFS_IS_UQUOTA_ON ( mp ) & & ( ip ) - > i_udquot = = NULL ) | | \
( XFS_IS_GQUOTA_ON ( mp ) & & ( ip ) - > i_gdquot = = NULL ) | | \
( XFS_IS_PQUOTA_ON ( mp ) & & ( ip ) - > i_pdquot = = NULL ) )
2005-04-17 02:20:36 +04:00
2005-06-21 09:38:48 +04:00
# define XFS_QM_NEED_QUOTACHECK(mp) \
( ( XFS_IS_UQUOTA_ON ( mp ) & & \
( mp - > m_sb . sb_qflags & XFS_UQUOTA_CHKD ) = = 0 ) | | \
( XFS_IS_GQUOTA_ON ( mp ) & & \
2013-06-28 02:25:10 +04:00
( mp - > m_sb . sb_qflags & XFS_GQUOTA_CHKD ) = = 0 ) | | \
2005-06-21 09:38:48 +04:00
( XFS_IS_PQUOTA_ON ( mp ) & & \
2013-06-28 02:25:10 +04:00
( mp - > m_sb . sb_qflags & XFS_PQUOTA_CHKD ) = = 0 ) )
2005-04-17 02:20:36 +04:00
/*
* The structure kept inside the xfs_trans_t keep track of dquot changes
* within a transaction and apply them later .
*/
typedef struct xfs_dqtrx {
struct xfs_dquot * qt_dquot ; /* the dquot this refers to */
ulong qt_blk_res ; /* blks reserved on a dquot */
ulong qt_ino_res ; /* inode reserved on a dquot */
ulong qt_ino_res_used ; /* inodes used from the reservation */
long qt_bcount_delta ; /* dquot blk count changes */
long qt_delbcnt_delta ; /* delayed dquot blk count changes */
long qt_icount_delta ; /* dquot inode count changes */
ulong qt_rtblk_res ; /* # blks reserved on a dquot */
ulong qt_rtblk_res_used ; /* # blks used from reservation */
long qt_rtbcount_delta ; /* dquot realtime blk changes */
long qt_delrtb_delta ; /* delayed RT blk count changes */
} xfs_dqtrx_t ;
2009-06-08 17:33:32 +04:00
# ifdef CONFIG_XFS_QUOTA
extern void xfs_trans_dup_dqinfo ( struct xfs_trans * , struct xfs_trans * ) ;
extern void xfs_trans_free_dqinfo ( struct xfs_trans * ) ;
extern void xfs_trans_mod_dquot_byino ( struct xfs_trans * , struct xfs_inode * ,
uint , long ) ;
extern void xfs_trans_apply_dquot_deltas ( struct xfs_trans * ) ;
extern void xfs_trans_unreserve_and_mod_dquots ( struct xfs_trans * ) ;
extern int xfs_trans_reserve_quota_nblks ( struct xfs_trans * ,
struct xfs_inode * , long , long , uint ) ;
extern int xfs_trans_reserve_quota_bydquots ( struct xfs_trans * ,
struct xfs_mount * , struct xfs_dquot * ,
2013-07-11 09:00:40 +04:00
struct xfs_dquot * , struct xfs_dquot * , long , long , uint ) ;
2009-06-08 17:33:32 +04:00
2013-08-15 22:08:01 +04:00
extern int xfs_qm_vop_dqalloc ( struct xfs_inode * , xfs_dqid_t , xfs_dqid_t ,
prid_t , uint , struct xfs_dquot * * , struct xfs_dquot * * ,
struct xfs_dquot * * ) ;
2009-06-08 17:33:32 +04:00
extern void xfs_qm_vop_create_dqattach ( struct xfs_trans * , struct xfs_inode * ,
2013-07-11 09:00:40 +04:00
struct xfs_dquot * , struct xfs_dquot * , struct xfs_dquot * ) ;
2009-06-08 17:33:32 +04:00
extern int xfs_qm_vop_rename_dqattach ( struct xfs_inode * * ) ;
extern struct xfs_dquot * xfs_qm_vop_chown ( struct xfs_trans * ,
struct xfs_inode * , struct xfs_dquot * * , struct xfs_dquot * ) ;
extern int xfs_qm_vop_chown_reserve ( struct xfs_trans * , struct xfs_inode * ,
2013-07-11 09:00:40 +04:00
struct xfs_dquot * , struct xfs_dquot * ,
struct xfs_dquot * , uint ) ;
2009-06-08 17:33:32 +04:00
extern int xfs_qm_dqattach ( struct xfs_inode * , uint ) ;
extern int xfs_qm_dqattach_locked ( struct xfs_inode * , uint ) ;
extern void xfs_qm_dqdetach ( struct xfs_inode * ) ;
extern void xfs_qm_dqrele ( struct xfs_dquot * ) ;
extern void xfs_qm_statvfs ( struct xfs_inode * , struct kstatfs * ) ;
extern int xfs_qm_newmount ( struct xfs_mount * , uint * , uint * ) ;
extern void xfs_qm_mount_quotas ( struct xfs_mount * ) ;
extern void xfs_qm_unmount ( struct xfs_mount * ) ;
extern void xfs_qm_unmount_quotas ( struct xfs_mount * ) ;
# else
2009-06-12 19:34:55 +04:00
static inline int
2013-08-15 22:08:01 +04:00
xfs_qm_vop_dqalloc ( struct xfs_inode * ip , xfs_dqid_t uid , xfs_dqid_t gid ,
prid_t prid , uint flags , struct xfs_dquot * * udqp ,
struct xfs_dquot * * gdqp , struct xfs_dquot * * pdqp )
2009-06-12 19:34:55 +04:00
{
* udqp = NULL ;
* gdqp = NULL ;
2013-07-11 09:00:40 +04:00
* pdqp = NULL ;
2009-06-12 19:34:55 +04:00
return 0 ;
}
2009-06-08 17:33:32 +04:00
# define xfs_trans_dup_dqinfo(tp, tp2)
# define xfs_trans_free_dqinfo(tp)
# define xfs_trans_mod_dquot_byino(tp, ip, fields, delta)
# define xfs_trans_apply_dquot_deltas(tp)
# define xfs_trans_unreserve_and_mod_dquots(tp)
2010-11-06 14:42:56 +03:00
static inline int xfs_trans_reserve_quota_nblks ( struct xfs_trans * tp ,
struct xfs_inode * ip , long nblks , long ninos , uint flags )
{
return 0 ;
}
static inline int xfs_trans_reserve_quota_bydquots ( struct xfs_trans * tp ,
struct xfs_mount * mp , struct xfs_dquot * udqp ,
2013-07-11 09:00:40 +04:00
struct xfs_dquot * gdqp , struct xfs_dquot * pdqp ,
long nblks , long nions , uint flags )
2010-11-06 14:42:56 +03:00
{
return 0 ;
}
2013-07-11 09:00:40 +04:00
# define xfs_qm_vop_create_dqattach(tp, ip, u, g, p)
2009-06-08 17:33:32 +04:00
# define xfs_qm_vop_rename_dqattach(it) (0)
# define xfs_qm_vop_chown(tp, ip, old, new) (NULL)
2013-07-11 09:00:40 +04:00
# define xfs_qm_vop_chown_reserve(tp, ip, u, g, p, fl) (0)
2009-06-08 17:33:32 +04:00
# define xfs_qm_dqattach(ip, fl) (0)
# define xfs_qm_dqattach_locked(ip, fl) (0)
# define xfs_qm_dqdetach(ip)
# define xfs_qm_dqrele(d)
# define xfs_qm_statvfs(ip, s)
# define xfs_qm_newmount(mp, a, b) (0)
# define xfs_qm_mount_quotas(mp)
# define xfs_qm_unmount(mp)
2010-11-06 14:42:56 +03:00
# define xfs_qm_unmount_quotas(mp)
2009-06-08 17:33:32 +04:00
# endif /* CONFIG_XFS_QUOTA */
# define xfs_trans_unreserve_quota_nblks(tp, ip, nblks, ninos, flags) \
xfs_trans_reserve_quota_nblks ( tp , ip , - ( nblks ) , - ( ninos ) , flags )
2013-07-11 09:00:40 +04:00
# define xfs_trans_reserve_quota(tp, mp, ud, gd, pd, nb, ni, f) \
xfs_trans_reserve_quota_bydquots ( tp , mp , ud , gd , pd , nb , ni , \
2005-04-17 02:20:36 +04:00
f | XFS_QMOPT_RES_REGBLKS )
2005-09-05 02:24:10 +04:00
extern int xfs_mount_reset_sbqflags ( struct xfs_mount * ) ;
2005-04-17 02:20:36 +04:00
# endif /* __XFS_QUOTA_H__ */