Skip to contentSkip to conversation

ramdisc fixes

parisc-linux Matthew Wilcox 1 participant 1 message Oct 5, 2001 Block layer

lore
Share & tools
lore
#0 lore raw

I'm thinking about committing the following patch to our cvs:

Index: drivers/block/rd.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/block/rd.c,v retrieving revision 1.16

block/rd.c +1 -6
diff -u -p -r1.16 rd.c
@@ -227,14 +227,9 @@ static int rd_make_request(request_queue
 	 */
 	bdata = bh_kmap(sbh);
 	if (rw == READ) {
-		/* XXX FIXME This is probably not the right fix, and the
-		 * upstream kernel will probably fix this a different way,
-		 * but for now I'd rather have something which works in
-		 * CVS rather than a semi-secret patch. -PB
-		 */
 		if (sbh != rbh) {
 			memcpy(bdata, rbh->b_data, rbh->b_size);
-			flush_kernel_dcache_range(bdata,rbh->b_size);
+			flush_dcache_page(sbh->b_page);
 		}
 	} else
 		if (sbh != rbh)

However, rd.c changed dramatically in 2.4.10, and I think the following patch will be equivalent. I posted a short analysis here
http://marc.theaimsgroup.com/?l=linux-kernel&m=100160260325543&w=2
but neither Linus nor Alan seem to have applied this patch yet.

drivers/block/rd.c +4 -2
@@ -276,7 +276,6 @@ static int rd_blkdev_pagecache_IO(int rw
 			if (!Page_Uptodate(page)) {
 				memset(kmap(page), 0, PAGE_CACHE_SIZE);
 				kunmap(page);
-				flush_dcache_page(page);
 				SetPageUptodate(page);
 			}
 
@@ -301,8 +300,11 @@ static int rd_blkdev_pagecache_IO(int rw
 		kunmap(page);
 		bh_kunmap(sbh);
 
-		if (rw != READ)
+		if (rw == READ) {
+			flush_dcache_page(page);
+		} else {
 			SetPageDirty(page);
+		}
 		if (unlock)
 			UnlockPage(page);
 		__free_page(page);

anyone see any problems with my analysis / fixes?

Signature · 1 line
Revolutions do not require corporate support.