From owner-svn-src-stable@freebsd.org Tue May 10 02:15:11 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10207B35DD2; Tue, 10 May 2016 02:15:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D656D184B; Tue, 10 May 2016 02:15:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4A2FAxL022600; Tue, 10 May 2016 02:15:10 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4A2FAcQ022599; Tue, 10 May 2016 02:15:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201605100215.u4A2FAcQ022599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 10 May 2016 02:15:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r299296 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2016 02:15:11 -0000 Author: pfg Date: Tue May 10 02:15:09 2016 New Revision: 299296 URL: https://svnweb.freebsd.org/changeset/base/299296 Log: MFC r298609: ext2fs: make use of the howmany() macro when available. We have a howmany() macro in the header that is convenient to re-use as it makes things easier to read. Modified: stable/9/sys/fs/ext2fs/ext2_vfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vfsops.c Tue May 10 02:13:17 2016 (r299295) +++ stable/9/sys/fs/ext2fs/ext2_vfsops.c Tue May 10 02:15:09 2016 (r299296) @@ -357,10 +357,10 @@ 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; /* 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); + fs->e2fs_gcount = howmany(es->e2fs_bcount - es->e2fs_first_dblock, + EXT2_BLOCKS_PER_GROUP(fs)); e2fs_descpb = fs->e2fs_bsize / sizeof(struct ext2_gd); - db_count = (fs->e2fs_gcount + e2fs_descpb - 1) / e2fs_descpb; + db_count = howmany(fs->e2fs_gcount, e2fs_descpb); fs->e2fs_gdbcount = db_count; fs->e2fs_gd = malloc(db_count * fs->e2fs_bsize, M_EXT2MNT, M_WAITOK); @@ -964,7 +964,7 @@ ext2_vget(struct mount *mp, ino_t ino, i */ if (!(ip->i_flag & IN_E4EXTENTS) && (S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode))) { - used_blocks = (ip->i_size+fs->e2fs_bsize-1) / fs->e2fs_bsize; + used_blocks = howmany(ip->i_size, fs->e2fs_bsize); for (i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) ip->i_db[i] = 0; }