Renamed tailp -> ptail

This is mainly just to match pcache.

Which is where I would put ptail if these two didn't have annoyingly
different flush semantics.
This commit is contained in:
Christopher Haster
2025-02-13 02:48:48 -06:00
parent 19a23c7788
commit 2b3fdffe4c
2 changed files with 22 additions and 22 deletions
+19 -19
View File
@@ -701,24 +701,24 @@ static int lfsr_bd_set(lfs_t *lfs, lfs_block_t block, lfs_size_t off,
// lfsr_tailp_t stuff
// lfsr_ptail_t stuff
//
// tailp tracks the most recent trunk's parity so we can parity-check
// ptail tracks the most recent trunk's parity so we can parity-check
// if it hasn't been written to disk yet
#ifdef LFS_CKPARITY
#define LFSR_TAILP_PARITY 0x80000000
#define LFSR_PTAIL_PARITY 0x80000000
#endif
#ifdef LFS_CKPARITY
static inline bool lfsr_tailp_parity(const lfsr_tailp_t *tailp) {
return tailp->off & LFSR_TAILP_PARITY;
static inline bool lfsr_ptail_parity(const lfsr_ptail_t *ptail) {
return ptail->off & LFSR_PTAIL_PARITY;
}
#endif
#ifdef LFS_CKPARITY
static inline lfs_size_t lfsr_tailp_off(const lfsr_tailp_t *tailp) {
return tailp->off & ~LFSR_TAILP_PARITY;
static inline lfs_size_t lfsr_ptail_off(const lfsr_ptail_t *ptail) {
return ptail->off & ~LFSR_PTAIL_PARITY;
}
#endif
@@ -1526,14 +1526,14 @@ static lfs_ssize_t lfsr_bd_readtag(lfs_t *lfs,
//
// unless we're in the middle of building a commit, where things get
// tricky... to avoid problems with not-yet-written parity bits
// tailp tracks the most recent trunk's parity
// ptail tracks the most recent trunk's parity
//
// parity in in tailp?
// parity in in ptail?
bool parity;
if (block == lfs->tailp.block
&& off+d_ == lfsr_tailp_off(&lfs->tailp)) {
parity = lfsr_tailp_parity(&lfs->tailp);
if (block == lfs->ptail.block
&& off+d_ == lfsr_ptail_off(&lfs->ptail)) {
parity = lfsr_ptail_parity(&lfs->ptail);
// parity on disk?
} else {
@@ -3440,8 +3440,8 @@ static int lfsr_rbyd_appendtag(lfs_t *lfs, lfsr_rbyd_t *rbyd,
#ifdef LFS_CKPARITY
// keep track of most recent parity
lfs->tailp.block = rbyd->blocks[0];
lfs->tailp.off
lfs->ptail.block = rbyd->blocks[0];
lfs->ptail.off
= ((lfs_size_t)(
lfs_parity(rbyd->cksum) ^ lfsr_rbyd_isperturb(rbyd)
) << (8*sizeof(lfs_size_t)-1))
@@ -3648,8 +3648,8 @@ static int lfsr_rbyd_appendrattr_(lfs_t *lfs, lfsr_rbyd_t *rbyd,
#ifdef LFS_CKPARITY
// keep track of most recent parity
lfs->tailp.block = rbyd->blocks[0];
lfs->tailp.off
lfs->ptail.block = rbyd->blocks[0];
lfs->ptail.off
= ((lfs_size_t)(
lfs_parity(rbyd->cksum) ^ lfsr_rbyd_isperturb(rbyd)
) << (8*sizeof(lfs_size_t)-1))
@@ -13053,9 +13053,9 @@ static int lfs_init(lfs_t *lfs, uint32_t flags,
}
#ifdef LFS_CKPARITY
// setup tailp, nothing should actually check off=0
lfs->tailp.block = 0;
lfs->tailp.off = 0;
// setup ptail, nothing should actually check off=0
lfs->ptail.block = 0;
lfs->ptail.off = 0;
#endif
// setup lookahead buffer, note mount finishes initializing this after
+3 -3
View File
@@ -798,11 +798,11 @@ typedef struct lfsr_grm {
} lfsr_grm_t;
#ifdef LFS_CKPARITY
typedef struct lfsr_tailp {
typedef struct lfsr_ptail {
lfs_block_t block;
// sign(off) => tail parity
lfs_size_t off;
} lfsr_tailp_t;
} lfsr_ptail_t;
#endif
// The littlefs filesystem type
@@ -837,7 +837,7 @@ typedef struct lfs {
} pcache;
#ifdef LFS_CKPARITY
lfsr_tailp_t tailp;
lfsr_ptail_t ptail;
#endif
struct lfs_lookahead {