aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-04-11 07:56:09 -0400
committerJens Axboe <axboe@suse.de>2006-04-11 07:56:09 -0400
commit49570e9b29a3d78950b5eba6b73bdcca955f0877 (patch)
tree65ffdeb8062824b3370abbca5572782f440501e8
parent6f767b0425f5902e4817648632230b512e81c963 (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>
-rw-r--r--fs/read_write.c2
-rw-r--r--fs/splice.c15
2 files changed, 8 insertions, 9 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 6256ca81a718..5bc0e9234f9d 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -202,7 +202,7 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count
202 goto Einval; 202 goto Einval;
203 203
204 inode = file->f_dentry->d_inode; 204 inode = file->f_dentry->d_inode;
205 if (inode->i_flock && MANDATORY_LOCK(inode)) { 205 if (unlikely(inode->i_flock && MANDATORY_LOCK(inode))) {
206 int retval = locks_mandatory_area( 206 int retval = locks_mandatory_area(
207 read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, 207 read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE,
208 inode, file, pos, count); 208 inode, file, pos, count);
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 */
351ssize_t generic_file_splice_read(struct file *in, struct pipe_inode_info *pipe, 350ssize_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;