diff options
author | Josef Bacik <josef@redhat.com> | 2010-11-17 20:46:17 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-12 20:16:43 -0500 |
commit | db47fef2cd9aab76ab976e8b45a06a1b3ad0e3e4 (patch) | |
tree | 6a1527c3a7ae8992714e0fcddd0da35b1e040eb5 /fs/ocfs2/file.c | |
parent | c25d246715b87ad37e69e7abd1a0fed781423fa2 (diff) |
Ocfs2: handle hole punching via fallocate properly
This patch just makes ocfs2 use its UNRESERVP ioctl when we get the hole punch
flag in fallocate. I didn't test it, but it seems simple enough. Thanks,
Acked-by: Jan Kara <jack@suse.cz>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index bdadbae09094..63e3fca266e0 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1995,6 +1995,7 @@ static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset, | |||
1995 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1995 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1996 | struct ocfs2_space_resv sr; | 1996 | struct ocfs2_space_resv sr; |
1997 | int change_size = 1; | 1997 | int change_size = 1; |
1998 | int cmd = OCFS2_IOC_RESVSP64; | ||
1998 | 1999 | ||
1999 | if (!ocfs2_writes_unwritten_extents(osb)) | 2000 | if (!ocfs2_writes_unwritten_extents(osb)) |
2000 | return -EOPNOTSUPP; | 2001 | return -EOPNOTSUPP; |
@@ -2005,12 +2006,15 @@ static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset, | |||
2005 | if (mode & FALLOC_FL_KEEP_SIZE) | 2006 | if (mode & FALLOC_FL_KEEP_SIZE) |
2006 | change_size = 0; | 2007 | change_size = 0; |
2007 | 2008 | ||
2009 | if (mode & FALLOC_FL_PUNCH_HOLE) | ||
2010 | cmd = OCFS2_IOC_UNRESVSP64; | ||
2011 | |||
2008 | sr.l_whence = 0; | 2012 | sr.l_whence = 0; |
2009 | sr.l_start = (s64)offset; | 2013 | sr.l_start = (s64)offset; |
2010 | sr.l_len = (s64)len; | 2014 | sr.l_len = (s64)len; |
2011 | 2015 | ||
2012 | return __ocfs2_change_file_space(NULL, inode, offset, | 2016 | return __ocfs2_change_file_space(NULL, inode, offset, cmd, &sr, |
2013 | OCFS2_IOC_RESVSP64, &sr, change_size); | 2017 | change_size); |
2014 | } | 2018 | } |
2015 | 2019 | ||
2016 | int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos, | 2020 | int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos, |