* [Cluster-devel] GFS2: A quota of quota patches
2009-09-14 13:51 [Cluster-devel] GFS2: A quota of quota patches Steven Whitehouse
@ 2009-09-14 13:11 ` Fabio Massimo Di Nitto
2009-09-14 13:17 ` Steven Whitehouse
2009-09-14 13:51 ` [Cluster-devel] [PATCH 1/4] GFS2: Alter arguments of gfs2_quota/statfs_sync Steven Whitehouse
1 sibling, 1 reply; 7+ messages in thread
From: Fabio Massimo Di Nitto @ 2009-09-14 13:11 UTC (permalink / raw)
To: cluster-devel.redhat.com
Steven Whitehouse wrote:
> This set of patches is a start towards the overall goal of making
> the GFS2 quota system accessible via a generic interface. In this
> case I've chosen the XFS style quota interface because it is closer
> to GFS2's existing quota system in terms of features.
>
- SNIP -
does this mean we need to sync a userland release with a kernel one?
If this is the case, then please let?s coordinate the landing of the
changes in STABLE3 release together with the new kernel release with
this new quota code.
Fabio
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] GFS2: A quota of quota patches
2009-09-14 13:11 ` Fabio Massimo Di Nitto
@ 2009-09-14 13:17 ` Steven Whitehouse
0 siblings, 0 replies; 7+ messages in thread
From: Steven Whitehouse @ 2009-09-14 13:17 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
On Mon, 2009-09-14 at 15:11 +0200, Fabio Massimo Di Nitto wrote:
> Steven Whitehouse wrote:
> > This set of patches is a start towards the overall goal of making
> > the GFS2 quota system accessible via a generic interface. In this
> > case I've chosen the XFS style quota interface because it is closer
> > to GFS2's existing quota system in terms of features.
> >
>
> - SNIP -
>
> does this mean we need to sync a userland release with a kernel one?
>
No. There are no required userland changes, and the current quota
interface will be around for a good while yet,
Steve.
> If this is the case, then please let?s coordinate the landing of the
> changes in STABLE3 release together with the new kernel release with
> this new quota code.
>
> Fabio
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] GFS2: A quota of quota patches
@ 2009-09-14 13:51 Steven Whitehouse
2009-09-14 13:11 ` Fabio Massimo Di Nitto
2009-09-14 13:51 ` [Cluster-devel] [PATCH 1/4] GFS2: Alter arguments of gfs2_quota/statfs_sync Steven Whitehouse
0 siblings, 2 replies; 7+ messages in thread
From: Steven Whitehouse @ 2009-09-14 13:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
This set of patches is a start towards the overall goal of making
the GFS2 quota system accessible via a generic interface. In this
case I've chosen the XFS style quota interface because it is closer
to GFS2's existing quota system in terms of features.
This patch set only makes a couple of operations accessible via
this new API. It will now be possible to do a quota sync and also to
query the current state of the quota subsytem via the XFS API. There
are one or two features which GFS2 doesn't support (such as separate quota
files for user and group quotas) which result in the same information
being returned to the user in both cases. I don't think this matters
too much as it should be obvious from the inode number that it is
the same inode.
The long term objective is to make enough of the quota operations
available via this API that we can close the bug (#298561) relating
to lack of quota management for GFS2 via NFS. Also we hope to
add support for netlink notification of quota events too
(bug #337691).
We have no plans to support the "project" feature of XFS quotas.
We might however split the on/off/account settings so that it is
possible to specify them separately for user and group quotas.
My plan is that these pactches should go into the -nmw git tree
early in the next cycle, but in the mean time, here is a "heads
up",
Steve.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH 1/4] GFS2: Alter arguments of gfs2_quota/statfs_sync
2009-09-14 13:51 [Cluster-devel] GFS2: A quota of quota patches Steven Whitehouse
2009-09-14 13:11 ` Fabio Massimo Di Nitto
@ 2009-09-14 13:51 ` Steven Whitehouse
2009-09-14 13:51 ` [Cluster-devel] [PATCH 2/4] GFS2: Hook gfs2_quota_sync into VFS via gfs2_quotactl_ops Steven Whitehouse
1 sibling, 1 reply; 7+ messages in thread
From: Steven Whitehouse @ 2009-09-14 13:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
These two functions are altered so that gfs2_quota_sync may
in future be called directly from the VFS. The GFS2 superblock
changes to a VFS super block and there is an addition of an int
argument which is currently ignored.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
fs/gfs2/quota.c | 7 ++++---
fs/gfs2/quota.h | 2 +-
fs/gfs2/super.c | 7 ++++---
fs/gfs2/super.h | 2 +-
fs/gfs2/sys.c | 4 ++--
5 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 2e9b932..ed9e197 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1069,8 +1069,9 @@ void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
}
}
-int gfs2_quota_sync(struct gfs2_sbd *sdp)
+int gfs2_quota_sync(struct super_block *sb, int type)
{
+ struct gfs2_sbd *sdp = sb->s_fs_info;
struct gfs2_quota_data **qda;
unsigned int max_qd = gfs2_tune_get(sdp, gt_quota_simul_sync);
unsigned int num_qd;
@@ -1298,12 +1299,12 @@ static void quotad_error(struct gfs2_sbd *sdp, const char *msg, int error)
}
static void quotad_check_timeo(struct gfs2_sbd *sdp, const char *msg,
- int (*fxn)(struct gfs2_sbd *sdp),
+ int (*fxn)(struct super_block *sb, int type),
unsigned long t, unsigned long *timeo,
unsigned int *new_timeo)
{
if (t >= *timeo) {
- int error = fxn(sdp);
+ int error = fxn(sdp->sd_vfs, 0);
quotad_error(sdp, msg, error);
*timeo = gfs2_tune_get_i(&sdp->sd_tune, new_timeo) * HZ;
} else {
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index 0fa5fa6..437afa7 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -25,7 +25,7 @@ extern int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid);
extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
u32 uid, u32 gid);
-extern int gfs2_quota_sync(struct gfs2_sbd *sdp);
+extern int gfs2_quota_sync(struct super_block *sb, int type);
extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id);
extern int gfs2_quota_init(struct gfs2_sbd *sdp);
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index f522bb0..47f7373 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -464,8 +464,9 @@ void update_statfs(struct gfs2_sbd *sdp, struct buffer_head *m_bh,
gfs2_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs2_dinode));
}
-int gfs2_statfs_sync(struct gfs2_sbd *sdp)
+int gfs2_statfs_sync(struct super_block *sb, int type)
{
+ struct gfs2_sbd *sdp = sb->s_fs_info;
struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode);
struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
@@ -692,8 +693,8 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
int error;
flush_workqueue(gfs2_delete_workqueue);
- gfs2_quota_sync(sdp);
- gfs2_statfs_sync(sdp);
+ gfs2_quota_sync(sdp->sd_vfs, 0);
+ gfs2_statfs_sync(sdp->sd_vfs, 0);
error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE,
&t_gh);
diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h
index 22e0417..70ed1ad 100644
--- a/fs/gfs2/super.h
+++ b/fs/gfs2/super.h
@@ -44,7 +44,7 @@ extern void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc,
const void *buf);
extern void update_statfs(struct gfs2_sbd *sdp, struct buffer_head *m_bh,
struct buffer_head *l_bh);
-extern int gfs2_statfs_sync(struct gfs2_sbd *sdp);
+extern int gfs2_statfs_sync(struct super_block *sb, int type);
extern int gfs2_freeze_fs(struct gfs2_sbd *sdp);
extern void gfs2_unfreeze_fs(struct gfs2_sbd *sdp);
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index a7cbfbd..898f944 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -157,7 +157,7 @@ static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf,
if (simple_strtol(buf, NULL, 0) != 1)
return -EINVAL;
- gfs2_statfs_sync(sdp);
+ gfs2_statfs_sync(sdp->sd_vfs, 0);
return len;
}
@@ -170,7 +170,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf,
if (simple_strtol(buf, NULL, 0) != 1)
return -EINVAL;
- gfs2_quota_sync(sdp);
+ gfs2_quota_sync(sdp->sd_vfs, 0);
return len;
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH 2/4] GFS2: Hook gfs2_quota_sync into VFS via gfs2_quotactl_ops
2009-09-14 13:51 ` [Cluster-devel] [PATCH 1/4] GFS2: Alter arguments of gfs2_quota/statfs_sync Steven Whitehouse
@ 2009-09-14 13:51 ` Steven Whitehouse
2009-09-14 13:51 ` [Cluster-devel] [PATCH 3/4] GFS2: Remove obsolete code in quota.c Steven Whitehouse
0 siblings, 1 reply; 7+ messages in thread
From: Steven Whitehouse @ 2009-09-14 13:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
The plan is to add further operations to the gfs2_quotactl_ops
in future patches. The sync operation is easy, so we start with
that one.
We plan to use the XFS quota control functions because they more
closely match the GFS2 ones.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
fs/gfs2/Kconfig | 2 ++
fs/gfs2/ops_fstype.c | 3 +++
fs/gfs2/quota.c | 4 ++++
fs/gfs2/quota.h | 1 +
4 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/fs/gfs2/Kconfig b/fs/gfs2/Kconfig
index 5971359..4dcddf8 100644
--- a/fs/gfs2/Kconfig
+++ b/fs/gfs2/Kconfig
@@ -8,6 +8,8 @@ config GFS2_FS
select FS_POSIX_ACL
select CRC32
select SLOW_WORK
+ select QUOTA
+ select QUOTACTL
help
A cluster filesystem.
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 7bc3c45..c22531a 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -18,6 +18,7 @@
#include <linux/mount.h>
#include <linux/gfs2_ondisk.h>
#include <linux/slow-work.h>
+#include <linux/quotaops.h>
#include "gfs2.h"
#include "incore.h"
@@ -1174,6 +1175,8 @@ static int fill_super(struct super_block *sb, void *data, int silent)
sb->s_magic = GFS2_MAGIC;
sb->s_op = &gfs2_super_ops;
sb->s_export_op = &gfs2_export_ops;
+ sb->s_qcop = &gfs2_quotactl_ops;
+ sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
sb->s_time_gran = 1;
sb->s_maxbytes = MAX_LFS_FILESIZE;
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index ed9e197..73a43ce 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1378,3 +1378,7 @@ int gfs2_quotad(void *data)
return 0;
}
+const struct quotactl_ops gfs2_quotactl_ops = {
+ .quota_sync = gfs2_quota_sync,
+};
+
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index 437afa7..025d15b 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -50,5 +50,6 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip)
}
extern int gfs2_shrink_qd_memory(int nr, gfp_t gfp_mask);
+extern const struct quotactl_ops gfs2_quotactl_ops;
#endif /* __QUOTA_DOT_H__ */
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH 3/4] GFS2: Remove obsolete code in quota.c
2009-09-14 13:51 ` [Cluster-devel] [PATCH 2/4] GFS2: Hook gfs2_quota_sync into VFS via gfs2_quotactl_ops Steven Whitehouse
@ 2009-09-14 13:51 ` Steven Whitehouse
2009-09-14 13:51 ` [Cluster-devel] [PATCH 4/4] GFS2: Add get_xstate quota function Steven Whitehouse
0 siblings, 1 reply; 7+ messages in thread
From: Steven Whitehouse @ 2009-09-14 13:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
There is no point in testing for GLF_DEMOTE here, we might as
well always release the glock at that point.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
fs/gfs2/glock.h | 9 ---------
fs/gfs2/quota.c | 13 +++++--------
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index c609894..13f0bd2 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -180,15 +180,6 @@ static inline int gfs2_glock_is_held_shrd(struct gfs2_glock *gl)
return gl->gl_state == LM_ST_SHARED;
}
-static inline int gfs2_glock_is_blocking(struct gfs2_glock *gl)
-{
- int ret;
- spin_lock(&gl->gl_spin);
- ret = test_bit(GLF_DEMOTE, &gl->gl_flags);
- spin_unlock(&gl->gl_spin);
- return ret;
-}
-
int gfs2_glock_get(struct gfs2_sbd *sdp,
u64 number, const struct gfs2_glock_operations *glops,
int create, struct gfs2_glock **glp);
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 73a43ce..6aaa6c5 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -843,9 +843,8 @@ restart:
if (force_refresh || qd->qd_qb.qb_magic != cpu_to_be32(GFS2_MAGIC)) {
loff_t pos;
gfs2_glock_dq_uninit(q_gh);
- error = gfs2_glock_nq_init(qd->qd_gl,
- LM_ST_EXCLUSIVE, GL_NOCACHE,
- q_gh);
+ error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_EXCLUSIVE,
+ GL_NOCACHE, q_gh);
if (error)
return error;
@@ -871,11 +870,9 @@ restart:
qlvb->qb_value = cpu_to_be64(q.qu_value);
qd->qd_qb = *qlvb;
- if (gfs2_glock_is_blocking(qd->qd_gl)) {
- gfs2_glock_dq_uninit(q_gh);
- force_refresh = 0;
- goto restart;
- }
+ gfs2_glock_dq_uninit(q_gh);
+ force_refresh = 0;
+ goto restart;
}
return 0;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Cluster-devel] [PATCH 4/4] GFS2: Add get_xstate quota function
2009-09-14 13:51 ` [Cluster-devel] [PATCH 3/4] GFS2: Remove obsolete code in quota.c Steven Whitehouse
@ 2009-09-14 13:51 ` Steven Whitehouse
0 siblings, 0 replies; 7+ messages in thread
From: Steven Whitehouse @ 2009-09-14 13:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
This allows querying of the quota state via the XFS quota
API.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
fs/gfs2/quota.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 6aaa6c5..e7114be 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -47,6 +47,7 @@
#include <linux/gfs2_ondisk.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
+#include <linux/dqblk_xfs.h>
#include "gfs2.h"
#include "incore.h"
@@ -1375,7 +1376,29 @@ int gfs2_quotad(void *data)
return 0;
}
+static int gfs2_quota_get_xstate(struct super_block *sb,
+ struct fs_quota_stat *fqs)
+{
+ struct gfs2_sbd *sdp = sb->s_fs_info;
+
+ memset(fqs, 0, sizeof(struct fs_quota_stat));
+ fqs->qs_version = FS_QSTAT_VERSION;
+ if (sdp->sd_args.ar_quota == GFS2_QUOTA_ON)
+ fqs->qs_flags = (XFS_QUOTA_UDQ_ENFD | XFS_QUOTA_GDQ_ENFD);
+ else if (sdp->sd_args.ar_quota == GFS2_QUOTA_ACCOUNT)
+ fqs->qs_flags = (XFS_QUOTA_UDQ_ACCT | XFS_QUOTA_GDQ_ACCT);
+ if (sdp->sd_quota_inode) {
+ fqs->qs_uquota.qfs_ino = GFS2_I(sdp->sd_quota_inode)->i_no_addr;
+ fqs->qs_uquota.qfs_nblks = sdp->sd_quota_inode->i_blocks;
+ }
+ fqs->qs_uquota.qfs_nextents = 1; /* unsupported */
+ fqs->qs_gquota = fqs->qs_uquota; /* its the same inode in both cases */
+ fqs->qs_incoredqs = atomic_read(&qd_lru_count);
+ return 0;
+}
+
const struct quotactl_ops gfs2_quotactl_ops = {
.quota_sync = gfs2_quota_sync,
+ .get_xstate = gfs2_quota_get_xstate,
};
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-09-14 13:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-14 13:51 [Cluster-devel] GFS2: A quota of quota patches Steven Whitehouse
2009-09-14 13:11 ` Fabio Massimo Di Nitto
2009-09-14 13:17 ` Steven Whitehouse
2009-09-14 13:51 ` [Cluster-devel] [PATCH 1/4] GFS2: Alter arguments of gfs2_quota/statfs_sync Steven Whitehouse
2009-09-14 13:51 ` [Cluster-devel] [PATCH 2/4] GFS2: Hook gfs2_quota_sync into VFS via gfs2_quotactl_ops Steven Whitehouse
2009-09-14 13:51 ` [Cluster-devel] [PATCH 3/4] GFS2: Remove obsolete code in quota.c Steven Whitehouse
2009-09-14 13:51 ` [Cluster-devel] [PATCH 4/4] GFS2: Add get_xstate quota function Steven Whitehouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).