PERFORCE change 165599 for review

Aditya Sarawgi truncs at FreeBSD.org
Sat Jul 4 17:38:55 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165599

Change 165599 by truncs at aditya on 2009/07/04 17:38:31

	This function make no sense since preallocation is removed.

Affected files ...

.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#27 edit

Differences ...

==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#27 (text+ko) ====

@@ -62,41 +62,37 @@
 static daddr_t  ext2_mapsearch(struct m_ext2fs *, char *, daddr_t);
 
 /*
- * Linux calls this functions at the following locations:
- * (1) the inode is freed
- * (2) a preallocation miss occurs
- * (3) truncate is called
- * (4) release_file is called and f_mode & 2
- *
- * I call it in ext2_inactive, ext2_truncate, ext2_vfree and in (2)
- * the call in vfree might be redundant
- */
-void
-ext2_discard_prealloc(ip)
-	struct inode * ip;
-{
-#ifdef EXT2_PREALLOCATE
-        if (ip->i_prealloc_count) {
-                int i = ip->i_prealloc_count;
-                ip->i_prealloc_count = 0;
-                ext2_free_blocks (ITOV(ip)->v_mount,
-                                  ip->i_prealloc_block,
-                                  i);
-        }
-#endif
-}
-
-/*
  * Allocate a block in the file system.
- * 
- * this takes the framework from ffs_alloc. To implement the
- * actual allocation, it calls ext2_new_block, the ported version
- * of the same Linux routine.
  *
- * we note that this is always called in connection with ext2_blkpref
+ * A preference may be optionally specified. If a preference is given
+ * the following hierarchy is used to allocate a block:
+ *   1) allocate the requested block.
+ *   2) allocate a rotationally optimal block in the same cylinder.
+ *   3) allocate a block in the same cylinder group.
+ *   4) quadradically rehash into other cylinder groups, until an
+ *        available block is located.
+ * If no block preference is given the following hierarchy is used
+ * to allocate a block:
+ *   1) allocate a block in the cylinder group that contains the
+ *        inode for the file.
+ *   2) quadradically rehash into other cylinder groups, until an
+ *        available block is located.
  *
- * preallocation is done as Linux does it
+ * A preference may be optionally specified. If a preference is given
+ * the following hierarchy is used to allocate a block:
+ *   1) allocate the requested block.
+ *   2) allocate a rotationally optimal block in the same cylinder.
+ *   3) allocate a block in the same cylinder group.
+ *   4) quadradically rehash into other cylinder groups, until an
+ *        available block is located.
+ * If no block preference is given the following hierarchy is used
+ * to allocate a block:
+ *   1) allocate a block in the cylinder group that contains the
+ *        inode for the file.
+ *   2) quadradically rehash into other cylinder groups, until an
+ *        available block is located.
  */
+
 int
 ext2_alloc(ip, lbn, bpref, size, cred, bnp)
 	struct inode *ip;
@@ -495,7 +491,6 @@
 
 /* ext2_debug("ext2_vfree (%d, %d) called\n", pip->i_number, mode);
  */
-	ext2_discard_prealloc(pip);
 
 	/* we need to make sure that ext2_free_inode can adjust the
 	   used_dir_counts in the group summary information - I'd


More information about the p4-projects mailing list