From patchwork Tue May 10 14:06:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqiang Yang X-Patchwork-Id: 94992 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.180.67]) by ozlabs.org (Postfix) with ESMTP id A8557B6F0A for ; Wed, 11 May 2011 00:18:02 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932585Ab1EJOFx (ORCPT ); Tue, 10 May 2011 10:05:53 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:53651 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932582Ab1EJOFv (ORCPT ); Tue, 10 May 2011 10:05:51 -0400 Received: by pzk9 with SMTP id 9so2832236pzk.19 for ; Tue, 10 May 2011 07:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=M5b+NDEzgj9/Xa8SNYusHnPIm1ILGazrLcvWe9HI7Xg=; b=ZPOUhxGZWe7BPg5TUTPOU5qO+4gOrc7hmyX8yDsyLebFaVvXcq4XwRJO4N2DIFLBpj /RVV6cKlU7MYxB68dd5ncddebanGwx2C8gu5aOLMySlZIe3e/72UOY8KO/A0FbyuAalb qfOSgoQnYVuqp+OQ8U+08KODWKPp0n6Bu+J+c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=VKHrie47PQrkexiK6A7nZGCTmLhx4oduKnFvdCgLOMx0daq5fK7VepVmyEQyib09dI JEJ3oa4tNTZkSyns50NjFRl6/ryzcFRMpHm9fKw2R8H6pBoGmu6C5TLW0Du1TrMPvntv IQlt4kDU/Z3HCr569oh6/kB03bq1ohoXha2fE= Received: by 10.68.6.168 with SMTP id c8mr2453837pba.40.1305036351184; Tue, 10 May 2011 07:05:51 -0700 (PDT) Received: from localhost.localdomain ([159.226.40.136]) by mx.google.com with ESMTPS id h9sm308429pbc.36.2011.05.10.07.05.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2011 07:05:50 -0700 (PDT) From: Yongqiang Yang To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Yongqiang Yang Subject: [PATCH v2] ext4:Let ext4_ext_fiemap_cb() handle blocks before request range correctly. Date: Tue, 10 May 2011 22:06:06 +0800 Message-Id: <1305036366-1228-1-git-send-email-xiaoqiangnk@gmail.com> X-Mailer: git-send-email 1.7.5.1 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org v1->v2: Add more specific description. To get delayed-extent information, ext4_ext_fiemap_cb() lookups pagecache, it thus collects information starting from a page's head block. If blockszie < pagesize, the beginning blocks of a page may lie before the range. ext4_ext_fiemap_cb() should proceed ignoring them, because they has been handled before. Reported-by: Amir Goldstein Signed-off-by: Yongqiang Yang --- fs/ext4/extents.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index e363f21..ec37109 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -3718,9 +3718,14 @@ out: bh = head; do { + if (end < newex->ec_block) + /* The buffer is not in + * the request range. + */ + continue; if (buffer_mapped(bh)) { /* get the 1st mapped buffer. */ - if (end > newex->ec_block + + if (end >= newex->ec_block + newex->ec_len) /* The buffer is out of * the request range.