From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nate Diller Subject: [PATCH 12/17] partition: remove redundant read_mapping_page error checks Date: Wed, 11 Apr 2007 19:49:38 -0700 Message-ID: <20070412024938.27380.55983.patchbomb.py@localhost> References: <20070412024938.27380.54538.patchbomb.py@localhost> Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, reiserfs-dev@namesys.com To: Andrew Morton , Alexander Viro , Christoph Hellwig , Roman Zippel , Mikulas Patocka , David Woodhouse , Dave Kleikamp , Anton Altaparmakov , Evgeniy Dushistov Return-path: Received: from qb-out-0506.google.com ([72.14.204.226]:4941 "EHLO qb-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161532AbXDLCxb (ORCPT ); Wed, 11 Apr 2007 22:53:31 -0400 Received: by qb-out-0506.google.com with SMTP id q10so34599qbq for ; Wed, 11 Apr 2007 19:53:30 -0700 (PDT) In-Reply-To: <20070412024938.27380.54538.patchbomb.py@localhost> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 --- 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);