From patchwork Mon Jan 4 21:13:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim owens X-Patchwork-Id: 70744 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o04LE1Va025017 for ; Mon, 4 Jan 2010 21:14:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752215Ab0ADVOA (ORCPT ); Mon, 4 Jan 2010 16:14:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752045Ab0ADVN7 (ORCPT ); Mon, 4 Jan 2010 16:13:59 -0500 Received: from g5t0006.atlanta.hp.com ([15.192.0.43]:48752 "EHLO g5t0006.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014Ab0ADVN7 (ORCPT ); Mon, 4 Jan 2010 16:13:59 -0500 Received: from g5t0029.atlanta.hp.com (g5t0029.atlanta.hp.com [16.228.8.141]) by g5t0006.atlanta.hp.com (Postfix) with ESMTP id D1893C21C for ; Mon, 4 Jan 2010 21:13:58 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g5t0029.atlanta.hp.com (Postfix) with ESMTP id BF71C20003 for ; Mon, 4 Jan 2010 21:13:58 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id 91409CF0018; Mon, 4 Jan 2010 14:13:58 -0700 (MST) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cQKo52-ym2hh; Mon, 4 Jan 2010 14:13:58 -0700 (MST) Received: from [192.168.0.99] (squirrel.fc.hp.com [15.11.146.57]) (Authenticated sender: owens@fc.hp.com) by ldl (Postfix) with ESMTPA id 1F190CF000E; Mon, 4 Jan 2010 14:13:58 -0700 (MST) Message-ID: <4B425A14.2030102@hp.com> Date: Mon, 04 Jan 2010 16:13:56 -0500 From: jim owens User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: linux-btrfs Subject: [RFC 08/12 PATCH] 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 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 48727ee..6aa04e4 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2614,6 +2614,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