@pages_min might be larger than @pages which indicate
more pages should be read, and it will cause a warning
later.
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: Ifd82f709c3877172f08b87ab0551da735a0613e0
Reviewed-on: https://review.whamcloud.com/44050
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
+ WARN_ON_ONCE(pages_min > pages);
- * Don't try readahead agreesively if we are limited
+ * Don't try readahead aggresively if we are limited
* LRU pages, otherwise, it could cause deadlock.
*/
pages = min(sbi->ll_cache->ccc_lru_max >> 2, pages);
* LRU pages, otherwise, it could cause deadlock.
*/
pages = min(sbi->ll_cache->ccc_lru_max >> 2, pages);
* this will make us leak @ra_cur_pages, because
* ll_ra_count_put() acutally freed @pages.
*/
* this will make us leak @ra_cur_pages, because
* ll_ra_count_put() acutally freed @pages.
*/
- if (WARN_ON_ONCE(pages_min > pages))
+ if (unlikely(pages_min > pages))
/* don't over reserved for mmap range read */
if (skip_index)
pages_min = 0;
/* don't over reserved for mmap range read */
if (skip_index)
pages_min = 0;
+ if (pages_min > pages)
+ pages = pages_min;
ria->ria_reserved = ll_ra_count_get(ll_i2sbi(inode), ria, pages,
pages_min);
if (ria->ria_reserved < pages)
ria->ria_reserved = ll_ra_count_get(ll_i2sbi(inode), ria, pages,
pages_min);
if (ria->ria_reserved < pages)