linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* best way to get the bdev of a bcache block device
@ 2018-01-22 21:59 Stefan Priebe - Profihost AG
  2018-01-22 22:20 ` Michael Lyle
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Priebe - Profihost AG @ 2018-01-22 21:59 UTC (permalink / raw)
  To: linux-bcache

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

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

* Re: best way to get the bdev of a bcache block device
  2018-01-22 21:59 best way to get the bdev of a bcache block device Stefan Priebe - Profihost AG
@ 2018-01-22 22:20 ` Michael Lyle
  2018-01-23  4:32   ` Re[2]: " Pavel Goran
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Lyle @ 2018-01-22 22:20 UTC (permalink / raw)
  To: Stefan Priebe - Profihost AG, linux-bcache

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
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

/sys/block/bcache0/slaves

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

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

* Re[2]: best way to get the bdev of a bcache block device
  2018-01-22 22:20 ` Michael Lyle
@ 2018-01-23  4:32   ` Pavel Goran
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Goran @ 2018-01-23  4:32 UTC (permalink / raw)
  To: linux-bcache; +Cc: Stefan Priebe - Profihost AG

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
  

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

end of thread, other threads:[~2018-01-23  4:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 21:59 best way to get the bdev of a bcache block device Stefan Priebe - Profihost AG
2018-01-22 22:20 ` Michael Lyle
2018-01-23  4:32   ` Re[2]: " Pavel Goran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).