Message ID | 20160215204621.7977.91236.stgit@birch.djwong.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/src/punch-alternating.c b/src/punch-alternating.c index 9566310..4148622 100644 --- a/src/punch-alternating.c +++ b/src/punch-alternating.c @@ -14,6 +14,7 @@ int main(int argc, char *argv[]) { struct stat s; + struct statfs sf; off_t offset; int fd; blksize_t blksz; @@ -35,8 +36,12 @@ int main(int argc, char *argv[]) if (error) goto err; + error = fstatfs(fd, &sf); + if (error) + goto err; + sz = s.st_size; - blksz = s.st_blksize; + blksz = sf.f_bsize; mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; for (offset = 0; offset < sz; offset += blksz * 2) {
When we're trying to punch alternating blocks out of a file, use the bsize reported by fstatfs so that we can punch out single blocks. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- src/punch-alternating.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html