From patchwork Mon Nov 23 02:18:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 39023 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 6E8501007D1 for ; Mon, 23 Nov 2009 13:18:42 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756126AbZKWCSd (ORCPT ); Sun, 22 Nov 2009 21:18:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756084AbZKWCSc (ORCPT ); Sun, 22 Nov 2009 21:18:32 -0500 Received: from thunk.org ([69.25.196.29]:48726 "EHLO thunker.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756068AbZKWCS3 (ORCPT ); Sun, 22 Nov 2009 21:18:29 -0500 Received: from root (helo=closure.thunk.org) by thunker.thunk.org with local-esmtp (Exim 4.50 #1 (Debian)) id 1NCOVe-00009j-2A; Sun, 22 Nov 2009 21:18:34 -0500 Received: from tytso by closure.thunk.org with local (Exim 4.69) (envelope-from ) id 1NCOVa-0008K7-LK; Sun, 22 Nov 2009 21:18:30 -0500 From: Theodore Ts'o To: Ext4 Developers List Cc: Theodore Ts'o Subject: [PATCH 8/8] ext4: use ext4_data_block_valid() in ext4_free_blocks() Date: Sun, 22 Nov 2009 21:18:30 -0500 Message-Id: <1258942710-31930-9-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 1.6.5.216.g5288a.dirty In-Reply-To: <1258942710-31930-1-git-send-email-tytso@mit.edu> References: <1258942710-31930-1-git-send-email-tytso@mit.edu> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on thunker.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The block validity framework does a more comprehensive set of checks, and it saves object code space to use the ext4_data_block_valid() than the limited open-coded version that had been in ext4_free_blocks(). Signed-off-by: "Theodore Ts'o" --- fs/ext4/mballoc.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 78de5d3..ab2dad1 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4463,9 +4463,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, sbi = EXT4_SB(sb); es = EXT4_SB(sb)->s_es; - if (block < le32_to_cpu(es->s_first_data_block) || - block + count < block || - block + count > ext4_blocks_count(es)) { + if (!ext4_data_block_valid(sbi, block, count)) { ext4_error(sb, __func__, "Freeing blocks not in datazone - " "block = %llu, count = %lu", block, count);