Skip to contentSkip to conversation

hashes in reiser3.6

DISCUSSION Grzegorz Jaśkiewicz 4 participants 5 messages Nov 18, 2004 – Nov 28, 2004

lore
Share & tools
lore
#0 lore raw

Hi folks

I have a need to switch from default hashing to TEA on one of my servers recently.
Want to write something like that, as it doesn't exists now. Only in manual I digged out that hash= option to mount is just for folks who want to upgrade their filesystem to 3.6, and choose hash, or something.
If someone can tell me how deep I should dig to change it, and some hints are welcomed.
I already did some hacking in reiserfs3.6 for myself (non profit thing), so I know sources a bit.

Thanks in advance.

I know that reiser4 is supperb, and I am testing it extensively (already found 2 or more bugs and reported them), but it is stilll way to much unstable for production.

Signature · 1 line
GJ
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Grzegorz Jaśkiewicz wrote:

| Hi folks
|
| I have a need to switch from default hashing to TEA on one of my
| servers recently.
| Want to write something like that, as it doesn't exists now. Only in
| manual I digged out that hash= option to mount is just for folks who
| want to upgrade their filesystem to 3.6, and choose hash, or
| something.
| If someone can tell me how deep I should dig to change it, and some
| hints are welcomed.
| I already did some hacking in reiserfs3.6 for myself (non profit
| thing), so I know sources a bit.
|
| Thanks in advance.
|
| I know that reiser4 is supperb, and I am testing it extensively
| (already found 2 or more bugs and reported them), but it is stilll way
| to much unstable for production.
|

If the filesystem is already established, you can't switch hashes. The hash is global to the filesystem, so if you were to change it, lookups would fail and you wouldn't be able to find any of your files.

If you're creating a new filesystem, you can use the --hash argument to mkreiserfs. Under most circumstances, the filesystem code will automatically discover which hash you're using at mount time.

- -Jeff

- --
Jeff Mahoney
SuSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBnQMcLPWxlyuTD7IRAoIdAJ4qY8y4mYHcmjqTy9ItAg6ULWm2OQCeNPlc j1EY6mzJgadtngrcG1C3m7k=
=5kiE
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 7 lines · Jeff Mahoney

If the filesystem is already established, you can't switch hashes. The hash is global to the filesystem, so if you were to change it, lookups would fail and you wouldn't be able to find any of your files.

If you're creating a new filesystem, you can use the --hash argument to mkreiserfs. Under most circumstances, the filesystem code will automatically discover which hash you're using at mount time.

Thanks, but the trick is that I would like to switch over existing partition to other hash.
I know, I can copy over all data on side, and recreate partition from scratch, but it's just way too painfull. It should be possible to do this in much easier way.
So you say, that reiserfs doesn't store filenames in strucures, but uses just hashes to lookup ? Shouldn't it be possible to go through all structures on the partition, and recreate hashes, but using different key function ?
I am prepared to spend some time,and do this.

Signature · 1 line
GJ
#3 lore raw

Hello

Quoted 10 lines · Grzegorz Ja¶kiewicz
Quoted 7 lines · Jeff Mahoney

If the filesystem is already established, you can't switch hashes. The hash is global to the filesystem, so if you were to change it, lookups would fail and you wouldn't be able to find any of your files.

If you're creating a new filesystem, you can use the --hash argument to mkreiserfs. Under most circumstances, the filesystem code will automatically discover which hash you're using at mount time.

Quoted 10 lines

Thanks, but the trick is that I would like to switch over existing partition to other hash.
I know, I can copy over all data on side, and recreate partition from scratch, but it's just way too painfull. It should be possible to do this in much easier way.
So you say, that reiserfs doesn't store filenames in strucures, but uses just hashes to lookup ? Shouldn't it be possible to go through all structures on the partition, and recreate hashes, but using different key function ?
I am prepared to spend some time,and do this.

I am afraid you will have to create a special tool to do this trick. If such tool does not exist - it is much easier to rehash using spare partition.

#4 lore raw
In reply to Grzegorz Jaśkiewicz

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Grzegorz Jaśkiewicz wrote:

| On Thu, 18 Nov 2004 15:16:29 -0500, Jeff Mahoney <[email protected]> wrote:
|
|
|>If the filesystem is already established, you can't switch hashes. The
|>hash is global to the filesystem, so if you were to change it, lookups
|>would fail and you wouldn't be able to find any of your files.
|>
|>If you're creating a new filesystem, you can use the --hash argument to
|>mkreiserfs. Under most circumstances, the filesystem code will
|>automatically discover which hash you're using at mount time.
|
|
| Thanks, but the trick is that I would like to switch over existing
| partition to other hash.
| I know, I can copy over all data on side, and recreate partition from
| scratch, but it's just way too painfull. It should be possible to do
| this in much easier way.
| So you say, that reiserfs doesn't store filenames in strucures, but
| uses just hashes to lookup ? Shouldn't it be possible to go through
| all structures on the partition, and recreate hashes, but using
| different key function ?
| I am prepared to spend some time,and do this.
|

As Vladimir said, you'd need to write a special tool to do this. It would be far more cost effective to use a spare drive or tape backup to backup your filesystem and restore it again.

To highlight why this would be such a complex operation, consider that the hashed entries are sorted by the hash. With small directories, this is fairly trivial since you can just shuffle the entries around inside the same item. However, with a large directory (where large is defined as the length of all filenames + associated keys is larger than a disk block), the directory can be split over several nodes. Once you start shuffling nodes around, you're essentially rebuilding the tree, and that's far more complex and time consuming than simply copying the data off and restoring it back.

Sorry we don't have an easier answer for you. :(

- -Jeff

- --
Jeff Mahoney
SuSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBqidcLPWxlyuTD7IRAnb9AJ93lAymaFd2O6jotBU/56nU77e5bgCdF124 KzpH9IKqR+nG0c+jIGDTN98=
=UDnU
-----END PGP SIGNATURE-----