PERFORCE change 169687 for review

Aditya Sarawgi truncs at FreeBSD.org
Thu Oct 22 17:47:45 UTC 2009


http://p4web.freebsd.org/chv.cgi?CH=169687

Change 169687 by truncs at aditya on 2009/10/22 17:47:39

	Remove i_reclen field from in-memory inode this avoids writing to 'i_reclen'
	while holding a shared vnode lock.

Affected files ...

.. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_lookup.c#8 edit
.. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/inode.h#4 edit

Differences ...

==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_lookup.c#8 (text+ko) ====

@@ -459,7 +459,6 @@
 				 * directory buffer.
 				 */
 				ino = ep->e2d_ino;
-				dp->i_reclen = ep->e2d_reclen;
 				goto found;
 			}
 		}
@@ -898,7 +897,7 @@
 	struct componentname *cnp;
 {
 	struct inode *dp;
-	struct ext2fs_direct_2 *ep;
+	struct ext2fs_direct_2 *ep, *rep;
 	struct buf *bp;
 	int error;
 
@@ -922,7 +921,13 @@
 	if ((error = ext2_blkatoff(dvp, (off_t)(dp->i_offset - dp->i_count),
 	    (char **)&ep, &bp)) != 0)
 		return (error);
-	ep->e2d_reclen += dp->i_reclen;
+
+	/* Set 'rep' to the entry being removed. */
+	if (dp->i_count == 0)
+		rep = ep;
+	else
+		rep = (struct ext2fs_direct_2 *)((char *)ep + ep->e2d_reclen);
+	ep->e2d_reclen += rep->e2d_reclen;
 	error = bwrite(bp);
 	dp->i_flag |= IN_CHANGE | IN_UPDATE;
 	return (error);

==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/inode.h#4 (text+ko) ====

@@ -75,7 +75,6 @@
 	doff_t	  i_endoff;	/* End of useful stuff in directory. */
 	doff_t	  i_diroff;	/* Offset in dir, where we found last entry. */
 	doff_t	  i_offset;	/* Offset of free space in directory. */
-	u_int32_t i_reclen;	/* Size of found directory entry. */
 
 	u_int32_t i_block_group;
 	u_int32_t i_next_alloc_block;


More information about the p4-projects mailing list