Skip to contentSkip to conversation

GFS2: Core header files

PATCH In review Steven Whitehouse 2 participants 6 messages Aug 31, 2006 – Sep 1, 2006 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/16 GFS2: Core header files

[PATCH 01/16] GFS2: Core header files

The header files for the core of GFS2.

 fs/gfs2/gfs2.h              |   31 ++
 fs/gfs2/incore.h            |  659 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/gfs2_ondisk.h |  443 +++++++++++++++++++++++++++++
 3 files changed, 1133 insertions(+)
fs/gfs2/gfs2.h new file +31 -0
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */
+
+#ifndef __GFS2_DOT_H__
+#define __GFS2_DOT_H__
+
+enum {
+	NO_CREATE = 0,
+	CREATE = 1,
+};
+
+enum {
+	NO_WAIT = 0,
+	WAIT = 1,
+};
+
+enum {
+	NO_FORCE = 0,
+	FORCE = 1,
+};
+
+#define GFS2_FAST_NAME_SIZE 8
+
+#endif /* __GFS2_DOT_H__ */
+
fs/gfs2/incore.h new file +659 -0

659 lines not on this page · raw message

include/linux/gfs2_ondisk.h new file +443 -0

443 lines not on this page · raw message

#1 lore raw
Quoted 5 lines

+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */

"v2" perhaps? From a math pov, the extra dot implies v0.2.

Quoted 1 line

+struct gfs2_log_operations;

I would suggest listing only struct lines that are actually required, i.e. the compiler would barf without them.

fs/gfs2/incore.h line 141

