Re: [PATCH 01/14] GFS: headers

2005-09-01 Thread Jörn Engel
On Thu, 1 September 2005 22:59:48 +0800, David Teigland wrote:
> 
> We offered to removed this when I explained it before.  It sounds like it
> would give you some comfort so I'll just go ahead and do it barring any
> pleas otherwise.

Please do.  Just have one test machine with an endianness different
from the on-disk format.

Having the on-disk format always be big-endian would serve this
purpose quite well, btw.  But buying an (before-intel) apple machine
also would.

Jörn

-- 
More computing sins are committed in the name of efficiency (without
necessarily achieving it) than for any other single reason - including
blind stupidity.
-- W. A. Wulf 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/14] GFS: headers

2005-09-01 Thread David Teigland
On Thu, Sep 01, 2005 at 04:19:34PM +0200, Arjan van de Ven wrote:

> > +/* Endian functions */
> 
> e again why?? 
> Why is this a compiletime hack?
> Either you care about either-endian on disk, at which point it has to be
> a runtime thing, or you make the on disk layout fixed endian, at which
> point you really shouldn't abstract be16_to_cpu etc any further!

Again, on-disk is fixed little endian, so we have for example:

#define gfs2_32_to_cpu le32_to_cpu
#define cpu_to_gfs2_32 cpu_to_le32

To _test_ and _verify_ the endian-handling of the code we can
#define GFS2_ENDIAN_BIG which switches the above to:

#define gfs2_32_to_cpu to be32_to_cpu
#define cpu_to_gfs2_32 to cpu_to_be32

We offered to removed this when I explained it before.  It sounds like it
would give you some comfort so I'll just go ahead and do it barring any
pleas otherwise.

Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/14] GFS: headers

2005-09-01 Thread viro
On Thu, Sep 01, 2005 at 04:19:34PM +0200, Arjan van de Ven wrote:
> > +/* Endian functions */
> 
> e again why?? 
> Why is this a compiletime hack?
> Either you care about either-endian on disk, at which point it has to be
> a runtime thing, or you make the on disk layout fixed endian, at which
> point you really shouldn't abstract be16_to_cpu etc any further!

Well...  I would disagree with the very end of it (e.g. having on-disk
block number representation declared as __bitwise, so that it wouldn't be
mixed with __be + having coversion helpers consisting of
static inline u32 foo_to_cpu(foo n)
{
return be32_to_cpu((__force __be32)n);
}
etc. may be valid technics, assuming that these objects were passed around
enough to deserve it.

Blanket "let's rename for the sake of renaming" is a BS, of course...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/14] GFS: headers

2005-09-01 Thread Arjan van de Ven

> +#ifndef TRUE
> +#define TRUE 1
> +#endif
> +
> +#ifndef FALSE
> +#define FALSE 0
> +#endif

eh why can't you just use the regular kernel conventions


> +
> +#define NO_CREATE 0
> +#define CREATE 1
> +
> +#define NO_WAIT 0
> +#define WAIT 1
> +
> +#define NO_FORCE 0
> +#define FORCE 1

these deserve enums


> +
> +/* Actions */
> +#define HIF_MUTEX0
> +#define HIF_PROMOTE  1
> +#define HIF_DEMOTE   2
> +#define HIF_GREEDY   3
> +
> +/* States */
> +#define HIF_ALLOCED  4
> +#define HIF_DEALLOC  5
> +#define HIF_HOLDER   6
> +#define HIF_FIRST7
> +#define HIF_RECURSE  8
> +#define HIF_ABORTED  9

enum?


> +#define _GFS2C_(x)   (('G' << 16) | ('2' << 8) | (x))
> +
> +/* Ioctls implemented */
> +
> +#define GFS2_IOCTL_IDENTIFY  _GFS2C_(1)
> +#define GFS2_IOCTL_SUPER _GFS2C_(2)

have you registered these in ioctl.txt?


