On Sat, Sep 22, 2012 at 04:03:10PM +0530, raghu.prabhu13@xxxxxxxxx wrote: > From: Raghavendra D Prabhu <rprabhu@xxxxxxxxxxx> > > Return value of a_ops->readpage will be propagated to return value of read_pages > and __do_page_cache_readahead. That does not explain the intention and benefit of this patch.. Thanks, Fengguang > Signed-off-by: Raghavendra D Prabhu <rprabhu@xxxxxxxxxxx> > --- > mm/readahead.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/mm/readahead.c b/mm/readahead.c > index ea8f8fa..461fcc0 100644 > --- a/mm/readahead.c > +++ b/mm/readahead.c > @@ -113,7 +113,7 @@ static int read_pages(struct address_space *mapping, struct file *filp, > { > struct blk_plug plug; > unsigned page_idx; > - int ret; > + int ret = 0; > > blk_start_plug(&plug); > > @@ -129,11 +129,12 @@ static int read_pages(struct address_space *mapping, struct file *filp, > list_del(&page->lru); > if (!add_to_page_cache_lru(page, mapping, > page->index, GFP_KERNEL)) { > - mapping->a_ops->readpage(filp, page); > + ret = mapping->a_ops->readpage(filp, page); > + if (ret < 0) > + break; > } > page_cache_release(page); > } > - ret = 0; > > out: > blk_finish_plug(&plug); > @@ -160,6 +161,7 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp, > LIST_HEAD(page_pool); > int page_idx; > int ret = 0; > + int ret_read = 0; > loff_t isize = i_size_read(inode); > > if (isize == 0) > @@ -198,10 +200,10 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp, > * will then handle the error. > */ > if (ret) > - read_pages(mapping, filp, &page_pool, ret); > + ret_read = read_pages(mapping, filp, &page_pool, ret); > BUG_ON(!list_empty(&page_pool)); > out: > - return ret; > + return (ret_read < 0 ? ret_read : ret); > } > > /* > -- > 1.7.12.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>