From: Theodore Ts'o Date: Mon, 10 Sep 2012 02:52:26 +0000 (-0400) Subject: Merge branch 'maint' into next X-Git-Tag: v1.43-WIP-2012-09-22~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e7e7c8ef89cf32fdb1210bfde1feb90880c327b;p=thirdparty%2Fe2fsprogs.git Merge branch 'maint' into next Conflicts: lib/ext2fs/ext2fs.h --- 0e7e7c8ef89cf32fdb1210bfde1feb90880c327b diff --cc lib/ext2fs/ext2fs.h index 5892b14bd,7a14f4088..31ada477c --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@@ -1504,10 -1439,8 +1514,9 @@@ extern errcode_t ext2fs_write_bb_FILE(e /* inline functions */ + #ifdef NO_INLINE_FUNCS +extern void ext2fs_init_csum_seed(ext2_filsys fs); extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr); - extern errcode_t ext2fs_get_memalign(unsigned long size, - unsigned long align, void *ptr); extern errcode_t ext2fs_get_memzero(unsigned long size, void *ptr); extern errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr); @@@ -1552,19 -1486,10 +1562,20 @@@ extern __u64 ext2fs_div64_ceil(__u64 a #define _INLINE_ extern __inline__ #else /* For Watcom C */ #define _INLINE_ extern inline - #endif + #endif /* __GNUC__ */ + #endif /* __STDC_VERSION__ >= 199901L */ #endif +_INLINE_ void ext2fs_init_csum_seed(ext2_filsys fs) +{ + if (!EXT2_HAS_RO_COMPAT_FEATURE(fs->super, + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) + return; + + fs->csum_seed = ext2fs_crc32c_le(~0, fs->super->s_uuid, + sizeof(fs->super->s_uuid)); +} + #ifndef EXT2_CUSTOM_MEMORY_ROUTINES #include /* diff --cc lib/ext2fs/kernel-jbd.h index 106a83a4c,066c031ed..5d2f337bd --- a/lib/ext2fs/kernel-jbd.h +++ b/lib/ext2fs/kernel-jbd.h @@@ -259,38 -235,7 +259,46 @@@ typedef struct journal_superblock_ #define JFS_KNOWN_ROCOMPAT_FEATURES 0 #define JFS_KNOWN_INCOMPAT_FEATURES (JFS_FEATURE_INCOMPAT_REVOKE|\ JFS_FEATURE_INCOMPAT_ASYNC_COMMIT|\ - JFS_FEATURE_INCOMPAT_64BIT) + JFS_FEATURE_INCOMPAT_64BIT|\ + JFS_FEATURE_INCOMPAT_CSUM_V2) + +#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) +#ifdef E2FSCK_INCLUDE_INLINE_FUNCS - #define _INLINE_ extern ++#if (__STDC_VERSION__ >= 199901L) ++#define _INLINE_ extern inline +#else ++#define _INLINE_ inline ++#endif ++#else /* !E2FSCK_INCLUDE_INLINE FUNCS */ ++#if (__STDC_VERSION__ >= 199901L) ++#define _INLINE_ inline ++#else /* not C99 */ +#ifdef __GNUC__ +#define _INLINE_ extern __inline__ +#else /* For Watcom C */ +#define _INLINE_ extern inline - #endif - #endif ++#endif /* __GNUC__ */ ++#endif /* __STDC_VERSION__ >= 199901L */ ++#endif /* INCLUDE_INLINE_FUNCS */ + +/* + * helper functions to deal with 32 or 64bit block numbers. + */ +_INLINE_ size_t journal_tag_bytes(journal_t *journal) +{ + journal_block_tag_t tag; + size_t x = 0; + + if (JFS_HAS_INCOMPAT_FEATURE(journal, JFS_FEATURE_INCOMPAT_CSUM_V2)) + x += sizeof(tag.t_checksum); + + if (JFS_HAS_INCOMPAT_FEATURE(journal, JFS_FEATURE_INCOMPAT_64BIT)) + return x + JBD_TAG_SIZE64; + else + return x + JBD_TAG_SIZE32; +} +#undef _INLINE_ +#endif #ifdef __KERNEL__