tAdd some comments to bsrm() - dedup - deduplicating backup program
(HTM) git clone git://git.z3bra.org/dedup.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit baf29fa2203239eb1767c97b48e093364c7c9f46
(DIR) parent 00d03339c89087d34d11f3147daae28de6f94c7a
(HTM) Author: sin <sin@2f30.org>
Date: Thu, 25 Apr 2019 22:46:18 +0100
Add some comments to bsrm()
Diffstat:
M bstorage.c | 6 ++++++
1 file changed, 6 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/bstorage.c b/bstorage.c
t@@ -538,6 +538,7 @@ bsget(struct bctx *bctx, unsigned char *md, void *buf, size_t *n)
return 0;
}
+/* Remove a block with the given hash */
static int
bsrm(struct bctx *bctx, unsigned char *md)
{
t@@ -568,6 +569,11 @@ bsrm(struct bctx *bctx, unsigned char *md)
mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
if (fallocate(sctx->fd, mode, bd->offset, bd->size) < 0) {
+ /*
+ * Filesystem does not support hole punching.
+ * Try to recover the block descriptor so we don't
+ * lose track of the block.
+ */
lseek(sctx->fd, bdoffs, SEEK_SET);
bd->refcnt++;
packbd(sctx->fd, bd);