svn commit: r362096 - stable/12/sys/fs/ext2fs
Fedor Uporov
fsu at FreeBSD.org
Fri Jun 12 13:52:11 UTC 2020
Author: fsu
Date: Fri Jun 12 13:52:11 2020
New Revision: 362096
URL: https://svnweb.freebsd.org/changeset/base/362096
Log:
MFC r361133:
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:
stable/12/sys/fs/ext2fs/ext2_alloc.c
Modified: stable/12/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- stable/12/sys/fs/ext2fs/ext2_alloc.c Fri Jun 12 13:02:44 2020 (r362095)
+++ stable/12/sys/fs/ext2fs/ext2_alloc.c Fri Jun 12 13:52:11 2020 (r362096)
@@ -1286,6 +1286,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.
*
@@ -1298,7 +1308,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);
More information about the svn-src-all
mailing list