Re[2]: best way to get the bdev of a bcache block device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Michael,

Tuesday, January 23, 2018, 1:20:28 AM, you wrote:

> On 01/22/2018 01:59 PM, Stefan Priebe - Profihost AG wrote:
>> Hello,
>> 
>> what's the best way to get the correct bcache backing device (bdev) form
>> a known dev (f.e. /dev/bcache2)?
>> 
>> I haven't found an easy reliable way through /sys/block.
>> 
>> Thanks!
>> 
>> Greets,
>> Stefan

> /sys/block/bcache0/slaves

This lists both the backing device and the cache device(s), without an
(apparent) way of identifying which one is backing.

> /sys/block/bcache0/bcache/cache/bdev0

/sys/block/bcache0/bcache/cache links to the cache set (/sys/fs/bcache/[UUID])
which can serve several bcache devices, so bdev0 would link to the first
backing device registered in the set, not the backing device that corresponds
to the bcache device we started with.

However, it's actually possible to go further: iterate all bdevX devices and
identify the correct one by looking at the "dev" symlink:

/sys/block/bcache0/bcache/cache/bdev0/dev
/sys/block/bcache0/bcache/cache/bdev1/dev
etc.

The device whose "dev" symlink points to bcache0 should be the backing device
for bcache0.

Pavel Goran
  

--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux