Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hammer: osd: filestore: FALLOC_FL_PUNCH_HOLE must be used with FALLOC_FL_KEEP_SIZE #13041

Merged
merged 1 commit into from Jan 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/os/FileStore.cc
Expand Up @@ -3076,6 +3076,7 @@ int FileStore::_zero(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t

#ifdef CEPH_HAVE_FALLOCATE
# if !defined(DARWIN) && !defined(__FreeBSD__)
# ifdef FALLOC_FL_KEEP_SIZE
// first try to punch a hole.
FDRef fd;
ret = lfn_open(cid, oid, false, &fd);
Expand All @@ -3084,7 +3085,7 @@ int FileStore::_zero(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t
}

// first try fallocate
ret = fallocate(**fd, FALLOC_FL_PUNCH_HOLE, offset, len);
ret = fallocate(**fd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, offset, len);
if (ret < 0)
ret = -errno;
lfn_close(fd);
Expand All @@ -3098,6 +3099,7 @@ int FileStore::_zero(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t
goto out; // yay!
if (ret != -EOPNOTSUPP)
goto out; // some other error
# endif
# endif
#endif

Expand Down