Skip to contentSkip to conversation

Writeback page range hint

PATCH Dave Jones 3 participants 5 messages Aug 24, 2004 1 message not in the archive Page cache

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dave Jones

author
#1 lore raw
Quoted 9 lines · Linux Kernel

ChangeSet 1.2034, 2004/08/23 12:59:27-07:00, [email protected]

[PATCH] Writeback page range hint

Modify mpage_writepages to optionally only write back dirty pages within a specified range in a file (as in the case of O_SYNC). Cheat a little to avoid changes to prototypes of aops - just put the <start, end> hint into the writeback_control struct instead. If <start, end> are not set, then default to writing back all the mapping's dirty pages.

FYI, this chunk...

Quoted 8 lines
(quoted diff) +3 -4
 	long pages_skipped;		/* Pages which were not written */
-	int nonblocking;		/* Don't get stuck on request queues */
-	int encountered_congestion;	/* An output: a queue is full */
-	int for_kupdate;		/* A kupdate writeback */
-	int for_reclaim;		/* Invoked from the page allocator */
+
+	/*
+	 * For a_ops->writepages(): is start or end are non-zero then this is

Review

Quoted 10 lines
(quoted diff) +10 -0
+	 * a hint that the filesystem need only write out the pages inside that
+	 * byterange.  The byte at `end' is included in the writeout request.
+	 */
+	loff_t start;
+	loff_t end;
+
+	int nonblocking:1;		/* Don't get stuck on request queues */
+	int encountered_congestion:1;	/* An output: a queue is full */
+	int for_kupdate:1;		/* A kupdate writeback */
+	int for_reclaim:1;		/* Invoked from the page allocator */

Causes sparse spew..

include/linux/writeback.h:54:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:55:30: warning: dubious one-bit signed bitfield include/linux/writeback.h:56:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:57:19: warning: dubious one-bit signed bitfield

Dave

#2 lore raw
Quoted 24 lines · Dave Jones

FYI, this chunk...

Quoted 8 lines
(quoted diff) +3 -4
 	long pages_skipped;		/* Pages which were not written */
-	int nonblocking;		/* Don't get stuck on request queues */
-	int encountered_congestion;	/* An output: a queue is full */
-	int for_kupdate;		/* A kupdate writeback */
-	int for_reclaim;		/* Invoked from the page allocator */
+
+	/*
+	 * For a_ops->writepages(): is start or end are non-zero then this is

Review

Quoted 10 lines
(quoted diff) +10 -0
+	 * a hint that the filesystem need only write out the pages inside that
+	 * byterange.  The byte at `end' is included in the writeout request.
+	 */
+	loff_t start;
+	loff_t end;
+
+	int nonblocking:1;		/* Don't get stuck on request queues */
+	int encountered_congestion:1;	/* An output: a queue is full */
+	int for_kupdate:1;		/* A kupdate writeback */
+	int for_reclaim:1;		/* Invoked from the page allocator */

Causes sparse spew..

Quoted 4 lines

include/linux/writeback.h:54:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:55:30: warning: dubious one-bit signed bitfield include/linux/writeback.h:56:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:57:19: warning: dubious one-bit signed bitfield

That's fussy of it. I assume this shuts it up?

include/linux/writeback.h renamed from include/linux/writeback.h~writeback-sparse-warning-fix +4 -4
@@ -51,10 +51,10 @@ struct writeback_control {
 	loff_t start;
 	loff_t end;
 
-	int nonblocking:1;		/* Don't get stuck on request queues */
-	int encountered_congestion:1;	/* An output: a queue is full */
-	int for_kupdate:1;		/* A kupdate writeback */
-	int for_reclaim:1;		/* Invoked from the page allocator */
+	unsigned int nonblocking:1;	/* Don't get stuck on request queues */
+	unsigned int encountered_congestion:1;	/* An output: a queue is full */
+	unsigned int for_kupdate:1;	/* A kupdate writeback */
+	unsigned int for_reclaim:1;	/* Invoked from the page allocator */
 };
 
 /*

_

author
#3 lore raw
Quoted 5 lines · Andrew Morton
Quoted 5 lines
Quoted 4 lines
(quoted diff) +4 -0
+	int nonblocking:1;		/* Don't get stuck on request queues */
+	int encountered_congestion:1;	/* An output: a queue is full */
+	int for_kupdate:1;		/* A kupdate writeback */
+	int for_reclaim:1;		/* Invoked from the page allocator */
Quoted 8 lines
Quoted 6 lines

Causes sparse spew..

include/linux/writeback.h:54:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:55:30: warning: dubious one-bit signed bitfield include/linux/writeback.h:56:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:57:19: warning: dubious one-bit signed bitfield

That's fussy of it. I assume this shuts it up?

very likely (its 2am, and I'm feeling too lazy to check). though, is there any real reason why they are bitfields at all ?

I'll double check it in the morning when the nightly sparse cron jobs mail me 8-)

Dave

#4 lore raw
Quoted 10 lines · Dave Jones
Quoted 7 lines · Andrew Morton
Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+	int nonblocking:1;		/* Don't get stuck on request queues */
+	int encountered_congestion:1;	/* An output: a queue is full */
+	int for_kupdate:1;		/* A kupdate writeback */
+	int for_reclaim:1;		/* Invoked from the page allocator */

Causes sparse spew..

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

include/linux/writeback.h:54:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:55:30: warning: dubious one-bit signed bitfield include/linux/writeback.h:56:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:57:19: warning: dubious one-bit signed bitfield

That's fussy of it. I assume this shuts it up?

very likely (its 2am, and I'm feeling too lazy to check).

That's the middle of the working day.

Quoted 1 line

though, is there any real reason why they are bitfields at all ?

That should have been in the changelog. Bad Suparna.

These structures are allocated on the stack in the (deep) writeback paths. Saving a few bytes there does seem to be worth the increased code size.

#5 lore raw
In reply to Dave Jones
Quoted 5 lines · Dave Jones

Causes sparse spew..
include/linux/writeback.h:54:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:55:30: warning: dubious one-bit signed bitfield include/linux/writeback.h:56:19: warning: dubious one-bit signed bitfield include/linux/writeback.h:57:19: warning: dubious one-bit signed bitfield

Does this help?

include/linux/writeback.h +4 -4
Index: mm4-2.6.8.1/include/linux/writeback.h
===================================================================
@@ -51,10 +51,10 @@
 	loff_t start;
 	loff_t end;
 
-	int nonblocking:1;		/* Don't get stuck on request queues */
-	int encountered_congestion:1;	/* An output: a queue is full */
-	int for_kupdate:1;		/* A kupdate writeback */
-	int for_reclaim:1;		/* Invoked from the page allocator */
+	unsigned nonblocking:1,		/* Don't get stuck on request queues */
+	    encountered_congestion:1,	/* An output: a queue is full */
+	    for_kupdate:1,		/* A kupdate writeback */
+	    for_reclaim:1;		/* Invoked from the page allocator */
 };
 
 /*