diff options
author | Jens Axboe <axboe@suse.de> | 2006-04-11 07:56:09 -0400 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2006-04-11 07:56:09 -0400 |
commit | 49570e9b29a3d78950b5eba6b73bdcca955f0877 (patch) | |
tree | 65ffdeb8062824b3370abbca5572782f440501e8 /fs/splice.c | |
parent | 6f767b0425f5902e4817648632230b512e81c963 (diff) |
[PATCH] splice: unlikely() optimizations
Also corrects a few comments. Patch mainly from Ingo, changes by me.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/splice.c b/fs/splice.c index 36bc262dfbd5..77b026baff7d 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -346,7 +346,6 @@ fill_it: | |||
346 | * @flags: splice modifier flags | 346 | * @flags: splice modifier flags |
347 | * | 347 | * |
348 | * Will read pages from given file and fill them into a pipe. | 348 | * Will read pages from given file and fill them into a pipe. |
349 | * | ||
350 | */ | 349 | */ |
351 | ssize_t generic_file_splice_read(struct file *in, struct pipe_inode_info *pipe, | 350 | ssize_t generic_file_splice_read(struct file *in, struct pipe_inode_info *pipe, |
352 | size_t len, unsigned int flags) | 351 | size_t len, unsigned int flags) |
@@ -690,7 +689,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
690 | 689 | ||
691 | mutex_lock(&inode->i_mutex); | 690 | mutex_lock(&inode->i_mutex); |
692 | err = generic_osync_inode(mapping->host, mapping, | 691 | err = generic_osync_inode(mapping->host, mapping, |
693 | OSYNC_METADATA|OSYNC_DATA); | 692 | OSYNC_METADATA|OSYNC_DATA); |
694 | mutex_unlock(&inode->i_mutex); | 693 | mutex_unlock(&inode->i_mutex); |
695 | 694 | ||
696 | if (err) | 695 | if (err) |
@@ -730,10 +729,10 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, | |||
730 | loff_t pos; | 729 | loff_t pos; |
731 | int ret; | 730 | int ret; |
732 | 731 | ||
733 | if (!out->f_op || !out->f_op->splice_write) | 732 | if (unlikely(!out->f_op || !out->f_op->splice_write)) |
734 | return -EINVAL; | 733 | return -EINVAL; |
735 | 734 | ||
736 | if (!(out->f_mode & FMODE_WRITE)) | 735 | if (unlikely(!(out->f_mode & FMODE_WRITE))) |
737 | return -EBADF; | 736 | return -EBADF; |
738 | 737 | ||
739 | pos = out->f_pos; | 738 | pos = out->f_pos; |
@@ -754,10 +753,10 @@ static long do_splice_to(struct file *in, struct pipe_inode_info *pipe, | |||
754 | loff_t pos, isize, left; | 753 | loff_t pos, isize, left; |
755 | int ret; | 754 | int ret; |
756 | 755 | ||
757 | if (!in->f_op || !in->f_op->splice_read) | 756 | if (unlikely(!in->f_op || !in->f_op->splice_read)) |
758 | return -EINVAL; | 757 | return -EINVAL; |
759 | 758 | ||
760 | if (!(in->f_mode & FMODE_READ)) | 759 | if (unlikely(!(in->f_mode & FMODE_READ))) |
761 | return -EBADF; | 760 | return -EBADF; |
762 | 761 | ||
763 | pos = in->f_pos; | 762 | pos = in->f_pos; |
@@ -771,7 +770,7 @@ static long do_splice_to(struct file *in, struct pipe_inode_info *pipe, | |||
771 | return 0; | 770 | return 0; |
772 | 771 | ||
773 | left = isize - in->f_pos; | 772 | left = isize - in->f_pos; |
774 | if (left < len) | 773 | if (unlikely(left < len)) |
775 | len = left; | 774 | len = left; |
776 | 775 | ||
777 | return in->f_op->splice_read(in, pipe, len, flags); | 776 | return in->f_op->splice_read(in, pipe, len, flags); |
@@ -799,7 +798,7 @@ long do_splice_direct(struct file *in, struct file *out, size_t len, | |||
799 | * 'out' and transfer the wanted data from 'in' to 'out' through that | 798 | * 'out' and transfer the wanted data from 'in' to 'out' through that |
800 | */ | 799 | */ |
801 | pipe = current->splice_pipe; | 800 | pipe = current->splice_pipe; |
802 | if (!pipe) { | 801 | if (unlikely(!pipe)) { |
803 | pipe = alloc_pipe_info(NULL); | 802 | pipe = alloc_pipe_info(NULL); |
804 | if (!pipe) | 803 | if (!pipe) |
805 | return -ENOMEM; | 804 | return -ENOMEM; |