dedup

data deduplication program
git clone git://git.2f30.org/dedup.git
Log | Files | Refs | README | LICENSE

commit baf29fa2203239eb1767c97b48e093364c7c9f46
parent 00d03339c89087d34d11f3147daae28de6f94c7a
Author: sin <sin@2f30.org>
Date:   Thu, 25 Apr 2019 22:46:18 +0100

Add some comments to bsrm()

Diffstat:
Mbstorage.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/bstorage.c b/bstorage.c @@ -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) { @@ -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);