> +
> +struct gfs2_ioctl {
> + unsigned int gi_argc;
> + char **gi_argv;
> +
> +char __user *gi_data;
> + unsigned int gi_size;
> + uint64_t gi_offset;
> +};

what is this for??

> +/* Endian functions */

e again why?? 
Why is this a compiletime hack?
Either you care about either-endian on disk, at which point it has to be
a runtime thing, or you make the on disk layout fixed endian, at which
point you really shouldn't abstract be16_to_cpu etc any further!




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/14] GFS: headers

2005-09-01 Thread David Teigland
Central header files that are widely used.

Signed-off-by: Ken Preslan <[EMAIL PROTECTED]>
Signed-off-by: David Teigland <[EMAIL PROTECTED]>

---

 fs/gfs2/gfs2.h  |   77 +++
 fs/gfs2/incore.h|  691 +++
 include/linux/gfs2_ioctl.h  |   30 +
 include/linux/gfs2_ondisk.h | 1119 
 4 files changed, 1917 insertions(+)

--- a/fs/gfs2/gfs2.h1970-01-01 07:30:00.0 +0730
+++ b/fs/gfs2/gfs2.h2005-09-01 17:36:55.202132648 +0800
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2005 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__
+
+#include 
+
+#include "locking/harness/lm_interface.h"
+#include "lvb.h"
+#include "incore.h"
+#include "util.h"
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#define NO_CREATE 0
+#define CREATE 1
+
+#define NO_WAIT 0
+#define WAIT 1
+
+#define NO_FORCE 0
+#define FORCE 1
+
+#if (BITS_PER_LONG == 64)
+#define PRIu64 "lu"
+#define PRId64 "ld"
+#define PRIx64 "lx"
+#define PRIX64 "lX"
+#else
+#define PRIu64 "Lu"
+#define PRId64 "Ld"
+#define PRIx64 "Lx"
+#define PRIX64 "LX"
+#endif
+
+/*  Divide num by den.  Round up if there is a remainder.  */
+#define DIV_RU(num, den) (((num) + (den) - 1) / (den))
+#define MAKE_MULT8(x) (((x) + 7) & ~7)
+
+#define GFS2_FAST_NAME_SIZE 8
+
+#define get_v2sdp(sb) ((struct gfs2_sbd *)(sb)->s_fs_info)
+#define set_v2sdp(sb, sdp) (sb)->s_fs_info = (sdp)
+#define get_v2ip(inode) ((struct gfs2_inode *)(inode)->u.generic_ip)
+#define set_v2ip(inode, ip) (inode)->u.generic_ip = (ip)
+#define get_v2fp(file) ((struct gfs2_file *)(file)->private_data)
+#define set_v2fp(file, fp) (file)->private_data = (fp)
+#define get_v2bd(bh) ((struct gfs2_bufdata *)(bh)->b_private)
+#define set_v2bd(bh, bd) (bh)->b_private = (bd)
+#define get_v2db(bh) ((struct gfs2_databuf *)(bh)->b_private)
+#define set_v2db(bh, db) (bh)->b_private = (db)
+
+#define get_transaction ((struct gfs2_trans *)(current->journal_info))
+#define set_transaction(tr) (current->journal_info) = (tr)
+
+#define get_gl2ip(gl) ((struct gfs2_inode *)(gl)->gl_object)
+#define set_gl2ip(gl, ip) (gl)->gl_object = (ip)
+#define get_gl2rgd(gl) ((struct gfs2_rgrpd *)(gl)->gl_object)
+#define set_gl2rgd(gl, rgd) (gl)->gl_object = (rgd)
+#define get_gl2gl(gl) ((struct gfs2_glock *)(gl)->gl_object)
+#define set_gl2gl(gl, gl2) (gl)->gl_object = (gl2)
+
+#endif /* __GFS2_DOT_H__ */
+
--- a/fs/gfs2/incore.h  1970-01-01 07:30:00.0 +0730
+++ b/fs/gfs2/incore.h  2005-09-01 17:36:55.283120336 +0800
@@ -0,0 +1,691 @@
+/*
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2005 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 __INCORE_DOT_H__
+#define __INCORE_DOT_H__
+
+#define DIO_FORCE  0x0001
+#define DIO_CLEAN  0x0002
+#define DIO_DIRTY  0x0004
+#define DIO_START  0x0008
+#define DIO_WAIT   0x0010
+#define DIO_METADATA   0x0020
+#define DIO_DATA   0x0040
+#define DIO_RELEASE0x0080
+#define DIO_ALL0x0100
+
+struct gfs2_log_operations;
+struct gfs2_log_element;
+struct gfs2_bitmap;
+struct gfs2_rgrpd;
+struct gfs2_bufdata;
+struct gfs2_databuf;
+struct gfs2_glock_operations;
+struct gfs2_holder;
+struct gfs2_glock;
+struct gfs2_alloc;
+struct gfs2_inode;
+struct gfs2_file;
+struct gfs2_revoke;
+struct gfs2_revoke_replay;
+struct gfs2_unlinked;
+struct gfs2_quota_data;
+struct gfs2_log_buf;
+struct gfs2_trans;
+struct gfs2_ail;
+struct gfs2_jdesc;
+struct gfs2_args;
+struct gfs2_tune;
+struct gfs2_gl_hash_bucket;
+struct gfs2_sbd;
+
+typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret);
+
+/*
+ * Structure of operations that are associated with each
+ * type of element in the log.
+ */
+
+struct gfs2_log_operations {
+   void (*lo_add) (struct gfs2_sbd *sdp, struct gfs2_log_element *le);
+   void (*lo_incore_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
+   void (*lo_before_commit) (struct gfs2_sbd *sdp);
+   void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_ail *ai);
+   void (*lo_before_scan) (struct gfs2_jdesc *jd,
+   struct gfs2_log_header *head, int pass);
+   int (*lo_scan_elements) (struct gfs2_jdesc *jd, unsigned int start,
+struct gfs2_log_descriptor *ld, int pass);
+   void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int 

[PATCH 01/14] GFS: headers

2005-09-01 Thread David Teigland
Central header files that are widely used.

Signed-off-by: Ken Preslan [EMAIL PROTECTED]
Signed-off-by: David Teigland [EMAIL PROTECTED]

---

 fs/gfs2/gfs2.h  |   77 +++
 fs/gfs2/incore.h|  691 +++
 include/linux/gfs2_ioctl.h  |   30 +
 include/linux/gfs2_ondisk.h | 1119 
 4 files changed, 1917 insertions(+)

--- a/fs/gfs2/gfs2.h1970-01-01 07:30:00.0 +0730
+++ b/fs/gfs2/gfs2.h2005-09-01 17:36:55.202132648 +0800
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2005 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__
+
+#include linux/gfs2_ondisk.h
+
+#include locking/harness/lm_interface.h
+#include lvb.h
+#include incore.h
+#include util.h
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#define NO_CREATE 0
+#define CREATE 1
+
+#define NO_WAIT 0
+#define WAIT 1
+
+#define NO_FORCE 0
+#define FORCE 1
+
+#if (BITS_PER_LONG == 64)
+#define PRIu64 lu
+#define PRId64 ld
+#define PRIx64 lx
+#define PRIX64 lX
+#else
+#define PRIu64 Lu
+#define PRId64 Ld
+#define PRIx64 Lx
+#define PRIX64 LX
+#endif
+
+/*  Divide num by den.  Round up if there is a remainder.  */
+#define DIV_RU(num, den) (((num) + (den) - 1) / (den))
+#define MAKE_MULT8(x) (((x) + 7)  ~7)
+
+#define GFS2_FAST_NAME_SIZE 8
+
+#define get_v2sdp(sb) ((struct gfs2_sbd *)(sb)-s_fs_info)
+#define set_v2sdp(sb, sdp) (sb)-s_fs_info = (sdp)
+#define get_v2ip(inode) ((struct gfs2_inode *)(inode)-u.generic_ip)
+#define set_v2ip(inode, ip) (inode)-u.generic_ip = (ip)
+#define get_v2fp(file) ((struct gfs2_file *)(file)-private_data)
+#define set_v2fp(file, fp) (file)-private_data = (fp)
+#define get_v2bd(bh) ((struct gfs2_bufdata *)(bh)-b_private)
+#define set_v2bd(bh, bd) (bh)-b_private = (bd)
+#define get_v2db(bh) ((struct gfs2_databuf *)(bh)-b_private)
+#define set_v2db(bh, db) (bh)-b_private = (db)
+
+#define get_transaction ((struct gfs2_trans *)(current-journal_info))
+#define set_transaction(tr) (current-journal_info) = (tr)
+
+#define get_gl2ip(gl) ((struct gfs2_inode *)(gl)-gl_object)
+#define set_gl2ip(gl, ip) (gl)-gl_object = (ip)
+#define get_gl2rgd(gl) ((struct gfs2_rgrpd *)(gl)-gl_object)
+#define set_gl2rgd(gl, rgd) (gl)-gl_object = (rgd)
+#define get_gl2gl(gl) ((struct gfs2_glock *)(gl)-gl_object)
+#define set_gl2gl(gl, gl2) (gl)-gl_object = (gl2)
+
+#endif /* __GFS2_DOT_H__ */
+
--- a/fs/gfs2/incore.h  1970-01-01 07:30:00.0 +0730
+++ b/fs/gfs2/incore.h  2005-09-01 17:36:55.283120336 +0800
@@ -0,0 +1,691 @@
+/*
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2005 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 __INCORE_DOT_H__
+#define __INCORE_DOT_H__
+
+#define DIO_FORCE  0x0001
+#define DIO_CLEAN  0x0002
+#define DIO_DIRTY  0x0004
+#define DIO_START  0x0008
+#define DIO_WAIT   0x0010
+#define DIO_METADATA   0x0020
+#define DIO_DATA   0x0040
+#define DIO_RELEASE0x0080
+#define DIO_ALL0x0100
+
+struct gfs2_log_operations;
+struct gfs2_log_element;
+struct gfs2_bitmap;
+struct gfs2_rgrpd;
+struct gfs2_bufdata;
+struct gfs2_databuf;
+struct gfs2_glock_operations;
+struct gfs2_holder;
+struct gfs2_glock;
+struct gfs2_alloc;
+struct gfs2_inode;
+struct gfs2_file;
+struct gfs2_revoke;
+struct gfs2_revoke_replay;
+struct gfs2_unlinked;
+struct gfs2_quota_data;
+struct gfs2_log_buf;
+struct gfs2_trans;
+struct gfs2_ail;
+struct gfs2_jdesc;
+struct gfs2_args;
+struct gfs2_tune;
+struct gfs2_gl_hash_bucket;
+struct gfs2_sbd;
+
+typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret);
+
+/*
+ * Structure of operations that are associated with each
+ * type of element in the log.
+ */
+
+struct gfs2_log_operations {
+   void (*lo_add) (struct gfs2_sbd *sdp, struct gfs2_log_element *le);
+   void (*lo_incore_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
+   void (*lo_before_commit) (struct gfs2_sbd *sdp);
+   void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_ail *ai);
+   void (*lo_before_scan) (struct gfs2_jdesc *jd,
+   struct gfs2_log_header *head, int pass);
+   int (*lo_scan_elements) (struct gfs2_jdesc *jd, unsigned int start,
+struct gfs2_log_descriptor *ld, int pass);
+   void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass);
+   char *lo_name;

Re: [PATCH 01/14] GFS: headers

2005-09-01 Thread Arjan van de Ven

 +#ifndef TRUE
 +#define TRUE 1
 +#endif
 +
 +#ifndef FALSE
 +#define FALSE 0
 +#endif

eh why can't you just use the regular kernel conventions


 +
 +#define NO_CREATE 0
 +#define CREATE 1
 +
 +#define NO_WAIT 0
 +#define WAIT 1
 +
 +#define NO_FORCE 0
 +#define FORCE 1

these deserve enums


 +
 +/* Actions */
 +#define HIF_MUTEX0
 +#define HIF_PROMOTE  1
 +#define HIF_DEMOTE   2
 +#define HIF_GREEDY   3
 +
 +/* States */
 +#define HIF_ALLOCED  4
 +#define HIF_DEALLOC  5
 +#define HIF_HOLDER   6
 +#define HIF_FIRST7
 +#define HIF_RECURSE  8
 +#define HIF_ABORTED  9

enum?


 +#define _GFS2C_(x)   (('G'  16) | ('2'  8) | (x))
 +
 +/* Ioctls implemented */
 +
 +#define GFS2_IOCTL_IDENTIFY  _GFS2C_(1)
 +#define GFS2_IOCTL_SUPER _GFS2C_(2)

have you registered these in ioctl.txt?


 +
 +struct gfs2_ioctl {
 + unsigned int gi_argc;
 + char **gi_argv;
 +
 +char __user *gi_data;
 + unsigned int gi_size;
 + uint64_t gi_offset;
 +};

what is this for??

 +/* Endian functions */

e again why?? 
Why is this a compiletime hack?
Either you care about either-endian on disk, at which point it has to be
a runtime thing, or you make the on disk layout fixed endian, at which
point you really shouldn't abstract be16_to_cpu etc any further!




-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/14] GFS: headers

