From 8499f4cfb29f84adccf78c537f30c2d0b80f9182 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Fri, 28 Jul 2023 16:48:26 -0500 Subject: [PATCH] Removed TODOs around implicitly adjusting grm in mdir commit There was an idea of making the necessary mid/rid adjustments to grm in lfsr_mdir_commt implicitly. Explored this, but: 1. It looked like the result would increase code size, though only by a small (~12 byte) amount. 2. It wouldn't actually work, because lfr_mkdir needs to create a grm for an mid/rid that doesn't actually exist at the time of commit. Such a grm can't be created and survive any implicit mid/rid adjustment. So scratching that idea for now. --- lfs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lfs.c b/lfs.c index dcbc43b1..6f4d6609 100644 --- a/lfs.c +++ b/lfs.c @@ -7574,7 +7574,6 @@ int lfsr_remove(lfs_t *lfs, const char *path) { // create a grm to remove the dstart entry lfsr_grm_pushrm(&grm, dstart_mdir.mid, dstart_rid); - // TODO should we just make this an atomic remove? // adjust rid if grm is on the same mdir as our dir if (grm.rms[0].mid == mdir.mid && (lfs_ssize_t)grm.rms[0].rid > rid) { @@ -7639,7 +7638,6 @@ int lfsr_rename(lfs_t *lfs, const char *old_path, const char *new_path) { return LFS_ERR_NAMETOOLONG; } - // TODO should we just make this an atomic rename? // adjust old rid if grm is on the same mdir as new rid if (grm.rms[0].mid == new_mdir.mid && (lfs_ssize_t)grm.rms[0].rid >= new_rid) { @@ -7972,7 +7970,6 @@ static int lfsr_fs_fixgrm(lfs_t *lfs) { lfsr_grm_t grm = lfs->grm; lfsr_grm_poprm(&grm); - // TODO should this just be implicit in lfsr_mdir_commit? compare cost? // make sure to adjust any remaining grms if (grm.rms[0].mid == lfs->grm.rms[0].mid && grm.rms[0].rid >= lfs->grm.rms[0].rid) {