Skip to contentSkip to conversation

round read ahead change

PATCH New Milan Broz 2 participants 2 messages Jun 6, 2009

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 round read ahead change

Round read_ahead more intelligently and print warning.

Round reah ahead at least to one page up. Print warning instead of verbose message. Fix printed page in KB, sector value is confusing.

[why we are rounding it to pagesize at all?
it is kernel who should optimize reads and align them to pages]

---
 tools/lvchange.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
tools/lvchange.c +6 -3
index 10795e3..5abb6e5 100644
@@ -370,9 +370,12 @@ static int lvchange_readahead(struct cmd_context *cmd,
 
 	if (read_ahead != DM_READ_AHEAD_AUTO &&
 	    read_ahead != DM_READ_AHEAD_NONE && read_ahead % pagesize) {
-		read_ahead = (read_ahead / pagesize) * pagesize;
-		log_verbose("Rounding down readahead to %u sectors, a multiple "
-			    "of page size %u.", read_ahead, pagesize);
+		if (read_ahead < pagesize)
+			read_ahead = pagesize;
+		else
+			read_ahead = (read_ahead / pagesize) * pagesize;
+		log_warn("WARNING: Overriding readahead to %u sectors, a multiple "
+			    "of %uK page size.", read_ahead, pagesize >> 1);
 	}
 
 	if (lv->read_ahead == read_ahead) {
#1 lore raw

PATCH 1/1 round read ahead change

Quoted 1 line · Milan Broz

Round read_ahead more intelligently and print warning.

Ack.

Alasdair