2005-09-01 Thread viro
On Thu, Sep 01, 2005 at 04:19:34PM +0200, Arjan van de Ven wrote:
  +/* Endian functions */
 
 e again why?? 
 Why is this a compiletime hack?
 Either you care about either-endian on disk, at which point it has to be
 a runtime thing, or you make the on disk layout fixed endian, at which
 point you really shouldn't abstract be16_to_cpu etc any further!

Well...  I would disagree with the very end of it (e.g. having on-disk
block number representation declared as __bitwise, so that it wouldn't be
mixed with __ben + having coversion helpers consisting of
static inline u32 foo_to_cpu(foo n)
{
return be32_to_cpu((__force __be32)n);
}
etc. may be valid technics, assuming that these objects were passed around
enough to deserve it.

Blanket let's rename for the sake of renaming is a BS, of course...
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/14] GFS: headers

2005-09-01 Thread David Teigland
On Thu, Sep 01, 2005 at 04:19:34PM +0200, Arjan van de Ven wrote:

  +/* Endian functions */
 
 e again why?? 
 Why is this a compiletime hack?
 Either you care about either-endian on disk, at which point it has to be
 a runtime thing, or you make the on disk layout fixed endian, at which
 point you really shouldn't abstract be16_to_cpu etc any further!

Again, on-disk is fixed little endian, so we have for example:

#define gfs2_32_to_cpu le32_to_cpu
#define cpu_to_gfs2_32 cpu_to_le32

To _test_ and _verify_ the endian-handling of the code we can
#define GFS2_ENDIAN_BIG which switches the above to:

#define gfs2_32_to_cpu to be32_to_cpu
#define cpu_to_gfs2_32 to cpu_to_be32

We offered to removed this when I explained it before.  It sounds like it
would give you some comfort so I'll just go ahead and do it barring any
pleas otherwise.

Dave

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/14] GFS: headers

2005-09-01 Thread Jörn Engel
On Thu, 1 September 2005 22:59:48 +0800, David Teigland wrote:
 
 We offered to removed this when I explained it before.  It sounds like it
 would give you some comfort so I'll just go ahead and do it barring any
 pleas otherwise.

Please do.  Just have one test machine with an endianness different
from the on-disk format.

Having the on-disk format always be big-endian would serve this
purpose quite well, btw.  But buying an (before-intel) apple machine
also would.

Jörn

-- 
More computing sins are committed in the name of efficiency (without
necessarily achieving it) than for any other single reason - including
blind stupidity.
-- W. A. Wulf 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/