o When pre-allocating attribute storage space, also allocate space for
attribute instance headers, or higher inode numbers will require additional disk blocks to be allocated later. Obtained from: TrustedBSD Project
This commit is contained in:
parent
e11a1ee870
commit
6af9621841
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=65589
@ -82,7 +82,7 @@ initattr(int argc, char *argv[])
|
|||||||
char *fs_path = NULL;
|
char *fs_path = NULL;
|
||||||
char *zero_buf = NULL;
|
char *zero_buf = NULL;
|
||||||
long loop, num_inodes;
|
long loop, num_inodes;
|
||||||
int ch, i, error;
|
int ch, i, error, chunksize;
|
||||||
|
|
||||||
optind = 0;
|
optind = 0;
|
||||||
while ((ch = getopt(argc, argv, "p:r:w:")) != -1)
|
while ((ch = getopt(argc, argv, "p:r:w:")) != -1)
|
||||||
@ -117,9 +117,11 @@ initattr(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
memset(zero_buf, 0, uef.uef_size);
|
memset(zero_buf, 0, uef.uef_size);
|
||||||
num_inodes = num_inodes_by_path(fs_path);
|
num_inodes = num_inodes_by_path(fs_path);
|
||||||
|
chunksize = sizeof(struct ufs_extattr_header) +
|
||||||
|
uef.uef_size;
|
||||||
for (loop = 0; loop < num_inodes; loop++) {
|
for (loop = 0; loop < num_inodes; loop++) {
|
||||||
error = write(i, zero_buf, uef.uef_size);
|
error = write(i, zero_buf, chunksize);
|
||||||
if (error != uef.uef_size) {
|
if (error != chunksize) {
|
||||||
perror("write");
|
perror("write");
|
||||||
unlink(argv[1]);
|
unlink(argv[1]);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user