Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336255
b: refs/heads/master
c: 684c9aa
h: refs/heads/master
i:
  336253: f5dec8b
  336251: 3b4272f
  336247: 60f4af1
  336239: 19ea42d
  336223: 7079864
  336191: 9c92247
  336127: 1115b21
v: v3
  • Loading branch information
Linus Torvalds committed Dec 8, 2012
1 parent 1834d95 commit 0b2052c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1b3c393cd43f22ead8a6a2f839efc6df8ebd7465
refs/heads/master: 684c9aaebbb0ea3a9954d605d4908e650659e7db
18 changes: 17 additions & 1 deletion trunk/fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,22 @@ ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
}
EXPORT_SYMBOL_GPL(blkdev_aio_write);

static ssize_t blkdev_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct file *file = iocb->ki_filp;
struct inode *bd_inode = file->f_mapping->host;
loff_t size = i_size_read(bd_inode);

if (pos >= size)
return 0;

size -= pos;
if (size < INT_MAX)
nr_segs = iov_shorten((struct iovec *)iov, nr_segs, size);
return generic_file_aio_read(iocb, iov, nr_segs, pos);
}

/*
* Try to release a page associated with block device when the system
* is under memory pressure.
Expand Down Expand Up @@ -1574,7 +1590,7 @@ const struct file_operations def_blk_fops = {
.llseek = block_llseek,
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_read = blkdev_aio_read,
.aio_write = blkdev_aio_write,
.mmap = generic_file_mmap,
.fsync = blkdev_fsync,
Expand Down

0 comments on commit 0b2052c

Please sign in to comment.