[Ocfs2-tools-devel] [PATCH 6/7] tunefs.ocfs2: Turn on and off
the extended slot map
Joel Becker
Joel.Becker at oracle.com
Fri Jan 11 14:06:08 PST 2008
On Fri, Jan 11, 2008 at 12:32:16PM -0800, Joel Becker wrote:
> On Fri, Jan 11, 2008 at 09:51:39AM +0800, tao.ma wrote:
> > You patch does touch increasing slot.
> > Although current ocfs2_extend_slot is only 8 bytes and the minimum
> > cluster size is 4K and 8 * 255 << 4k, do you think we have any future
> > improvement in future which will exceed the limit? ;)
> > Maybe a call of ocfs2_format_slot_map is needed for increasing slot?
>
> With the new format, we do intend to allow an arbitrary number
> of slots (even though we all know >255 nodes is hard to make work in
> practice). Thus, adding slots could grow beyond 4K - never mind a 1K
> blocksize. So I do need to do something at add_slot() time. It should
> be something as trivial as format_slotmap(). This will do nothing if
> the slotmap is already big enough.
How's this?
diff --git a/tunefs.ocfs2/tunefs.c b/tunefs.ocfs2/tunefs.c
index 400ae10..61052ee 100644
--- a/tunefs.ocfs2/tunefs.c
+++ b/tunefs.ocfs2/tunefs.c
@@ -911,18 +911,25 @@ static void update_mount_type(ocfs2_filesys *fs, int *changed)
static errcode_t update_slots(ocfs2_filesys *fs, int *changed)
{
errcode_t ret = 0;
+ int orig_slots = OCFS2_RAW_SB(fs->fs_super)->s_max_slots;
block_signals(SIG_BLOCK);
- if (opts.num_slots > OCFS2_RAW_SB(fs->fs_super)->s_max_slots)
+ if (opts.num_slots > orig_slots)
ret = add_slots(fs);
else
ret = remove_slots(fs);
- block_signals(SIG_UNBLOCK);
if (ret)
- return ret;
+ goto unblock;
OCFS2_RAW_SB(fs->fs_super)->s_max_slots = opts.num_slots;
- *changed = 1;
+ ret = ocfs2_format_slot_map(fs);
+ if (!ret)
+ *changed = 1;
+ else
+ OCFS2_RAW_SB(fs->fs_super)->s_max_slots = orig_slots;
+
+unblock:
+ block_signals(SIG_UNBLOCK);
return ret;
}
--
"Against stupidity the Gods themselves contend in vain."
- Friedrich von Schiller
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-tools-devel
mailing list