mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: linux-kernel@vger.kernel.org, cluster-devel@redhat.com
Cc: Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 29/32] GFS2: Use UUID field in generic superblock
Date: Thu, 19 May 2011 09:47:24 +0100	[thread overview]
Message-ID: <1305794847-3291-30-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1305794847-3291-1-git-send-email-swhiteho@redhat.com>

The VFS superblock structure now has a UUID field, so we can use that
in preference to the UUID field in the GFS2 superblock now.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 69a6382..0a064e9 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -488,7 +488,6 @@ struct gfs2_sb_host {
 
 	char sb_lockproto[GFS2_LOCKNAME_LEN];
 	char sb_locktable[GFS2_LOCKNAME_LEN];
-	u8 sb_uuid[16];
 };
 
 /*
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index d3c69eb..8ac9ae1 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -126,8 +126,10 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
  * changed.
  */
 
-static int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent)
+static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
 {
+	struct gfs2_sb_host *sb = &sdp->sd_sb;
+
 	if (sb->sb_magic != GFS2_MAGIC ||
 	    sb->sb_type != GFS2_METATYPE_SB) {
 		if (!silent)
@@ -157,8 +159,10 @@ static void end_bio_io_page(struct bio *bio, int error)
 	unlock_page(page);
 }
 
-static void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf)
+static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
 {
+	struct gfs2_sb_host *sb = &sdp->sd_sb;
+	struct super_block *s = sdp->sd_vfs;
 	const struct gfs2_sb *str = buf;
 
 	sb->sb_magic = be32_to_cpu(str->sb_header.mh_magic);
@@ -175,7 +179,7 @@ static void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf)
 
 	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
 	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
-	memcpy(sb->sb_uuid, str->sb_uuid, 16);
+	memcpy(s->s_uuid, str->sb_uuid, 16);
 }
 
 /**
@@ -197,7 +201,7 @@ static void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf)
  * Returns: 0 on success or error
  */
 
-static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector)
+static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent)
 {
 	struct super_block *sb = sdp->sd_vfs;
 	struct gfs2_sb *p;
@@ -227,10 +231,10 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector)
 		return -EIO;
 	}
 	p = kmap(page);
-	gfs2_sb_in(&sdp->sd_sb, p);
+	gfs2_sb_in(sdp, p);
 	kunmap(page);
 	__free_page(page);
