All of lore.kernel.org
 help / color / mirror / Atom feed
From: jim owens <owens6336@gmail.com>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH V3 09/18] Btrfs: add direct I/O helper routines to decode em map_lookup.
Date: Sun, 21 Mar 2010 23:26:33 -0400	[thread overview]
Message-ID: <4BA6E369.8090101@gmail.com> (raw)


Direct I/O needs the total number of block devices and the
struct block_device for each to allocate control structures
prior to building bios for an extent.  When building a bio,
the device's base physical address of the chunk is needed.

Signed-off-by: jim owens <owens6336@gmail.com>
---
 fs/btrfs/volumes.c |   15 +++++++++++++++
 fs/btrfs/volumes.h |    3 +++
 2 files changed, 18 insertions(+), 0 deletions(-)

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
-- 
1.6.3.3

                 reply	other threads:[~2010-03-22  3:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA6E369.8090101@gmail.com \
    --to=owens6336@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.