[PATCH 12/17] partition: remove redundant read_mapping_page error checks

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Nate Diller
Date: Wednesday, April 11, 2007 - 7:49 pm

Remove unneeded PageError checking in read_dev_sector(), and clean up the
code a bit.

Can anyone point out why it's OK to use page_address() here on a page which
has not been kmapped?  If it's not OK, then a good number of callers need to
be fixed.

Signed-off-by: Nate Diller <nate.diller@gmail.com>

---

diff -urpN -X dontdiff linux-2.6.21-rc6-mm1/fs/partitions/check.c linux-2.6.21-rc6-mm1-test/fs/partitions/check.c
--- linux-2.6.21-rc6-mm1/fs/partitions/check.c	2007-04-09 17:24:03.000000000 -0700
+++ linux-2.6.21-rc6-mm1-test/fs/partitions/check.c	2007-04-10 21:59:01.000000000 -0700
@@ -568,16 +568,12 @@ unsigned char *read_dev_sector(struct bl
 
 	page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)),
 				 NULL);
-	if (!IS_ERR(page)) {
-		if (PageError(page))
-			goto fail;
-		p->v = page;
-		return (unsigned char *)page_address(page) +  ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9);
-fail:
-		page_cache_release(page);
+	if (IS_ERR(page)) {
+		p->v = NULL;
+		return NULL;
 	}
-	p->v = NULL;
-	return NULL;
+	p->v = page;
+	return (unsigned char *)page_address(page) +  ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9);
 }
 
 EXPORT_SYMBOL(read_dev_sector);
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/17] cramfs: use read_mapping_page, Nate Diller, (Wed Apr 11, 7:49 pm)
[PATCH 12/17] partition: remove redundant read_mapping_pag ..., Nate Diller, (Wed Apr 11, 7:49 pm)
[PATCH 10/17] mtd: convert page_read to read_kmap_page, Nate Diller, (Wed Apr 11, 7:49 pm)
[PATCH 8/17] jfs: use locking read_mapping_page, Nate Diller, (Wed Apr 11, 7:49 pm)
Re: [PATCH 1/17] cramfs: use read_mapping_page, Christoph Hellwig, (Thu Apr 12, 2:54 am)
Re: [PATCH 1/17] cramfs: use read_mapping_page, Roman Zippel, (Thu Apr 12, 4:26 am)
Re: [PATCH 1/17] cramfs: use read_mapping_page, Nate Diller, (Thu Apr 12, 11:36 am)
Drop patch update-isdn-tree-to-use-pci_get_device.patch fr ..., Surya Prabhakar N, (Sun Jul 15, 11:05 pm)