-	return 0;
+	return gfs2_check_sb(sdp, silent);
 }
 
 /**
@@ -247,17 +251,13 @@ static int gfs2_read_sb(struct gfs2_sbd *sdp, int silent)
 	unsigned int x;
 	int error;
 
-	error = gfs2_read_super(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
+	error = gfs2_read_super(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift, silent);
 	if (error) {
 		if (!silent)
 			fs_err(sdp, "can't read superblock\n");
 		return error;
 	}
 
-	error = gfs2_check_sb(sdp, &sdp->sd_sb, silent);
-	if (error)
-		return error;
-
 	sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift -
 			       GFS2_BASIC_BLOCK_SHIFT;
 	sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
@@ -340,14 +340,10 @@ static int init_names(struct gfs2_sbd *sdp, int silent)
 	/*  Try to autodetect  */
 
 	if (!proto[0] || !table[0]) {
-		error = gfs2_read_super(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
+		error = gfs2_read_super(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift, silent);
 		if (error)
 			return error;
 
-		error = gfs2_check_sb(sdp, &sdp->sd_sb, silent);
-		if (error)
-			goto out;
-
 		if (!proto[0])
 			proto = sdp->sd_sb.sb_lockproto;
 		if (!table[0])
@@ -364,7 +360,6 @@ static int init_names(struct gfs2_sbd *sdp, int silent)
 	while ((table = strchr(table, '/')))
 		*table = '_';
 
-out:
 	return error;
 }
 
@@ -1119,8 +1114,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
 	if (sdp->sd_args.ar_statfs_quantum) {
 		sdp->sd_tune.gt_statfs_slow = 0;
 		sdp->sd_tune.gt_statfs_quantum = sdp->sd_args.ar_statfs_quantum;
-	}
-	else {
+	} else {
 		sdp->sd_tune.gt_statfs_slow = 1;
 		sdp->sd_tune.gt_statfs_quantum = 30;
 	}
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 748ccb5..e20eab3 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -81,7 +81,8 @@ static int gfs2_uuid_valid(const u8 *uuid)
 
 static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
 {
-	const u8 *uuid = sdp->sd_sb.sb_uuid;
+	struct super_block *s = sdp->sd_vfs;
+	const u8 *uuid = s->s_uuid;
 	buf[0] = '\0';
 	if (!gfs2_uuid_valid(uuid))
 		return 0;
@@ -616,7 +617,8 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
 		       struct kobj_uevent_env *env)
 {
 	struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
-	const u8 *uuid = sdp->sd_sb.sb_uuid;
+	struct super_block *s = sdp->sd_vfs;
+	const u8 *uuid = s->s_uuid;
 
 	add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
 	add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
-- 
1.7.4


  parent reply	other threads:[~2011-05-19  9:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19  8:46 GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2011-05-19  8:46 ` [PATCH 01/32] GFS2: Dump better debug info if a bitmap inconsistency is detected Steven Whitehouse
2011-05-19  8:46 ` [PATCH 02/32] GFS2: remove *leaf_call_t and simplify leaf_dealloc Steven Whitehouse
2011-05-19  8:46 ` [PATCH 03/32] GFS2: Combine transaction from gfs2_dir_exhash_dealloc Steven Whitehouse
2011-05-19  8:46 ` [PATCH 04/32] GFS2: pass leaf_bh into leaf_dealloc Steven Whitehouse
2011-05-19  8:47 ` [PATCH 05/32] GFS2: move function foreach_leaf to gfs2_dir_exhash_dealloc Steven Whitehouse
2011-05-19  8:47 ` [PATCH 06/32] GFS2: Make ->write_inode() really write Steven Whitehouse
2011-05-19  8:47 ` [PATCH 07/32] GFS2: Use filemap_fdatawrite() to write back the AIL Steven Whitehouse
2011-05-19  8:47 ` [PATCH 08/32] GFS2: Alter point of entry to glock lru list for glocks with an address_space Steven Whitehouse
2011-05-19  8:47 ` [PATCH 09/32] GFS2: Remove unused macro Steven Whitehouse
2011-05-19  8:47 ` [PATCH 10/32] GFS2: Clean up fsync() Steven Whitehouse
2011-05-19  8:47 ` [PATCH 11/32] GFS2: Improve tracing support (adds two flags) Steven Whitehouse
2011-05-19  8:47 ` [PATCH 12/32] GFS2: Optimise glock lru and end of life inodes Steven Whitehouse
2011-05-19  8:47 ` [PATCH 13/32] GFS2: Make writeback more responsive to system conditions Steven Whitehouse
2011-05-19  8:47 ` [PATCH 14/32] GFS2: Add an AIL writeback tracepoint Steven Whitehouse
2011-05-19  8:47 ` [PATCH 15/32] GFS2: make sure fallocate bytes is a multiple of blksize Steven Whitehouse
2011-05-19  8:47 ` [PATCH 16/32] GFS2: Fix ail list traversal Steven Whitehouse
2011-05-19  8:47 ` [PATCH 17/32] GFS2: Improve bug trap code in ->releasepage() Steven Whitehouse
2011-05-19  8:47 ` [PATCH 18/32] GFS2: Double check link count under glock Steven Whitehouse
2011-05-19  8:47 ` [PATCH 19/32] GFS2: Don't use a try lock when promoting to a higher mode Steven Whitehouse
2011-05-19  8:47 ` [PATCH 20/32] GFS2: Don't use gfs2_change_nlink in link syscall Steven Whitehouse
2011-05-19  8:47 ` [PATCH 21/32] GFS2: Make gfs2_dir_del update link count when required Steven Whitehouse
2011-05-19  8:47 ` [PATCH 22/32] GFS2: When adding a new dir entry, inc link count if it is a subdir Steven Whitehouse
2011-05-19  8:47 ` [PATCH 23/32] GFS2: Remove gfs2_dinode_print() function Steven Whitehouse
2011-05-19  8:47 ` [PATCH 24/32] GFS2: Move gfs2_refresh_inode() and friends into glops.c Steven Whitehouse
2011-05-19  8:47 ` [PATCH 25/32] GFS2: Move most of the remaining inode.c into ops_inode.c Steven Whitehouse
2011-05-19  8:47 ` [PATCH 26/32] GFS2: Move final part of inode.c into super.c Steven Whitehouse
2011-05-19  8:47 ` [PATCH 27/32] GFS2: Inode.c is empty now, remove it Steven Whitehouse
2011-05-19  8:47 ` [PATCH 28/32] GFS2: Rename ops_inode.c to inode.c Steven Whitehouse
2011-05-19  8:47 ` Steven Whitehouse [this message]
2011-05-19  8:47 ` [PATCH 30/32] GFS2: Clean up mkdir Steven Whitehouse
2011-05-19  8:47 ` [PATCH 31/32] GFS2: Clean up symlink creation Steven Whitehouse
2011-05-19  8:47 ` [PATCH 32/32] GFS2: Move all locking inside the inode creation function Steven Whitehouse

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=1305794847-3291-30-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®