Date: Mon, 29 Jun 2009 20:28:46 GMT From: Aditya Sarawgi <truncs@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 165438 for review Message-ID: <200906292028.n5TKSkGK074482@repoman.freebsd.org>
index | next in thread | raw e-mail
http://perforce.freebsd.org/chv.cgi?CH=165438 Change 165438 by truncs@aditya on 2009/06/29 20:28:02 Freeing an inode implementation. Affected files ... .. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#22 edit Differences ... ==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#22 (text+ko) ==== @@ -517,7 +517,11 @@ { struct m_ext2fs *fs; struct inode *pip; - mode_t save_i_mode; + struct buf *bp; + struct ext2_gd * gdp = NULL; + int error, cg; + char * ibp; +/* mode_t save_i_mode; */ pip = VTOI(pvp); fs = pip->i_e2fs; @@ -534,10 +538,35 @@ really like to know what the rationale behind this 'set i_mode to zero to denote an unused inode' is */ - save_i_mode = pip->i_mode; +/* save_i_mode = pip->i_mode; pip->i_mode = mode; ext2_free_inode(pip); - pip->i_mode = save_i_mode; + pip->i_mode = save_i_mode; */ + cg = ino_to_cg(fs, ino); + gdp = get_group_desc2(fs, cg, NULL); + error = bread(pip->i_devvp, + fsbtodb(fs, gdp->ext2bgd_i_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); + if (error) { + brelse(bp); + return (0); + } + ibp = (char *)bp->b_data; + ino = (ino - 1) % fs->e2fs->e2fs_ipg; + if (isclr(ibp, ino)) { + printf("ino = %llu, fs = %s\n", + (unsigned long long)ino, fs->e2fs_fsmnt); + if (fs->e2fs_ronly == 0) + panic("ifree: freeing free inode"); + } + clrbit(ibp, ino); + fs->e2fs->e2fs_ficount++; + gdp->ext2bgd_nifree++; + if ((mode & IFMT) == IFDIR) { + gdp->ext2bgd_ndirs--; + } + fs->e2fs_fmod = 1; + bdwrite(bp); return (0); }help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906292028.n5TKSkGK074482>
