Date: Sun, 17 May 2020 14:00:55 +0000 (UTC) From: Fedor Uporov <fsu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361133 - head/sys/fs/ext2fs Message-ID: <202005171400.04HE0tjD029386@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: fsu Date: Sun May 17 14:00:54 2020 New Revision: 361133 URL: https://svnweb.freebsd.org/changeset/base/361133 Log: Add inode bitmap tail initialization. Make ext2fs compatible with changes introduced in e2fsprogs v1.45.2. Now the tail of inode bitmap is filled with 0xff pattern explicitly during bitmap initialization phase to avoid e2fsck error like: "Padding at end of inode bitmap is not set." Modified: head/sys/fs/ext2fs/ext2_alloc.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Sun May 17 11:13:12 2020 (r361132) +++ head/sys/fs/ext2fs/ext2_alloc.c Sun May 17 14:00:54 2020 (r361133) @@ -1287,6 +1287,16 @@ ext2_zero_inode_table(struct inode *ip, int cg) return (0); } +static void +ext2_fix_bitmap_tail(unsigned char *bitmap, int first, int last) +{ + int i; + + for (i = first; i <= last; i++) + bitmap[i] = 0xff; +} + + /* * Determine whether an inode can be allocated. * @@ -1299,7 +1309,7 @@ ext2_nodealloccg(struct inode *ip, int cg, daddr_t ipr struct m_ext2fs *fs; struct buf *bp; struct ext2mount *ump; - int error, start, len, ifree; + int error, start, len, ifree, ibytes; char *ibp, *loc; ipref--; /* to avoid a lot of (ipref -1) */ @@ -1320,7 +1330,10 @@ ext2_nodealloccg(struct inode *ip, int cg, daddr_t ipr if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM) || EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_METADATA_CKSUM)) { if (fs->e2fs_gd[cg].ext4bgd_flags & EXT2_BG_INODE_UNINIT) { - memset(bp->b_data, 0, fs->e2fs_bsize); + ibytes = fs->e2fs_ipg / 8; + memset(bp->b_data, 0, ibytes - 1); + ext2_fix_bitmap_tail(bp->b_data, ibytes, + fs->e2fs_bsize - 1); fs->e2fs_gd[cg].ext4bgd_flags &= ~EXT2_BG_INODE_UNINIT; } ext2_gd_i_bitmap_csum_set(fs, cg, bp);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005171400.04HE0tjD029386>