Quoted 6 lines
fs/gfs2/incore.h new file +6 -0
+enum {
+	/* Actions */
+	HIF_MUTEX		= 0,
+	HIF_PROMOTE		= 1,
+	HIF_DEMOTE		= 2,
+	HIF_GREEDY		= 3,

I leave it to you whether going with the above or

enum {
HIF_MUTEX = 0,
HIF_PROMOTE,
HIF_DEMOTE,
HIF_GREEDY,
...
};

If these values need to stay the same, for example to maintain on-disk compatibility, I prefer the former, though.

fs/gfs2/incore.h line 218

Quoted 3 lines
fs/gfs2/incore.h new file +3 -0
+	/* Quota stuff */
+
+	struct gfs2_quota_data *al_qd[4];

What four quotas can there be? Use the MAXQUOTAS macro if feasible.

fs/gfs2/incore.h line 313

Quoted 7 lines
fs/gfs2/incore.h new file +7 -0
+struct gfs2_quota_lvb {
+        uint32_t qb_magic;
+        uint32_t __pad;
+        uint64_t qb_limit;      /* Hard limit of # blocks to alloc */
+        uint64_t qb_warn;       /* Warn user when alloc is above this # */
+        int64_t qb_value;       /* Current # blocks allocated */
+};

Is this an on-disk structure or why is there a __pad field?

Jan Engelhardt

#2 lore raw

Hi,

Thanks for the comments...

Quoted 8 lines · Jan Engelhardt
Quoted 5 lines

+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */

"v2" perhaps? From a math pov, the extra dot implies v0.2.

or you could argue that the addition of a space (i.e. v. 2) would be correct since its an abbreviation, but point taken and I'll clean it up shortly.

Quoted 5 lines
Quoted 1 line

+struct gfs2_log_operations;

I would suggest listing only struct lines that are actually required, i.e. the compiler would barf without them.

Ok. I'll take a look and see which of them are not required.

Quoted 17 lines

fs/gfs2/incore.h line 141

Quoted 6 lines
fs/gfs2/incore.h new file +6 -0
+enum {
+	/* Actions */
+	HIF_MUTEX		= 0,
+	HIF_PROMOTE		= 1,
+	HIF_DEMOTE		= 2,
+	HIF_GREEDY		= 3,

I leave it to you whether going with the above or

enum {
   HIF_MUTEX = 0,
   HIF_PROMOTE,
   HIF_DEMOTE,
   HIF_GREEDY,
   ...
};
Quoted 3 lines

If these values need to stay the same, for example to maintain on-disk compatibility, I prefer the former, though.

They are not on-disk visible (they'd in in gfs2_ondisk.h otherwise) but we may well want to change them as I think it should be possible to merge the gh_flags and gh_iflags fields in the struct gfs2_holder to save a bit of space.

Quoted 6 lines

fs/gfs2/incore.h line 218

Quoted 3 lines
fs/gfs2/incore.h new file +3 -0
+	/* Quota stuff */
+
+	struct gfs2_quota_data *al_qd[4];

What four quotas can there be? Use the MAXQUOTAS macro if feasible.

Its related to the way the GFS2's fuzzy quota system works. In order to avoid contention on a global quota structure, each node has its own which is synced back to the master one from time to time. This is done according to user specified constants and more frequently in the case of users nearing their quota. In the default case this means that no user can exceed their quota by more than twice, in practice a user would have to work very hard to manage even that.

As a result there are the overall user/group limits and the local differences which are saved to by synced back to the master quota information, hence four of them.

Quoted 12 lines

fs/gfs2/incore.h line 313

Quoted 7 lines
fs/gfs2/incore.h new file +7 -0
+struct gfs2_quota_lvb {
+        uint32_t qb_magic;
+        uint32_t __pad;
+        uint64_t qb_limit;      /* Hard limit of # blocks to alloc */
+        uint64_t qb_warn;       /* Warn user when alloc is above this # */
+        int64_t qb_value;       /* Current # blocks allocated */
+};

Is this an on-disk structure or why is there a __pad field?

Quoted 1 line

Jan Engelhardt

It isn't an on-disk structure, on the other hand we treat it as one. It probably ought to be changed to use __be types. Its the structure which the quota code keeps in the lock value block of DLM locks, so it is directly shared between nodes, hence the need to treat it the same as the on-disk structures in terms of making any changes to it, and keeping it aligned, and of defined byte order etc,

Steve.

#3 lore raw
Quoted 4 lines
Quoted 1 line

or you could argue that the addition of a space (i.e. v. 2) would be correct since its an abbreviation, but point taken and I'll clean it up shortly.

Or spell it out, as in many GPL headers.

Quoted 10 lines
Quoted 6 lines

fs/gfs2/incore.h line 218

Quoted 3 lines
fs/gfs2/incore.h new file +3 -0
+	/* Quota stuff */
+
+	struct gfs2_quota_data *al_qd[4];

What four quotas can there be? Use the MAXQUOTAS macro if feasible.

[...]
As a result there are the overall user/group limits and the local differences which are saved to by synced back to the master quota information, hence four of them.

Well, al_qd[2*MAXQUOTAS] then.

Jan Engelhardt

#4 lore raw

Hi,

Quoted 7 lines · Jan Engelhardt
Quoted 4 lines
Quoted 1 line

or you could argue that the addition of a space (i.e. v. 2) would be correct since its an abbreviation, but point taken and I'll clean it up shortly.

Or spell it out, as in many GPL headers.

Yes, thats my chosen solution for now.
I hope this:

http://www.kernel.org/git/?p=linux/kernel/git/steve/gfs2-2.6.git;a=commitdiff;h=e9fc2aa091ab8fa46e60d4c9d06a89305c441652

addresses the issues you raised in your first email. I'm working on a patch to deal with the second set of issues you raised at the moment,

Steve.

#5 lore raw
Quoted 5 lines

http://www.kernel.org/git/?p=linux/kernel/git/steve/gfs2-2.6.git;a=commitdiff;h=e9fc2aa091ab8fa46e60d4c9d06a89305c441652

addresses the issues you raised in your first email. I'm working on a patch to deal with the second set of issues you raised at the moment,

Yes that looks good. The 'uint32_t __pad' -> 'u32 __pad' change I will address in the next mail I am currently composing.

(And if I may add: I would have split that commit into three commits - one for each paragraph you wrote in the changelog :-)

Hm copy and paste from Firefox to xterm removes all the indenting. opening the url with w3m already has all indent removed too. What's wrong with the gitweb today? :-(

Jan Engelhardt