Date: Sun, 22 Feb 2015 02:14:50 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r279133 - stable/10/sys/fs/ext2fs Message-ID: <201502220214.t1M2Eo7J021514@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Sun Feb 22 02:14:49 2015 New Revision: 279133 URL: https://svnweb.freebsd.org/changeset/base/279133 Log: MFC r278790, r278802: Initialize the allocation of variables related to the ext2 allocator. Use malloc to clear the values and initialize e2fs_contigdirs during allocation. free() e2fs_contigdirs upon error. While here clean up small style issues. Modified: stable/10/sys/fs/ext2fs/ext2_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_vfsops.c Sun Feb 22 01:43:30 2015 (r279132) +++ stable/10/sys/fs/ext2fs/ext2_vfsops.c Sun Feb 22 02:14:49 2015 (r279133) @@ -355,7 +355,7 @@ compute_sb_data(struct vnode *devvp, str } fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); - fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb; + fs->e2fs_itpg = fs->e2fs_ipg / fs->e2fs_ipb; /* s_resuid / s_resgid ? */ fs->e2fs_gcount = (es->e2fs_bcount - es->e2fs_first_dblock + EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs); @@ -365,7 +365,7 @@ compute_sb_data(struct vnode *devvp, str fs->e2fs_gd = malloc(db_count * fs->e2fs_bsize, M_EXT2MNT, M_WAITOK); fs->e2fs_contigdirs = malloc(fs->e2fs_gcount * - sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK); + sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK | M_ZERO); /* * Adjust logic_sb_block. @@ -379,6 +379,7 @@ compute_sb_data(struct vnode *devvp, str fsbtodb(fs, logic_sb_block + i + 1 ), fs->e2fs_bsize, NOCRED, &bp); if (error) { + free(fs->e2fs_contigdirs, M_EXT2MNT); free(fs->e2fs_gd, M_EXT2MNT); brelse(bp); return (error); @@ -390,11 +391,11 @@ compute_sb_data(struct vnode *devvp, str brelse(bp); bp = NULL; } + /* Initialization for the ext2 Orlov allocator variant. */ fs->e2fs_total_dir = 0; - for (i=0; i < fs->e2fs_gcount; i++){ + for (i = 0; i < fs->e2fs_gcount; i++) fs->e2fs_total_dir += fs->e2fs_gd[i].ext2bgd_ndirs; - fs->e2fs_contigdirs[i] = 0; - } + if (es->e2fs_rev == E2FS_REV0 || !EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_LARGEFILE)) fs->e2fs_maxfilesize = 0x7fffffff;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502220214.t1M2Eo7J021514>