All of lore.kernel.org
 help / color / mirror / Atom feed
* [Question] disk_bytenr with multiple devices
@ 2014-07-10 18:21 Zhe Zhang
  2014-07-11  5:23 ` Qu Wenruo
  0 siblings, 1 reply; 3+ messages in thread
From: Zhe Zhang @ 2014-07-10 18:21 UTC (permalink / raw)
  To: linux-btrfs

When a btrfs has multiple devices (e.g. /dev/sdb, /dev/sdc), how
should I interpret disk_bytenr in btrfs_file_extent_item?

Does it depend on the striping config? Say I used raid0, then
disk_bytenr 0~64K will be on /dev/sdb, and 64K~128K on /dev/sdc?

Thanks,
Zhe

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Question] disk_bytenr with multiple devices
  2014-07-10 18:21 [Question] disk_bytenr with multiple devices Zhe Zhang
@ 2014-07-11  5:23 ` Qu Wenruo
  2014-07-14 19:44   ` Zhe Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2014-07-11  5:23 UTC (permalink / raw)
  To: Zhe Zhang, linux-btrfs


-------- Original Message --------
Subject: [Question] disk_bytenr with multiple devices
From: Zhe Zhang <zhe.zhang.research@gmail.com>
To: linux-btrfs@vger.kernel.org
Date: 2014年07月11日 02:21
> When a btrfs has multiple devices (e.g. /dev/sdb, /dev/sdc), how
> should I interpret disk_bytenr in btrfs_file_extent_item?
>
> Does it depend on the striping config? Say I used raid0, then
> disk_bytenr 0~64K will be on /dev/sdb, and 64K~128K on /dev/sdc?
>
> Thanks,
> Zhe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
https://btrfs.wiki.kernel.org/index.php/Data_Structures#btrfs_file_extent_item
As you can see in the btrfs wiki,
disk_bytenr is *logical* address in btrfs linear space. Not really on 
disk address.

If you really want the address on device, you need to find the chunk 
containing the address,
then the stripe in chunk item will show the raid profile and device 
address on each device.

Thanks,
Qu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Question] disk_bytenr with multiple devices
  2014-07-11  5:23 ` Qu Wenruo
@ 2014-07-14 19:44   ` Zhe Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Zhe Zhang @ 2014-07-14 19:44 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

Thanks Qu. I followed the wiki and your advice and finally got it working.

BTW I created a program printing the disk block addresses of a file.
URL here if anyone else finds it a useful feature:
https://github.com/oldcap/btrfs-progs/blob/master/btrfs-file-blocks.c

On Fri, Jul 11, 2014 at 1:23 AM, Qu Wenruo <quwenruo@cn.fujitsu.com> wrote:
>
> -------- Original Message --------
> Subject: [Question] disk_bytenr with multiple devices
> From: Zhe Zhang <zhe.zhang.research@gmail.com>
> To: linux-btrfs@vger.kernel.org
> Date: 2014年07月11日 02:21
>>
>> When a btrfs has multiple devices (e.g. /dev/sdb, /dev/sdc), how
>> should I interpret disk_bytenr in btrfs_file_extent_item?
>>
>> Does it depend on the striping config? Say I used raid0, then
>> disk_bytenr 0~64K will be on /dev/sdb, and 64K~128K on /dev/sdc?
>>
>> Thanks,
>> Zhe
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> https://btrfs.wiki.kernel.org/index.php/Data_Structures#btrfs_file_extent_item
> As you can see in the btrfs wiki,
> disk_bytenr is *logical* address in btrfs linear space. Not really on disk
> address.
>
> If you really want the address on device, you need to find the chunk
> containing the address,
> then the stripe in chunk item will show the raid profile and device address
> on each device.
>
> Thanks,
> Qu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-14 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-10 18:21 [Question] disk_bytenr with multiple devices Zhe Zhang
2014-07-11  5:23 ` Qu Wenruo
2014-07-14 19:44   ` Zhe Zhang

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.