From: rpeterso@sourceware.org <rpeterso@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs/libgfs libgfs.h super.c
Date: 14 Jul 2006 19:25:09 -0000 [thread overview]
Message-ID: <20060714192509.8166.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-07-14 19:25:08
Modified files:
gfs/libgfs : libgfs.h super.c
Log message:
Split read_sb into read_sb and compute_constants like libgfs2.
That enables programs that do not read the superblock (like mkfs)
to get the constants they need.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/libgfs/libgfs.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/libgfs/super.c.diff?cvsroot=cluster&r1=1.1&r2=1.2
--- cluster/gfs/libgfs/libgfs.h 2006/07/10 23:28:11 1.2
+++ cluster/gfs/libgfs/libgfs.h 2006/07/14 19:25:08 1.3
@@ -386,6 +386,7 @@
int write_sb(int disk_fd, struct gfs_sbd *sdp);
int set_block_ranges(int disk_fd, struct gfs_sbd *sdp);
int read_super_block(int disk_fd, struct gfs_sbd *sdp);
+int compute_constants(struct gfs_sbd *sdp);
/* ------------------------------------------------------------------------- */
/* formerly rgrp.h: */
--- cluster/gfs/libgfs/super.c 2006/05/15 18:56:07 1.1
+++ cluster/gfs/libgfs/super.c 2006/07/14 19:25:08 1.2
@@ -73,40 +73,19 @@
return error;
}
-
/*
- * read_sb: read the super block from disk
- * sdp: in-core super block
- *
- * This function reads in the super block from disk and
- * initializes various constants maintained in the super
- * block
+ * compute_constants: compute constants for the superblock
*
- * Returns: 0 on success, -1 on failure.
+ * assumes:
+ * sb_bsize_shift is set either from the ondisk superblock or otherwise.
+ * sb_bsize is set either from the ondisk superblock or otherwise.
*/
-int read_sb(int disk_fd, struct gfs_sbd *sdp)
+int compute_constants(struct gfs_sbd *sdp)
{
- osi_buf_t *bh;
- uint64 space = 0;
unsigned int x;
- int error;
- error = get_and_read_buf(disk_fd, 512, /* assume 512 block size at first */
- GFS_SB_ADDR >> sdp->sd_fsb2bb_shift, &bh, 0);
- if (error){
- log_crit("Unable to read superblock\n");
- goto out;
- }
-
- gfs_sb_in(&sdp->sd_sb, BH_DATA(bh));
-
- relse_buf(bh);
-
- error = check_sb(sdp, &sdp->sd_sb);
- if (error)
- goto out;
+ uint64 space = 0;
+ int error = 0;
-/* FIXME: Need to verify all this */
- /* FIXME: What's this 9? */
sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - 9;
sdp->sd_diptrs =
(sdp->sd_sb.sb_bsize-sizeof(struct gfs_dinode)) /
@@ -115,7 +94,6 @@
(sdp->sd_sb.sb_bsize-sizeof(struct gfs_indirect)) /
sizeof(uint64);
sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs_meta_header);
- /* FIXME: Why is this /2 */
sdp->sd_hash_bsize = sdp->sd_sb.sb_bsize / 2;
sdp->sd_hash_ptrs = sdp->sd_hash_bsize / sizeof(uint64);
sdp->sd_heightsize[0] = sdp->sd_sb.sb_bsize -
@@ -133,7 +111,7 @@
if(sdp->sd_max_height > GFS_MAX_META_HEIGHT){
log_err("Bad max metadata height.\n");
error = -1;
- goto out;
+ return error;
}
sdp->sd_jheightsize[0] = sdp->sd_sb.sb_bsize -
@@ -151,6 +129,39 @@
log_err("Bad max jheight.\n");
error = -1;
}
+ return error;
+}
+
+/*
+ * read_sb: read the super block from disk
+ * sdp: in-core super block
+ *
+ * This function reads in the super block from disk and
+ * initializes various constants maintained in the super
+ * block
+ *
+ * Returns: 0 on success, -1 on failure.
+ */
+int read_sb(int disk_fd, struct gfs_sbd *sdp)
+{
+ osi_buf_t *bh;
+ int error;
+ error = get_and_read_buf(disk_fd, 512, /* assume 512 block size at first */
+ GFS_SB_ADDR >> sdp->sd_fsb2bb_shift, &bh, 0);
+ if (error){
+ log_crit("Unable to read superblock\n");
+ goto out;
+ }
+
+ gfs_sb_in(&sdp->sd_sb, BH_DATA(bh));
+
+ relse_buf(bh);
+
+ error = check_sb(sdp, &sdp->sd_sb);
+ if (error)
+ goto out;
+
+ compute_constants(sdp);
out:
reply other threads:[~2006-07-14 19:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060714192509.8166.qmail@sourceware.org \
--to=rpeterso@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.