From patchwork Wed Mar 3 18:55:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim owens X-Patchwork-Id: 83413 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o23IteH3003697 for ; Wed, 3 Mar 2010 18:55:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752558Ab0CCSz0 (ORCPT ); Wed, 3 Mar 2010 13:55:26 -0500 Received: from mail-vw0-f46.google.com ([209.85.212.46]:33222 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752454Ab0CCSzX (ORCPT ); Wed, 3 Mar 2010 13:55:23 -0500 Received: by mail-vw0-f46.google.com with SMTP id 9so688840vws.19 for ; Wed, 03 Mar 2010 10:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=gVND7pww4Ksk7g3XsXrIUJhPWIEdElHnVscE6R2PmnE=; b=gnAYHa+vEbkeq7Hb5w83ZZVGlCV2qlt3C2pDrdqO/be8Yw8rpbOrJQuiKyoBF1JS8b w049w9xYhCwXWzi3aOPiQMQU7BPPSYFmU/Fs/0A4xL+YN7743nvkTf/rHZjEA+hOuOu6 W/4u64JLFApPe79Y8RT2PJjNQuwKZ8BikNExQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=QVWeuOs/K/pG87ihjrUq0eNAbH4etCqMDz2KT3BoD0Q8Zyr3G80DWNhL48kllESBX1 AMlVm9WteNDsEce7Cu2KUUH2VyYHOcUNH1qv5VWx09RMuK6/Uqzg7sdjVjP8ln9mAvGz 21r7DUfXSFl9zx0afh9P8dfJ03Fv0XxuPltYM= Received: by 10.220.123.25 with SMTP id n25mr154875vcr.80.1267642523285; Wed, 03 Mar 2010 10:55:23 -0800 (PST) Received: from ?192.168.0.99? (c-24-147-40-65.hsd1.nh.comcast.net [24.147.40.65]) by mx.google.com with ESMTPS id 28sm1738014vws.11.2010.03.03.10.55.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Mar 2010 10:55:22 -0800 (PST) Message-ID: <4B8EB098.4050205@gmail.com> Date: Wed, 03 Mar 2010 13:55:20 -0500 From: jim owens User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: linux-btrfs Subject: [PATCH dio.c V2 5/6] Btrfs: remove lockend from diocb. Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Mar 2010 18:55:41 +0000 (UTC) diff --git a/fs/btrfs/dio.c b/fs/btrfs/dio.c index ad9b58f..05a7445 100644 --- a/fs/btrfs/dio.c +++ b/fs/btrfs/dio.c @@ -127,7 +127,6 @@ struct btrfs_diocb { u64 start; /* current submit file position */ u64 end; u64 lockstart; - u64 lockend; u64 begin; /* original beginning file position */ u64 terminate; /* fpos after submit/completion */ @@ -431,6 +430,7 @@ static void btrfs_dio_read(struct btrfs_diocb *diocb) { struct extent_io_tree *io_tree = &BTRFS_I(diocb->inode)->io_tree; u64 end = diocb->terminate; /* copy because reaper changes it */ + u64 lockend; u64 data_len; int err = 0; int loop = 0; @@ -438,7 +438,7 @@ static void btrfs_dio_read(struct btrfs_diocb *diocb) /* expand lock region to include what we read to validate checksum */ diocb->lockstart = diocb->start & ~(blocksize - 1); - diocb->lockend = ALIGN(diocb->terminate, blocksize) - 1; + lockend = ALIGN(end, blocksize) - 1; getlock: mutex_lock(&diocb->inode->i_mutex); @@ -446,7 +446,7 @@ getlock: /* ensure writeout and btree update on everything * we might read for checksum or compressed extents */ - data_len = diocb->lockend + 1 - diocb->lockstart; + data_len = lockend + 1 - diocb->lockstart; err = btrfs_wait_ordered_range(diocb->inode, diocb->lockstart, data_len); if (err) { @@ -464,10 +464,10 @@ getlock: if (!loop) { loop++; diocb->terminate = end; - diocb->lockend = ALIGN(diocb->terminate, blocksize) - 1; + lockend = ALIGN(end, blocksize) - 1; } - lock_extent(io_tree, diocb->lockstart, diocb->lockend, GFP_NOFS); + lock_extent(io_tree, diocb->lockstart, lockend, GFP_NOFS); mutex_unlock(&diocb->inode->i_mutex); data_len = end - diocb->start; @@ -514,12 +514,12 @@ getlock: } else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) { if (diocb->lockstart > em->start || - diocb->lockend < em->start + em->len - 1) { + lockend < em->start + em->len - 1) { /* lock everything we read to inflate */ unlock_extent(io_tree, diocb->lockstart, - diocb->lockend, GFP_NOFS); + lockend, GFP_NOFS); diocb->lockstart = em->start; - diocb->lockend = max(diocb->lockend, + lockend = max(lockend, em->start + em->len - 1); free_extent_map(em); goto getlock; @@ -545,9 +545,8 @@ fail: * range as appropriate for submitted bios, so we only * need to unlock the unprocessed remainder */ - if (diocb->lockstart <= diocb->lockend) - unlock_extent(io_tree, diocb->lockstart, - diocb->lockend, GFP_NOFS); + if (diocb->lockstart <= lockend) + unlock_extent(io_tree, diocb->lockstart, lockend, GFP_NOFS); } static int btrfs_dio_new_extcb(struct btrfs_dio_extcb **alloc_extcb,