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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user