[Ocfs2-tools-devel] [PATCH 1/2] ocfs2-tools: Set hash seed when convert ocfs2 to support indexed-dirs
Sunil Mushran
sunil.mushran at oracle.com
Tue Feb 15 18:50:37 PST 2011
Acked-by: Sunil Mushran<sunil.mushran at oracle.com>
On 02/14/2011 11:13 PM, Tiger Yang wrote:
> The hash seed should be set in super block when convert ocfs2
> to support indexed-dirs with tunefs.ocfs2, and it should be clear
> when disable indexed-dirs.
>
> Signed-off-by: Tiger Yang<tiger.yang at oracle.com>
> ---
> tunefs.ocfs2/feature_indexed_dirs.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/tunefs.ocfs2/feature_indexed_dirs.c b/tunefs.ocfs2/feature_indexed_dirs.c
> index 7a918e7..5cdc86c 100644
> --- a/tunefs.ocfs2/feature_indexed_dirs.c
> +++ b/tunefs.ocfs2/feature_indexed_dirs.c
> @@ -117,6 +117,12 @@ static int enable_indexed_dirs(ocfs2_filesys *fs, int flags)
> goto out;
> }
>
> + /* set seed for indexed dir hash */
> + srand48(time(NULL));
> + super->s_dx_seed[0] = mrand48();
> + super->s_dx_seed[1] = mrand48();
> + super->s_dx_seed[2] = mrand48();
> +
> OCFS2_SET_INCOMPAT_FEATURE(super,
> OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS);
>
> @@ -302,6 +308,9 @@ static int disable_indexed_dirs(ocfs2_filesys *fs, int flags)
> * fsck.ocfs2 will handle the orphan indexed trees. */
> OCFS2_CLEAR_INCOMPAT_FEATURE(super,
> OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS);
> +
> + super->s_dx_seed[0] = super->s_dx_seed[1] = super->s_dx_seed[2] = 0;
> +
> ret = ocfs2_write_super(fs);
> tunefs_unblock_signals();
>
More information about the Ocfs2-tools-devel
mailing list