From patchwork Mon Mar 22 03:26:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim owens X-Patchwork-Id: 87341 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 o2M3Qb3s018642 for ; Mon, 22 Mar 2010 03:26:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753997Ab0CVD0g (ORCPT ); Sun, 21 Mar 2010 23:26:36 -0400 Received: from qw-out-2122.google.com ([74.125.92.24]:23929 "EHLO qw-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753726Ab0CVD0f (ORCPT ); Sun, 21 Mar 2010 23:26:35 -0400 Received: by qw-out-2122.google.com with SMTP id 8so1063216qwh.37 for ; Sun, 21 Mar 2010 20:26:35 -0700 (PDT) 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=wElpljCHHgfs1ZU3Xql86qmYuQQKc2SVZOH7sBz4p1M=; b=BE2I1Coaxzj27+QiZD8rQd+DWFrV5elgaHjfjI3zh4wlcsLvjEH41d5ePrgaLoFXz7 pn0NkavhVO2Yz+ctbBfyHahQclTnSZDXQiNahK4CnbawCtdtE1uBz5mHrfghNtfW/vUN RsJibQKEwcXMVP4/CSwnXAM8CQiLDFwYuDcBo= 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=XMKOACzm9DANicBbFwo1z/xbE/ihhp1sUQZmx59r11uSxyAUafOWklkDwDkq7ZyumK TJKY8yv5F6MKkt9gxOhdkQBQH1pRxaRYa7Q6IgDDvlQ4VslM2P+2Velw+Ayep6nw7+EF jUzlhyS215TjRk4UfGcEZ6+8Smf5HpvnqKSIM= Received: by 10.224.114.9 with SMTP id c9mr1013945qaq.148.1269228395169; Sun, 21 Mar 2010 20:26:35 -0700 (PDT) Received: from [192.168.0.97] (c-24-147-40-65.hsd1.nh.comcast.net [24.147.40.65]) by mx.google.com with ESMTPS id 6sm8034412qwd.27.2010.03.21.20.26.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 21 Mar 2010 20:26:34 -0700 (PDT) Message-ID: <4BA6E369.8090101@gmail.com> Date: Sun, 21 Mar 2010 23:26:33 -0400 From: jim owens User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: linux-btrfs Subject: [PATCH V3 09/18] Btrfs: add direct I/O helper routines to decode em map_lookup. 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]); Mon, 22 Mar 2010 03:26:38 +0000 (UTC) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 8346e88..5a44c5c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2626,6 +2626,21 @@ static int find_live_mirror(struct map_lookup *map, int first, int num, return optimal; } +int btrfs_map_stripe_count(struct extent_map *em) +{ + return ((struct map_lookup *)em->bdev)->num_stripes; +} + +struct block_device *btrfs_map_stripe_bdev(struct extent_map *em, int stripe) +{ + return ((struct map_lookup *)em->bdev)->stripes[stripe].dev->bdev; +} + +u64 btrfs_map_stripe_physical(struct extent_map *em, int stripe) +{ + return ((struct map_lookup *)em->bdev)->stripes[stripe].physical; +} + void btrfs_map_to_stripe(struct extent_map *em, int rw, int mirror_num, u64 logical, u64 *length, struct btrfs_stripe_info *stripe_info) diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 76c4394..226200d 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -192,4 +192,7 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); int find_free_dev_extent(struct btrfs_trans_handle *trans, struct btrfs_device *device, u64 num_bytes, u64 *start, u64 *max_avail); +int btrfs_map_stripe_count(struct extent_map *em); +struct block_device *btrfs_map_stripe_bdev(struct extent_map *em, int stripe); +u64 btrfs_map_stripe_physical(struct extent_map *em, int stripe); #endif