GFS2 Filesystem [1/16]
[PATCH 01/16] GFS2:
The header files for the core of GFS2.
fs/gfs2/gfs2.h | 60 +++ fs/gfs2/incore.h | 682 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/gfs2_ioctl.h | 17 + include/linux/gfs2_ondisk.h | 454 +++++++++++++++++++++++++++++ 4 files changed, 1213 insertions(+)
fs/gfs2/gfs2.h new file +60 -0
@@ -0,0 +1,60 @@ +/* +* 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 "lm_interface.h" +#include "lvb.h" +#include "incore.h" +#include "util.h" + +enum { +NO_CREATE =0 , +CREATE =1 , +}; + +enum { +NO_WAIT =0 , +WAIT =1 , +}; + +enum { +NO_FORCE =0 , +FORCE =1 , +}; + +/* Divide num by den. Round up if there is a remainder. */ +#define DIV_RU (num, den) (((num) + (den) - 1) / (den)) + +#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_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__ */ +
fs/gfs2/incore.h new file +682 -0
682 lines not on this page · raw message
include/linux/gfs2_ioctl.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* 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_IOCTL_DOT_H__ +#define __GFS2_IOCTL_DOT_H__ + +#define GFS2_IOCTL_SETFLAGS _IOW('g', 3, long) +#define GFS2_IOCTL_GETFLAGS _IOR('g', 4, long) + +#endif /* ___GFS2_IOCTL_DOT_H__ */ +
include/linux/gfs2_ondisk.h new file +454 -0
454 lines not on this page · raw message
fs/gfs2/gfs2.h line 36
Quoted 2 lines · Steven Whitehouse
fs/gfs2/gfs2.h new file +2
-0+/* Divide num by den. Round up if there is a remainder. */ +#define DIV_RU (num, den) (((num) + (den) - 1) / (den))
Seems generally useful. Consider putting this to <linux/kernel.h> and giving it a better name e.g. DIV_ROUND_UP.
Quoted 8 lines
fs/gfs2/gfs2.h new file +8
-0+#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)
fs/gfs2/gfs2.h line 57
Quoted 10 lines
fs/gfs2/gfs2.h new file +10
-0+ +#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)
Consider dropping these macros. Please note redundant casting.
include/linux/gfs2_ondisk.h line 55
Quoted 3 lines
include/linux/gfs2_ondisk.h new file +3
-0+#define gfs2_inum_equal (ino1, ino2) \ + (((ino1)->no_formal_ino == (ino2)->no_formal_ino) && \ + ((ino1)->no_addr == (ino2)->no_addr))
Consider using static inline function instead.
include/linux/gfs2_ondisk.h line 195
Quoted 2 lines
include/linux/gfs2_ondisk.h new file +2
-0+#define DT2IF (dt) (((dt) << 12) & S_IFMT) +#define IF2DT (sif) (((sif) & S_IFMT) >> 12)
Ditto.
Pekka
Hi,
Thanks for the feedback and now added to out todo list along with your earlier comments,
Steve.
Quoted 40 lines · Pekka Enberg
fs/gfs2/gfs2.h line 36
Quoted 2 lines · Steven Whitehouse
fs/gfs2/gfs2.h new file +2
-0+/* Divide num by den. Round up if there is a remainder. */ +#define DIV_RU (num, den) (((num) + (den) - 1) / (den))Seems generally useful. Consider putting this to <
linux/kernel.h> and giving it a better name e.g.DIV_ROUND_UP.Quoted 8 lines
fs/gfs2/gfs2.h new file +8
-0+#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)fs/gfs2/gfs2.h line 57
Quoted 10 lines
fs/gfs2/gfs2.h new file +10
-0+ +#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)Consider dropping these macros. Please note redundant casting.
include/linux/gfs2_ondisk.h line 55
Quoted 3 lines
include/linux/gfs2_ondisk.h new file +3
-0+#define gfs2_inum_equal (ino1, ino2) \ + (((ino1)->no_formal_ino == (ino2)->no_formal_ino) && \ + ((ino1)->no_addr == (ino2)->no_addr))Consider using static inline function instead.
include/linux/gfs2_ondisk.h line 195
Quoted 2 lines
include/linux/gfs2_ondisk.h new file +2
-0+#define DT2IF (dt) (((dt) << 12) & S_IFMT) +#define IF2DT (sif) (((sif) & S_IFMT) >> 12)Ditto.
Pekka