diff options
author | Richard Weinberger <richard@nod.at> | 2015-03-03 21:40:55 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-03-26 23:27:49 +0100 |
commit | 41761ddfaecb30e1f0ecac4ce568e3e641d10bec (patch) | |
tree | e1b3f5551a4e59411e5158764982106633c905b4 /fs | |
parent | 2ad2dca6fd28cf24ed64110a8b374fc838838c81 (diff) | |
download | linux-41761ddfaecb30e1f0ecac4ce568e3e641d10bec.tar.gz linux-41761ddfaecb30e1f0ecac4ce568e3e641d10bec.tar.bz2 linux-41761ddfaecb30e1f0ecac4ce568e3e641d10bec.zip |
hostfs: Make hostfs_readpage more readable
...to make life easier for future readers of that code.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 8163aac81c21..67e556cbfd82 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -439,25 +439,27 @@ static int hostfs_readpage(struct file *file, struct page *page) { char *buffer; long long start; - int err = 0; + int bytes_read, ret; start = (long long) page->index << PAGE_CACHE_SHIFT; buffer = kmap(page); - err = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, + bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, PAGE_CACHE_SIZE); - if (err < 0) + if (bytes_read < 0) { + ret = bytes_read; goto out; + } - memset(&buffer[err], 0, PAGE_CACHE_SIZE - err); + memset(buffer + bytes_read, 0, PAGE_CACHE_SIZE - bytes_read); flush_dcache_page(page); SetPageUptodate(page); if (PageError(page)) ClearPageError(page); - err = 0; + ret = 0; out: kunmap(page); unlock_page(page); - return err; + return ret; } static int hostfs_write_begin(struct file *file, struct address_space *mapping, |