[Midnightbsd-cvs] src [7800] trunk/sys/fs/ext2fs/ext2_alloc.c: ext2fs fix
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Sep 5 15:37:01 EDT 2016
Revision: 7800
http://svnweb.midnightbsd.org/src/?rev=7800
Author: laffer1
Date: 2016-09-05 15:36:58 -0400 (Mon, 05 Sep 2016)
Log Message:
-----------
ext2fs fix
While a file is first being written, the dynamic block reallocation realocates t
he file's blocks so as to cluster them together into a contiguous set of blocks
on the disk.
When the cluster crosses the boundary into the first indirect block, the first i
ndirect block is initially allocated in a position immediately following the las
t direct block. Block reallocation would usually destroy locality by moving the
indirect block of the way to keep the data blocks contiguous.
Obtained from: FreeBSD svn 243913
Modified Paths:
--------------
trunk/sys/fs/ext2fs/ext2_alloc.c
Property Changed:
----------------
trunk/sys/fs/ext2fs/ext2_alloc.c
Modified: trunk/sys/fs/ext2fs/ext2_alloc.c
===================================================================
--- trunk/sys/fs/ext2fs/ext2_alloc.c 2016-09-05 19:33:01 UTC (rev 7799)
+++ trunk/sys/fs/ext2fs/ext2_alloc.c 2016-09-05 19:36:58 UTC (rev 7800)
@@ -197,6 +197,18 @@
panic("ext2_reallocblks: non-cluster");
#endif
/*
+ * If the cluster crosses the boundary for the first indirect
+ * block, leave space for the indirect block. Indirect blocks
+ * are initially laid out in a position after the last direct
+ * block. Block reallocation would usually destroy locality by
+ * moving the indirect block out of the way to make room for
+ * data blocks if we didn't compensate here. We should also do
+ * this for other indirect block boundaries, but it is only
+ * important for the first one.
+ */
+ if (start_lbn < NDADDR && end_lbn >= NDADDR)
+ return (ENOSPC);
+ /*
* If the latest allocation is in a new cylinder group, assume that
* the filesystem has decided to move and do not force it back to
* the previous cylinder group.
Property changes on: trunk/sys/fs/ext2fs/ext2_alloc.c
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.2
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list