Make exfat_flush() execution time more predictable.
int rc;
exfat_debug("[%s] %s", __func__, path);
+ rc = exfat_flush_nodes(&ef);
+ if (rc != 0)
+ return rc;
rc = exfat_flush(&ef);
if (rc != 0)
return rc;
return exfat_flush_node(ef, node);
}
-int exfat_flush(struct exfat* ef)
+int exfat_flush_nodes(struct exfat* ef)
{
- int rc = flush_nodes(ef, ef->root);
+ return flush_nodes(ef, ef->root);
+}
+int exfat_flush(struct exfat* ef)
+{
if (ef->cmap.dirty)
{
if (exfat_pwrite(ef->dev, ef->cmap.chunk,
ef->cmap.dirty = false;
}
- return rc;
+ return 0;
}
static bool set_next_cluster(const struct exfat* ef, bool contiguous,
const struct exfat_node* node, cluster_t cluster);
cluster_t exfat_advance_cluster(const struct exfat* ef,
struct exfat_node* node, uint32_t count);
+int exfat_flush_nodes(struct exfat* ef);
int exfat_flush(struct exfat* ef);
int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size,
bool erase);
void exfat_unmount(struct exfat* ef)
{
- exfat_flush(ef); /* ignore return code */
+ exfat_flush_nodes(ef); /* ignore return code */
+ exfat_flush(ef); /* ignore return code */
exfat_put_node(ef, ef->root);
exfat_reset_cache(ef);
free(ef->root);