summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-09-22 23:45:28 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-09-22 23:45:28 +0200
commit1cb18e1e0de4873f98c58e23e1ed133c3914272f (patch)
treeb9fe3af5854b2d82484116302ae6eb868ded864a /ext2fs
parent015d12aaa7a63dbec0ba2230298caa7b5d802c2b (diff)
Avoid waiting for disk I/O completion
This improves performance quite a bit, and is not less safe. * ext2fs/dir.c (diskfs_direnter_hard, diskfs_dirremove_hard, diskfs_dirrewrite_hard): Pass diskfs_synchronous instead of 1 as wait parameter to diskfs_file_update. * ext2fs/truncate.c (diskfs_truncate): Likewise. * libdiskfs/dir-init.c (diskfs_init_dir): Likewise. * libdiskfs/dir-link.c (diskfs_S_dir_link): Likewise. * libdiskfs/dir-rename.c (diskfs_S_dir_rename): Likewise. * libdiskfs/dir-renamed.c (diskfs_rename_dir): Likewise. * libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): Likewise. * libdiskfs/node-create.c (diskfs_create_node): Likewise. * libdiskfs/node-drop.c (diskfs_drop_node): Likewise.
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/dir.c6
-rw-r--r--ext2fs/truncate.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index d70dbf32..714c1b7c 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -690,7 +690,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
}
}
- diskfs_file_update (dp, 1);
+ diskfs_file_update (dp, diskfs_synchronous);
return 0;
}
@@ -727,7 +727,7 @@ diskfs_dirremove_hard (struct node *dp, struct dirstat *ds)
if (dp->dn->dirents && dp->dn->dirents[ds->idx] != -1)
dp->dn->dirents[ds->idx]--;
- diskfs_file_update (dp, 1);
+ diskfs_file_update (dp, diskfs_synchronous);
return 0;
}
@@ -753,7 +753,7 @@ diskfs_dirrewrite_hard (struct node *dp, struct node *np, struct dirstat *ds)
munmap ((caddr_t) ds->mapbuf, ds->mapextent);
- diskfs_file_update (dp, 1);
+ diskfs_file_update (dp, diskfs_synchronous);
return 0;
}
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
index 077225b0..2058a1c1 100644
--- a/ext2fs/truncate.c
+++ b/ext2fs/truncate.c
@@ -294,7 +294,7 @@ diskfs_truncate (struct node *node, off_t length)
node->dn_stat.st_size = length;
node->dn_set_mtime = 1;
node->dn_set_ctime = 1;
- diskfs_node_update (node, 1);
+ diskfs_node_update (node, diskfs_synchronous);
return 0;
}
@@ -309,6 +309,7 @@ diskfs_truncate (struct node *node, off_t length)
{
diskfs_node_rdwr (node, (void *)zeroblock, length, block_size - offset,
1, 0, 0);
+ /* Make sure that really happens to avoid leaks. */
diskfs_file_update (node, 1);
}
@@ -323,7 +324,7 @@ diskfs_truncate (struct node *node, off_t length)
node->dn_stat.st_size = length;
node->dn_set_mtime = 1;
node->dn_set_ctime = 1;
- diskfs_node_update (node, 1);
+ diskfs_node_update (node, diskfs_synchronous);
err = diskfs_catch_exception ();
if (!err)