Re: [PATCH 1/3] journal: use consts instead of 1024 and add helper for journal with 1k blocksize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jul 8, 2014, at 2:41 PM, Azat Khuzhin <a3at.mail@xxxxxxxxx> wrote:
> Use EXT2_MIN_BLOCK_SIZE/JFS_MIN_JOURNAL_BLOCKS instead of hardcoded 1024
> when it is okay, and also add a helper ext2fs_journal_sb_start() that
> will return start of journal sb with special case for fs with 1k block
> size.

Seems like a good idea, but an issue below.

> diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
> index 884d9c0..068eed7 100644
> --- a/lib/ext2fs/mkjournal.c
> +++ b/lib/ext2fs/mkjournal.c
> @@ -75,10 +75,7 @@ errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
> 	if (fs->super->s_feature_incompat &
> 	    EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
> 		jsb->s_nr_users = 0;
> -		if (fs->blocksize == 1024)
> -			jsb->s_first = htonl(3);
> -		else
> -			jsb->s_first = htonl(2);
> +		jsb->s_first = ext2fs_journal_sb_start(fs->blocksize) + 1;

This looks like it is missing the htonl() conversion, and will break the on-disk format?

The JBD code stores all data on-disk in big-endian to ensure that it is converted properly
on the most common little-endian systems, and will therefore also work on big-endian systems.

Cheers, Andreas





Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux