Skip to content

Commit

Permalink
[XFS] remove dependency of the quota module on behaviors
Browse files Browse the repository at this point in the history
Mount options are now parsed by the main XFS module and rejected if quota
support is not available, and there are some new quota operation for the
quotactl syscall and calls to quote in the mount, unmount and sync
callchains.

SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29503a

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
  • Loading branch information
Christoph Hellwig authored and Tim Shimmin committed Oct 16, 2007
1 parent 293688e commit b09cc77
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 303 deletions.
10 changes: 5 additions & 5 deletions fs/xfs/linux-2.6/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,15 +729,15 @@ xfs_fs_quotasync(
struct super_block *sb,
int type)
{
return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XQUOTASYNC, 0, NULL);
return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL);
}

STATIC int
xfs_fs_getxstate(
struct super_block *sb,
struct fs_quota_stat *fqs)
{
return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
}

STATIC int
Expand All @@ -746,7 +746,7 @@ xfs_fs_setxstate(
unsigned int flags,
int op)
{
return -bhv_vfs_quotactl(vfs_from_sb(sb), op, 0, (caddr_t)&flags);
return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags);
}

STATIC int
Expand All @@ -756,7 +756,7 @@ xfs_fs_getxquota(
qid_t id,
struct fs_disk_quota *fdq)
{
return -bhv_vfs_quotactl(vfs_from_sb(sb),
return -XFS_QM_QUOTACTL(XFS_M(sb),
(type == USRQUOTA) ? Q_XGETQUOTA :
((type == GRPQUOTA) ? Q_XGETGQUOTA :
Q_XGETPQUOTA), id, (caddr_t)fdq);
Expand All @@ -769,7 +769,7 @@ xfs_fs_setxquota(
qid_t id,
struct fs_disk_quota *fdq)
{
return -bhv_vfs_quotactl(vfs_from_sb(sb),
return -XFS_QM_QUOTACTL(XFS_M(sb),
(type == USRQUOTA) ? Q_XSETQLIM :
((type == GRPQUOTA) ? Q_XSETGQLIM :
Q_XSETPQLIM), id, (caddr_t)fdq);
Expand Down
3 changes: 3 additions & 0 deletions fs/xfs/linux-2.6/xfs_super.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,7 @@ extern void xfs_blkdev_issue_flush(struct xfs_buftarg *);

extern struct export_operations xfs_export_operations;

#define XFS_M(sb) \
XFS_VFSTOM(vfs_from_sb(sb))

#endif /* __XFS_SUPER_H__ */
15 changes: 0 additions & 15 deletions fs/xfs/linux-2.6/xfs_vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,6 @@ vfs_vget(
return ((*bhvtovfsops(next)->vfs_vget)(next, vpp, fidp));
}

int
vfs_quotactl(
struct bhv_desc *bdp,
int cmd,
int id,
caddr_t addr)
{
struct bhv_desc *next = bdp;

ASSERT(next);
while (! (bhvtovfsops(next))->vfs_quotactl)
next = BHV_NEXT(next);
return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
}

void
vfs_init_vnode(
struct bhv_desc *bdp,
Expand Down
5 changes: 0 additions & 5 deletions fs/xfs/linux-2.6/xfs_vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ typedef int (*vfs_statvfs_t)(bhv_desc_t *, bhv_statvfs_t *,
struct inode *);
typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *);
typedef int (*vfs_vget_t)(bhv_desc_t *, struct inode **, struct fid *);
typedef int (*vfs_quotactl_t)(bhv_desc_t *, int, int, caddr_t);
typedef void (*vfs_init_vnode_t)(bhv_desc_t *,
struct inode *, struct xfs_inode *, int);
typedef void (*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int);
Expand All @@ -144,7 +143,6 @@ typedef struct bhv_vfsops {
vfs_statvfs_t vfs_statvfs; /* file system statistics */
vfs_sync_t vfs_sync; /* flush files */
vfs_vget_t vfs_vget; /* get vnode from fid */
vfs_quotactl_t vfs_quotactl; /* disk quota */
vfs_init_vnode_t vfs_init_vnode; /* initialize a new vnode */
vfs_force_shutdown_t vfs_force_shutdown; /* crash and burn */
vfs_freeze_t vfs_freeze; /* freeze fs for snapshot */
Expand All @@ -163,7 +161,6 @@ typedef struct bhv_vfsops {
#define bhv_vfs_statvfs(v, sp,vp) vfs_statvfs(VFSHEAD(v), sp,vp)
#define bhv_vfs_sync(v, flag,cr) vfs_sync(VFSHEAD(v), flag,cr)
#define bhv_vfs_vget(v, vpp,fidp) vfs_vget(VFSHEAD(v), vpp,fidp)
#define bhv_vfs_quotactl(v, c,id,p) vfs_quotactl(VFSHEAD(v), c,id,p)
#define bhv_vfs_init_vnode(v, vp,b,ul) vfs_init_vnode(VFSHEAD(v), vp,b,ul)
#define bhv_vfs_force_shutdown(v,u,f,l) vfs_force_shutdown(VFSHEAD(v), u,f,l)
#define bhv_vfs_freeze(v) vfs_freeze(VFSHEAD(v))
Expand All @@ -180,7 +177,6 @@ typedef struct bhv_vfsops {
#define bhv_next_vfs_statvfs(b, sp,vp) vfs_statvfs(b, sp,vp)
#define bhv_next_vfs_sync(b, flag,cr) vfs_sync(b, flag,cr)
#define bhv_next_vfs_vget(b, vpp,fidp) vfs_vget(b, vpp,fidp)
#define bhv_next_vfs_quotactl(b, c,id,p) vfs_quotactl(b, c,id,p)
#define bhv_next_vfs_init_vnode(b, vp,b2,ul) vfs_init_vnode(b, vp,b2,ul)
#define bhv_next_force_shutdown(b, fl,f,l) vfs_force_shutdown(b, fl,f,l)
#define bhv_next_vfs_freeze(b) vfs_freeze(b)
Expand All @@ -194,7 +190,6 @@ extern int vfs_root(bhv_desc_t *, struct inode **);
extern int vfs_statvfs(bhv_desc_t *, bhv_statvfs_t *, struct inode *);
extern int vfs_sync(bhv_desc_t *, int, struct cred *);
extern int vfs_vget(bhv_desc_t *, struct inode **, struct fid *);
extern int vfs_quotactl(bhv_desc_t *, int, int, caddr_t);
extern void vfs_init_vnode(bhv_desc_t *, struct inode *, struct xfs_inode *, int);
extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int);
extern void vfs_freeze(bhv_desc_t *);
Expand Down
41 changes: 1 addition & 40 deletions fs/xfs/quota/xfs_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,45 +287,6 @@ xfs_qm_rele_quotafs_ref(
XFS_QM_UNLOCK(xfs_Gqm);
}

/*
* This is called at mount time from xfs_mountfs to initialize the quotainfo
* structure and start the global quota manager (xfs_Gqm) if it hasn't done
* so already. Note that the superblock has not been read in yet.
*/
void
xfs_qm_mount_quotainit(
xfs_mount_t *mp,
uint flags)
{
/*
* User, projects or group quotas has to be on.
*/
ASSERT(flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA));

/*
* Initialize the flags in the mount structure. From this point
* onwards we look at m_qflags to figure out if quotas's ON/OFF, etc.
* Note that we enforce nothing if accounting is off.
* ie. XFSMNT_*QUOTA must be ON for XFSMNT_*QUOTAENF.
* It isn't necessary to take the quotaoff lock to do this; this is
* called from mount.
*/
if (flags & XFSMNT_UQUOTA) {
mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE);
if (flags & XFSMNT_UQUOTAENF)
mp->m_qflags |= XFS_UQUOTA_ENFD;
}
if (flags & XFSMNT_GQUOTA) {
mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE);
if (flags & XFSMNT_GQUOTAENF)
mp->m_qflags |= XFS_OQUOTA_ENFD;
} else if (flags & XFSMNT_PQUOTA) {
mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE);
if (flags & XFSMNT_PQUOTAENF)
mp->m_qflags |= XFS_OQUOTA_ENFD;
}
}

/*
* Just destroy the quotainfo structure.
*/
Expand Down Expand Up @@ -1039,7 +1000,7 @@ xfs_qm_dqdetach(
int
xfs_qm_sync(
xfs_mount_t *mp,
short flags)
int flags)
{
int recl, restarts;
xfs_dquot_t *dqp;
Expand Down
6 changes: 3 additions & 3 deletions fs/xfs/quota/xfs_qm.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,11 @@ typedef struct xfs_dquot_acct {

extern void xfs_qm_destroy_quotainfo(xfs_mount_t *);
extern int xfs_qm_mount_quotas(xfs_mount_t *, int);
extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint);
extern int xfs_qm_quotacheck(xfs_mount_t *);
extern void xfs_qm_unmount_quotadestroy(xfs_mount_t *);
extern int xfs_qm_unmount_quotas(xfs_mount_t *);
extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t);
extern int xfs_qm_sync(xfs_mount_t *, short);
extern int xfs_qm_sync(xfs_mount_t *, int);

/* dquot stuff */
extern boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t **);
Expand Down Expand Up @@ -199,7 +198,8 @@ extern void xfs_qm_freelist_unlink(xfs_dquot_t *);
extern int xfs_qm_freelist_lock_nowait(xfs_qm_t *);

/* system call interface */
extern int xfs_qm_quotactl(bhv_desc_t *, int, int, xfs_caddr_t);
extern int xfs_qm_quotactl(struct xfs_mount *, int, int,
xfs_caddr_t);

#ifdef DEBUG
extern int xfs_qm_internalqcheck(xfs_mount_t *);
Expand Down
Loading

0 comments on commit b09cc77

Please sign in to comment.