Commit 98de8e91 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] switch over loop.c to ->sendfile

last direct call into fs code is gone
parent 5e3e6a25
...@@ -303,22 +303,22 @@ do_lo_receive(struct loop_device *lo, ...@@ -303,22 +303,22 @@ do_lo_receive(struct loop_device *lo,
struct bio_vec *bvec, int bsize, loff_t pos) struct bio_vec *bvec, int bsize, loff_t pos)
{ {
struct lo_read_data cookie; struct lo_read_data cookie;
read_descriptor_t desc;
struct file *file; struct file *file;
int error;
cookie.lo = lo; cookie.lo = lo;
cookie.data = kmap(bvec->bv_page) + bvec->bv_offset; cookie.data = kmap(bvec->bv_page) + bvec->bv_offset;
cookie.bsize = bsize; cookie.bsize = bsize;
desc.written = 0;
desc.count = bvec->bv_len; /* umm, what does this lock actually try to protect? */
desc.buf = (char*)&cookie;
desc.error = 0;
spin_lock_irq(&lo->lo_lock); spin_lock_irq(&lo->lo_lock);
file = lo->lo_backing_file; file = lo->lo_backing_file;
spin_unlock_irq(&lo->lo_lock); spin_unlock_irq(&lo->lo_lock);
do_generic_file_read(file, &pos, &desc, lo_read_actor);
error = file->f_op->sendfile(file, &pos, bvec->bv_len,
lo_read_actor, &cookie);
kunmap(bvec->bv_page); kunmap(bvec->bv_page);
return desc.error; return error;
} }
static int static int
...@@ -682,7 +682,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, ...@@ -682,7 +682,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
* If we can't read - sorry. If we only can't write - well, * If we can't read - sorry. If we only can't write - well,
* it's going to be read-only. * it's going to be read-only.
*/ */
if (!aops->readpage) if (!inode->i_fop->sendfile)
goto out_putf; goto out_putf;
if (!aops->prepare_write || !aops->commit_write) if (!aops->prepare_write || !aops->commit_write)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment