public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] blockable_page_cache_readahead() cleanup
@ 2005-01-25 11:59 Oleg Nesterov
  2005-01-25 21:50 ` Steven Pratt
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2005-01-25 11:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ram Pai, Steven Pratt, Andrew Morton

I think that do_page_cache_readahead() can be inlined
in blockable_page_cache_readahead(), this makes the
code a bit more readable in my opinion.

Also makes check_ra_success() static inline.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 2.6.11-rc2/mm/readahead.c~	2005-01-25 17:26:34.000000000 +0300
+++ 2.6.11-rc2/mm/readahead.c	2005-01-25 17:29:26.000000000 +0300
@@ -349,8 +349,8 @@ int force_page_cache_readahead(struct ad
  * readahead isn't helping.
  *
  */
-int check_ra_success(struct file_ra_state *ra, unsigned long nr_to_read,
-				 unsigned long actual)
+static inline int check_ra_success(struct file_ra_state *ra,
+			unsigned long nr_to_read, unsigned long actual)
 {
 	if (actual == 0) {
 		ra->cache_hit += nr_to_read;
@@ -395,15 +395,11 @@ blockable_page_cache_readahead(struct ad
 {
 	int actual;
 
-	if (block) {
-		actual = __do_page_cache_readahead(mapping, filp,
-						offset, nr_to_read);
-	} else {
-		actual = do_page_cache_readahead(mapping, filp,
-						offset, nr_to_read);
-		if (actual == -1)
-			return 0;
-	}
+	if (block && bdi_read_congested(mapping->backing_dev_info))
+		return 0;
+
+	actual = __do_page_cache_readahead(mapping, filp, offset, nr_to_read);
+
 	return check_ra_success(ra, nr_to_read, actual);
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 4/4] blockable_page_cache_readahead() cleanup
  2005-01-25 11:59 [PATCH 4/4] blockable_page_cache_readahead() cleanup Oleg Nesterov
@ 2005-01-25 21:50 ` Steven Pratt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Pratt @ 2005-01-25 21:50 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: linux-kernel, Ram Pai, Andrew Morton

No problem with this patch either.  Again, not sure it buys much but it 
should work fine.

Steve

Oleg Nesterov wrote:

>I think that do_page_cache_readahead() can be inlined
>in blockable_page_cache_readahead(), this makes the
>code a bit more readable in my opinion.
>
>Also makes check_ra_success() static inline.
>
>Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
>
>--- 2.6.11-rc2/mm/readahead.c~	2005-01-25 17:26:34.000000000 +0300
>+++ 2.6.11-rc2/mm/readahead.c	2005-01-25 17:29:26.000000000 +0300
>@@ -349,8 +349,8 @@ int force_page_cache_readahead(struct ad
>  * readahead isn't helping.
>  *
>  */
>-int check_ra_success(struct file_ra_state *ra, unsigned long nr_to_read,
>-				 unsigned long actual)
>+static inline int check_ra_success(struct file_ra_state *ra,
>+			unsigned long nr_to_read, unsigned long actual)
> {
> 	if (actual == 0) {
> 		ra->cache_hit += nr_to_read;
>@@ -395,15 +395,11 @@ blockable_page_cache_readahead(struct ad
> {
> 	int actual;
> 
>-	if (block) {
>-		actual = __do_page_cache_readahead(mapping, filp,
>-						offset, nr_to_read);
>-	} else {
>-		actual = do_page_cache_readahead(mapping, filp,
>-						offset, nr_to_read);
>-		if (actual == -1)
>-			return 0;
>-	}
>+	if (block && bdi_read_congested(mapping->backing_dev_info))
>+		return 0;
>+
>+	actual = __do_page_cache_readahead(mapping, filp, offset, nr_to_read);
>+
> 	return check_ra_success(ra, nr_to_read, actual);
> }
>  
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-25 22:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-25 11:59 [PATCH 4/4] blockable_page_cache_readahead() cleanup Oleg Nesterov
2005-01-25 21:50 ` Steven Pratt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox