2006-10-30 16:31:46

by Daniel Drake

[permalink] [raw]
Subject: [PATCH] jfs: Add splice support

This allows the splice() and tee() syscalls to be used with JFS.

Signed-off-by: Daniel Drake <[email protected]>

Index: linux-2.6.19-rc3/fs/jfs/file.c
===================================================================
--- linux-2.6.19-rc3.orig/fs/jfs/file.c
+++ linux-2.6.19-rc3/fs/jfs/file.c
@@ -109,6 +109,8 @@ const struct file_operations jfs_file_op
.aio_write = generic_file_aio_write,
.mmap = generic_file_mmap,
.sendfile = generic_file_sendfile,
+ .splice_read = generic_file_splice_read,
+ .splice_write = generic_file_splice_write,
.fsync = jfs_fsync,
.release = jfs_release,
.ioctl = jfs_ioctl,


2006-10-30 17:03:32

by Dave Kleikamp

[permalink] [raw]
Subject: Re: [PATCH] jfs: Add splice support

On Mon, 2006-10-30 at 16:31 +0000, Daniel Drake wrote:
> This allows the splice() and tee() syscalls to be used with JFS.

Gosh, that was easy. Why couldn't I do that? :-)

Answer: I would have had to test it.

I'm assuming you did?

Thanks,
Shaggy

> Signed-off-by: Daniel Drake <[email protected]>
>
> Index: linux-2.6.19-rc3/fs/jfs/file.c
> ===================================================================
> --- linux-2.6.19-rc3.orig/fs/jfs/file.c
> +++ linux-2.6.19-rc3/fs/jfs/file.c
> @@ -109,6 +109,8 @@ const struct file_operations jfs_file_op
> .aio_write = generic_file_aio_write,
> .mmap = generic_file_mmap,
> .sendfile = generic_file_sendfile,
> + .splice_read = generic_file_splice_read,
> + .splice_write = generic_file_splice_write,
> .fsync = jfs_fsync,
> .release = jfs_release,
> .ioctl = jfs_ioctl,
--
David Kleikamp
IBM Linux Technology Center

2006-10-30 17:34:45

by Daniel Drake

[permalink] [raw]
Subject: Re: [PATCH] jfs: Add splice support

On Mon, 2006-10-30 at 10:56 -0600, Dave Kleikamp wrote:
> On Mon, 2006-10-30 at 16:31 +0000, Daniel Drake wrote:
> > This allows the splice() and tee() syscalls to be used with JFS.
>
> Gosh, that was easy. Why couldn't I do that? :-)
>
> Answer: I would have had to test it.
>
> I'm assuming you did?

Yep:

Created a 100mb file from /dev/urandom on an ext3 partition
Used splice-cp to copy it onto a JFS partition
Used splice-cp to copy it from that JFS partition onto another JFS
partition

I checked md5sums at all stages, seems to work fine.

Thanks!
Daniel


2006-10-30 17:49:55

by Dave Kleikamp

[permalink] [raw]
Subject: Re: [PATCH] jfs: Add splice support

On Mon, 2006-10-30 at 12:29 -0500, Daniel Drake wrote:
> > Answer: I would have had to test it.
> >
> > I'm assuming you did?
>
> Yep:
>
> Created a 100mb file from /dev/urandom on an ext3 partition
> Used splice-cp to copy it onto a JFS partition
> Used splice-cp to copy it from that JFS partition onto another JFS
> partition
>
> I checked md5sums at all stages, seems to work fine.

Great. I added it to the jfs git tree.

Shaggy

>
> Thanks!
> Daniel
>
>
--
David Kleikamp
IBM Linux Technology Center

2006-10-31 08:35:45

by Jan Engelhardt

[permalink] [raw]
Subject: Re: [PATCH] jfs: Add splice support


>> This allows the splice() and tee() syscalls to be used with JFS.
>
>Gosh, that was easy. Why couldn't I do that? :-)

You could add it to all the other filesystems that lack it. (Cautionary
question: Does that work at an instant like it did with jfs?)

Seems like only ext[234] gfs2 reiserfs and xfs have splice_read
currently.


-`J'
--

2006-10-31 08:44:23

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] jfs: Add splice support

On Tue, Oct 31 2006, Jan Engelhardt wrote:
>
> >> This allows the splice() and tee() syscalls to be used with JFS.
> >
> >Gosh, that was easy. Why couldn't I do that? :-)
>
> You could add it to all the other filesystems that lack it. (Cautionary
> question: Does that work at an instant like it did with jfs?)
>
> Seems like only ext[234] gfs2 reiserfs and xfs have splice_read
> currently.

If the file system uses the generic page cache functions for reading and
writing, it should be able to use the generic splice read/write
functions as well. If it doesn't, then more work is likely involved. In
short, check the .read/.write and .aio_read/.aio_write parts of the
file_operations[] structure. jfs uses the generic handlers, hence splice
support should just be the two-liner posted.

--
Jens Axboe