Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107168
b: refs/heads/master
c: 8b6d8c5
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Jul 30, 2008
1 parent be96e6c commit efda23d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 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: de1d7bb63893b4246ce60797aa554341e908f034
refs/heads/master: 8b6d8c592fa7b8bfb1218447a273314c13a67e8a
37 changes: 23 additions & 14 deletions trunk/fs/romfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ static int
romfs_readpage(struct file *file, struct page * page)
{
struct inode *inode = page->mapping->host;
loff_t offset, avail, readlen;
loff_t offset, size;
unsigned long filled;
void *buf;
int result = -EIO;

Expand All @@ -430,21 +431,29 @@ romfs_readpage(struct file *file, struct page * page)

/* 32 bit warning -- but not for us :) */
offset = page_offset(page);
if (offset < i_size_read(inode)) {
avail = inode->i_size-offset;
readlen = min_t(unsigned long, avail, PAGE_SIZE);
if (romfs_copyfrom(inode, buf, ROMFS_I(inode)->i_dataoffset+offset, readlen) == readlen) {
if (readlen < PAGE_SIZE) {
memset(buf + readlen,0,PAGE_SIZE-readlen);
}
SetPageUptodate(page);
result = 0;
size = i_size_read(inode);
filled = 0;
result = 0;
if (offset < size) {
unsigned long readlen;

size -= offset;
readlen = size > PAGE_SIZE ? PAGE_SIZE : size;

filled = romfs_copyfrom(inode, buf, ROMFS_I(inode)->i_dataoffset+offset, readlen);

if (filled != readlen) {
SetPageError(page);
filled = 0;
result = -EIO;
}
}
if (result) {
memset(buf, 0, PAGE_SIZE);
SetPageError(page);
}

if (filled < PAGE_SIZE)
memset(buf + filled, 0, PAGE_SIZE-filled);

if (!result)
SetPageUptodate(page);
flush_dcache_page(page);

unlock_page(page);
Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ void iov_iter_advance(struct iov_iter *i, size_t bytes)
* The !iov->iov_len check ensures we skip over unlikely
* zero-length segments (without overruning the iovec).
*/
while (bytes || unlikely(!iov->iov_len && i->count)) {
while (bytes || unlikely(i->count && !iov->iov_len)) {
int copy;

copy = min(bytes, iov->iov_len - base);
Expand Down

0 comments on commit efda23d

Please sign in to comment.