linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Hole Punching V2
@ 2010-11-15 17:05 Josef Bacik
  2010-11-15 17:05 ` [PATCH 1/6] fs: add hole punching to fallocate Josef Bacik
                   ` (5 more replies)
  0 siblings, 6 replies; 33+ messages in thread
From: Josef Bacik @ 2010-11-15 17:05 UTC (permalink / raw)
  To: david, linux-kernel, linux-btrfs, linux-ext4, linux-fsdevel, xfs,
	cmm, cluster-devel, ocfs2-devel

This is version 2 of the hole punching series I posted last week.  The following
things have changed

-Hole punching doesn't change file size
-Fixed the mode checks in ext4/btrfs/gfs2 so they do what they are supposed to

I posted updates to xfstests and xfsprogs in order to test this new interface,
and ran the test on xfs to make sure hole punching worked properly for xfs and I
tested it on btrfs to make sure it failed properly.  This series also adds
support for doing hole punching to ocfs2, but I did not test this part of it,
albiet it's an obvious fix so it should work fine.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 33+ messages in thread
* Hole Punching V3
@ 2010-11-18  1:46 Josef Bacik
  2010-11-18  1:46 ` [PATCH 6/6] Gfs2: fail if we try to use hole punch Josef Bacik
  0 siblings, 1 reply; 33+ messages in thread
From: Josef Bacik @ 2010-11-18  1:46 UTC (permalink / raw)
  To: david, linux-kernel, linux-btrfs, linux-ext4, linux-fsdevel, xfs,
	cmm, cluster-devel, joel.becker, jack

This is version 3 of the hole punching series I've been posting.  Not much has
changed, the history is below

V2->V3
-FALLOC_FL_PUNCH_HOLE must also have FALLOC_FL_KEEP_SIZE in order to work
-formatting fixes

V1->V2
-Hole punching doesn't change file size
-Fixed the mode checks in ext4/btrfs/gfs2 so they do what they are supposed to

I've updated my local copies of the xfsprogs patches I have to test this to use
KEEP_SIZE and PUNCH_HOLE together, I'll post them after it looks like these
patches are good to go, including the manpage update.  The xfstest I wrote ran
fine both on xfs and btrfs (failing on btrfs obviously).  Thanks,

Josef

^ permalink raw reply	[flat|nested] 33+ messages in thread
* [PATCH 1/6] fs: add hole punching to fallocate
@ 2010-11-08 20:32 Josef Bacik
  2010-11-08 20:32 ` [PATCH 6/6] Gfs2: fail if we try to use hole punch Josef Bacik
  0 siblings, 1 reply; 33+ messages in thread
From: Josef Bacik @ 2010-11-08 20:32 UTC (permalink / raw)
  To: linux-kernel, linux-btrfs, linux-ext4, linux-fsdevel, xfs,
	joel.becker, cmm, cluster-devel

Hole punching has already been implemented by XFS and OCFS2, and has the
potential to be implemented on both BTRFS and EXT4 so we need a generic way to
get to this feature.  The simplest way in my mind is to add FALLOC_FL_PUNCH_HOLE
to fallocate() since it already looks like the normal fallocate() operation.
I've tested this patch with XFS and BTRFS to make sure XFS did what it's
supposed to do and that BTRFS failed like it was supposed to.  Thank you,

Signed-off-by: Josef Bacik <josef@redhat.com>
---
 fs/open.c              |    2 +-
 include/linux/falloc.h |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index 4197b9e..ab8dedf 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -223,7 +223,7 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EINVAL;
 
 	/* Return error if mode is not supported */
-	if (mode && !(mode & FALLOC_FL_KEEP_SIZE))
+	if (mode && (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)))
 		return -EOPNOTSUPP;
 
 	if (!(file->f_mode & FMODE_WRITE))
diff --git a/include/linux/falloc.h b/include/linux/falloc.h
index 3c15510..851cba2 100644
--- a/include/linux/falloc.h
+++ b/include/linux/falloc.h
@@ -2,6 +2,7 @@
 #define _FALLOC_H_
 
 #define FALLOC_FL_KEEP_SIZE	0x01 /* default is extend size */
+#define FALLOC_FL_PUNCH_HOLE	0X02 /* de-allocates range */
 
 #ifdef __KERNEL__
 
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2010-11-18  1:57 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-15 17:05 Hole Punching V2 Josef Bacik
2010-11-15 17:05 ` [PATCH 1/6] fs: add hole punching to fallocate Josef Bacik
2010-11-16 11:16   ` Jan Kara
2010-11-16 11:43     ` Jan Kara
2010-11-16 12:52       ` Josef Bacik
2010-11-16 13:14         ` Jan Kara
2010-11-17  0:22           ` Andreas Dilger
2010-11-17  2:11             ` Dave Chinner
2010-11-17  2:28               ` Josef Bacik
2010-11-17  2:34                 ` Josef Bacik
2010-11-17  9:30                   ` Andreas Dilger
2010-11-17  9:19               ` Andreas Dilger
2010-11-16 12:53     ` Josef Bacik
2010-11-15 17:05 ` [PATCH 2/6] XFS: handle hole punching via fallocate properly Josef Bacik
2010-11-15 17:05 ` [PATCH 3/6] Ocfs2: " Josef Bacik
2010-11-16 11:50   ` Jan Kara
2010-11-17 23:27   ` Joel Becker
2010-11-15 17:05 ` [PATCH 4/6] Ext4: fail if we try to use hole punch Josef Bacik
2010-11-16 11:52   ` Jan Kara
2010-11-16 12:25   ` Avi Kivity
2010-11-16 12:50     ` Josef Bacik
2010-11-16 13:07       ` Avi Kivity
2010-11-16 16:05         ` Josef Bacik
2010-11-16 20:47           ` Greg Freemyer
2010-11-17  3:06         ` Ted Ts'o
2010-11-17  6:31           ` Josef Bacik
2010-11-16 16:20   ` Pádraig Brady
2010-11-16 16:33     ` Josef Bacik
2010-11-16 16:56       ` Pádraig Brady
2010-11-15 17:05 ` [PATCH 5/6] Btrfs: " Josef Bacik
2010-11-15 17:05 ` [PATCH 6/6] Gfs2: " Josef Bacik
  -- strict thread matches above, loose matches on Subject: below --
2010-11-18  1:46 Hole Punching V3 Josef Bacik
2010-11-18  1:46 ` [PATCH 6/6] Gfs2: fail if we try to use hole punch Josef Bacik
2010-11-08 20:32 [PATCH 1/6] fs: add hole punching to fallocate Josef Bacik
2010-11-08 20:32 ` [PATCH 6/6] Gfs2: fail if we try to use hole punch Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).