From patchwork Wed Mar 3 14:48:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim owens X-Patchwork-Id: 83346 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 o23EmDtB009032 for ; Wed, 3 Mar 2010 14:48:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754736Ab0CCOsM (ORCPT ); Wed, 3 Mar 2010 09:48:12 -0500 Received: from mail-bw0-f209.google.com ([209.85.218.209]:65290 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754467Ab0CCOsL (ORCPT ); Wed, 3 Mar 2010 09:48:11 -0500 Received: by bwz1 with SMTP id 1so63191bwz.21 for ; Wed, 03 Mar 2010 06:48:09 -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=L5EcT1LgNPHuG631QkRnICAozl+SInYpUSBuwoLYb0Y=; b=DyW2gBw4cqFio9HZ67O8605wDd4O3Z63zcjK+YXTNM/pP1sdqlqEkuYlW/5fTezeq6 Z470mn9MD83XwYNyWa5wg6dwwqX5FXkxILER3vW4FY6y0wvJvWC4d8oXc6m+epc70cMT B4wFP+hArIwS7krEto+lNu9S81wdgXFTAQmpc= 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=sNgWjlmbDxIECeI+23Feag94Q+cQO4uO78ACqO1mP7b2JFCrz6vSCwxnYUArMAUhle nAk/ygw6jotH3bWZ0q+ICHK8O1ZAUSNg5znfUUQVPvZtQsCAsBScoxNmjrkOnxu8uU2d mel6P0C8JFtqZNlJrNn4Q6/3u/ellRdNmQvGA= Received: by 10.204.34.136 with SMTP id l8mr5924377bkd.163.1267627689336; Wed, 03 Mar 2010 06:48:09 -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 14sm3810618bwz.2.2010.03.03.06.48.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Mar 2010 06:48:08 -0800 (PST) Message-ID: <4B8E76A4.9080704@gmail.com> Date: Wed, 03 Mar 2010 09:48:04 -0500 From: jim owens User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: linux-btrfs Subject: [PATCH V2] Btrfs: add direct I/O helper to process inline compressed extents. 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 14:48:14 +0000 (UTC) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index b177ed3..d2fc17a 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3053,6 +3053,22 @@ static inline struct page *extent_buffer_page(struct extent_buffer *eb, return p; } +void access_extent_buffer_page(struct bio_vec *vec, struct extent_buffer *eb, + unsigned long start, unsigned long len) +{ + size_t start_offset = eb->start & ((u64)PAGE_CACHE_SIZE - 1); + unsigned long i = (start_offset + start) >> PAGE_CACHE_SHIFT; + size_t offset = (start_offset + start) & + ((unsigned long)PAGE_CACHE_SIZE - 1); + + WARN_ON(start > eb->len); + WARN_ON(start + len > eb->start + eb->len); + + vec->bv_page = extent_buffer_page(eb, i); + vec->bv_offset = offset; + vec->bv_len = min(len, (PAGE_CACHE_SIZE - offset)); +} + static inline unsigned long num_extent_pages(u64 start, u64 len) { return ((start + len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) - diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 36de250..c8c129b 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -2,6 +2,7 @@ #define __EXTENTIO__ #include +#include /* bits for the extent state */ #define EXTENT_DIRTY 1 @@ -300,4 +301,6 @@ int extent_clear_unlock_delalloc(struct inode *inode, struct extent_io_tree *tree, u64 start, u64 end, struct page *locked_page, unsigned long op); +extern void access_extent_buffer_page(struct bio_vec *vec, struct extent_buffer *eb, + unsigned long start, unsigned long len); #endif