From owner-svn-src-all@FreeBSD.ORG Sun Jan 18 14:06:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E79DF1065673; Sun, 18 Jan 2009 14:06:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 7E9898FC14; Sun, 18 Jan 2009 14:06:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LOYIZ-000MBf-GD; Sun, 18 Jan 2009 16:06:47 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n0IE6inh087721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Jan 2009 16:06:44 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n0IE6if5086356; Sun, 18 Jan 2009 16:06:44 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n0IE6igK086355; Sun, 18 Jan 2009 16:06:44 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 18 Jan 2009 16:06:44 +0200 From: Kostik Belousov To: Stanislav Sedov Message-ID: <20090118140644.GT48057@deviant.kiev.zoral.com.ua> References: <200901181404.n0IE4uXw075698@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Ayym4vmyMU9P4uDb" Content-Disposition: inline In-Reply-To: <200901181404.n0IE4uXw075698@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LOYIZ-000MBf-GD a0a5832a7a3dbbabd32e125895202e50 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187395 - head/sys/gnu/fs/ext2fs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jan 2009 14:06:49 -0000 --Ayym4vmyMU9P4uDb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 18, 2009 at 02:04:56PM +0000, Stanislav Sedov wrote: > Author: stas > Date: Sun Jan 18 14:04:56 2009 > New Revision: 187395 > URL: http://svn.freebsd.org/changeset/base/187395 >=20 > Log: > - Obtain inode sizes and location of the first inode based on the conte= nts > of superblock rather than using hardcoded values. This fixes ext2fs on > filesystems with inode sized other than 128. > =20 > Submitted by: Alex Lyashkov (based on) > MFC after: 2 weeks >=20 > Modified: > head/sys/gnu/fs/ext2fs/ext2_fs.h > head/sys/gnu/fs/ext2fs/ext2_fs_sb.h > head/sys/gnu/fs/ext2fs/ext2_inode.c > head/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c > head/sys/gnu/fs/ext2fs/ext2_vfsops.c >=20 > Modified: head/sys/gnu/fs/ext2fs/ext2_fs.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/gnu/fs/ext2fs/ext2_fs.h Sun Jan 18 13:04:38 2009 (r187394) > +++ head/sys/gnu/fs/ext2fs/ext2_fs.h Sun Jan 18 14:04:56 2009 (r187395) > @@ -150,8 +150,8 @@ > #else /* !notyet */ > #define EXT2_INODES_PER_BLOCK(s) ((s)->s_inodes_per_block) > /* Should be sizeof(struct ext2_inode): */ > -#define EXT2_INODE_SIZE 128 > -#define EXT2_FIRST_INO 11 > +#define EXT2_INODE_SIZE(s) ((s)->s_inode_size) > +#define EXT2_FIRST_INO(s) ((s)->s_first_inode) > #endif /* notyet */ > =20 > /* >=20 > Modified: head/sys/gnu/fs/ext2fs/ext2_fs_sb.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/gnu/fs/ext2fs/ext2_fs_sb.h Sun Jan 18 13:04:38 2009 (r187394) > +++ head/sys/gnu/fs/ext2fs/ext2_fs_sb.h Sun Jan 18 14:04:56 2009 (r187395) > @@ -63,6 +63,8 @@ struct ext2_sb_info { > unsigned long s_db_per_group; /* Number of descriptor blocks per group = */ > unsigned long s_desc_per_block; /* Number of group descriptors per bloc= k */ > unsigned long s_groups_count; /* Number of groups in the fs */ > + unsigned long s_first_inode; /* First inode on fs */ > + unsigned int s_inode_size; /* Size for inode with extra data */ > struct buffer_head * s_sbh; /* Buffer containing the super block */ > struct ext2_super_block * s_es; /* Pointer to the super block in the bu= ffer */ > struct buffer_head ** s_group_desc; >=20 > Modified: head/sys/gnu/fs/ext2fs/ext2_inode.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/gnu/fs/ext2fs/ext2_inode.c Sun Jan 18 13:04:38 2009 (r187394) > +++ head/sys/gnu/fs/ext2fs/ext2_inode.c Sun Jan 18 14:04:56 2009 (r187395) > @@ -91,7 +91,7 @@ ext2_update(vp, waitfor) > return (error); > } > ext2_i2ei(ip, (struct ext2_inode *)((char *)bp->b_data + > - EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number))); > + EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number))); > if (waitfor && (vp->v_mount->mnt_kern_flag & MNTK_ASYNC) =3D=3D 0) > return (bwrite(bp)); > else { >=20 > Modified: head/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c Sun Jan 18 13:04:38 2009 (= r187394) > +++ head/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c Sun Jan 18 14:04:56 2009 (= r187395) > @@ -225,7 +225,7 @@ void ext2_free_inode (struct inode * ino > =20 > sb =3D inode->i_e2fs; > lock_super (DEVVP(inode)); > - if (inode->i_number < EXT2_FIRST_INO || > + if (inode->i_number < EXT2_FIRST_INO(sb) || > inode->i_number > sb->s_es->s_inodes_count) { > printf ("free_inode reserved inode or nonexistent inode"); > unlock_super (DEVVP(inode)); > @@ -435,7 +435,7 @@ repeat: > goto repeat; > } > j +=3D i * EXT2_INODES_PER_GROUP(sb) + 1; > - if (j < EXT2_FIRST_INO || j > es->s_inodes_count) { > + if (j < EXT2_FIRST_INO(sb) || j > es->s_inodes_count) { > printf ( "ext2_new_inode:" > "reserved inode or inode > inodes count - " > "block_group =3D %d,inode=3D%d", i, j); >=20 > Modified: head/sys/gnu/fs/ext2fs/ext2_vfsops.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/gnu/fs/ext2fs/ext2_vfsops.c Sun Jan 18 13:04:38 2009 (r18739= 4) > +++ head/sys/gnu/fs/ext2fs/ext2_vfsops.c Sun Jan 18 14:04:56 2009 (r18739= 5) > @@ -424,7 +424,11 @@ static int compute_sb_data(devvp, es, fs > V(s_frags_per_group) > fs->s_inodes_per_group =3D es->s_inodes_per_group; > V(s_inodes_per_group) > - fs->s_inodes_per_block =3D fs->s_blocksize / EXT2_INODE_SIZE; > + fs->s_inode_size =3D es->s_inode_size; > + V(s_inode_size) > + fs->s_first_inode =3D es->s_first_ino; > + V(s_first_inode); > + fs->s_inodes_per_block =3D fs->s_blocksize / EXT2_INODE_SIZE(fs); > V(s_inodes_per_block) > fs->s_itb_per_group =3D fs->s_inodes_per_group /fs->s_inodes_per_blo= ck; > V(s_itb_per_group) > @@ -578,7 +582,7 @@ loop: > return (error); > } > ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data + > - EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)), ip); > + EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)), ip); > brelse(bp); > VOP_UNLOCK(vp, 0); > vrele(vp); > @@ -1012,7 +1016,7 @@ printf("ext2_vget(%d) dbn=3D %d ", ino, fs > return (error); > } > /* convert ext2 inode to dinode */ > - ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data + EXT2_INODE_SIZE * > + ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data + EXT2_INODE_SIZE(f= s) * > ino_to_fsbo(fs, ino)), ip); > ip->i_block_group =3D ino_to_cg(fs, ino); > ip->i_next_alloc_block =3D 0; Please see a discussion on the fs@ and reasoning why I declined to commit the similar patch. --Ayym4vmyMU9P4uDb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAklzN3MACgkQC3+MBN1Mb4i13QCgy52qspLplFQyfZL/0HY6b4vk 0iQAoIVa2IbBUbjUF5/KFqVSHTQLALDN =Kg6Z -----END PGP SIGNATURE----- --Ayym4vmyMU9P4uDb--