Page MenuHomeFreeBSD

D35132.diff
No OneTemporary

D35132.diff

Index: usr.sbin/makefs/ffs.c
===================================================================
--- usr.sbin/makefs/ffs.c
+++ usr.sbin/makefs/ffs.c
@@ -623,12 +623,19 @@
e, tmpdir.d_namlen, this, curdirsize); \
} while (0);
- /*
- * XXX this needs to take into account extra space consumed
- * by indirect blocks, etc.
- */
#define ADDSIZE(x) do { \
- fsopts->size += roundup((x), ffs_opts->fsize); \
+ if ((size_t)(x) < UFS_NDADDR * (size_t)ffs_opts->bsize) { \
+ fsopts->size += roundup((x), ffs_opts->fsize); \
+ } else { \
+ /* Count space consumed by indirecttion blocks. */ \
+ fsopts->size += ffs_opts->bsize * \
+ (howmany((x), UFS_NDADDR * ffs_opts->bsize) - 1); \
+ /* \
+ * If the file is big enough to use indirect blocks, \
+ * we allocate bsize block for trailing data. \
+ */ \
+ fsopts->size += roundup((x), ffs_opts->bsize); \
+ } \
} while (0);
curdirsize = 0;

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 23, 8:11 AM (4 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16790974
Default Alt Text
D35132.diff (954 B)

Event Timeline