linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* minor ID for btrfs-control
@ 2011-04-02 16:45 Helmut Hullen
  2011-04-02 17:29 ` Tomasz Torcz
  2011-04-02 22:35 ` Goffredo Baroncelli
  0 siblings, 2 replies; 14+ messages in thread
From: Helmut Hullen @ 2011-04-02 16:45 UTC (permalink / raw)
  To: linux-btrfs

Hallo,

if I've understood some mails in this list correct, then btrfs needs a  
character device "btrfs-control"  with the ID 10:55

When I look for this device in

        /sys/class/misc/btrfs-control/dev

I see 10:234

And when I run the command

  mkfs.btrfs -d raid0 -m raid1 /dev/sda1 /dev/sdc1

I get the error messages

  failed to open /dev/btrfs-control skipping device registration

---

  ls -l /dev/bt*

shows

  crw-rw-rw- 1 root root 10,55 2. Apr 17:55 /dev/btrfs-control

---

Kernel 2.6.38.1 (self made), no udev, no initrd, no tempfs. btrfs from  
nov. 2010

What goes wrong?


Viele Gruesse!
Helmut

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

* Re: minor ID for btrfs-control
  2011-04-02 16:45 minor ID for btrfs-control Helmut Hullen
@ 2011-04-02 17:29 ` Tomasz Torcz
  2011-04-02 18:06   ` Helmut Hullen
  2011-04-03  9:42   ` Helmut Hullen
  2011-04-02 22:35 ` Goffredo Baroncelli
  1 sibling, 2 replies; 14+ messages in thread
From: Tomasz Torcz @ 2011-04-02 17:29 UTC (permalink / raw)
  To: linux-btrfs

On Sat, Apr 02, 2011 at 06:45:00PM +0200, Helmut Hullen wrote:
> if I've understood some mails in this list correct, then btrfs needs a  
> character device "btrfs-control"  with the ID 10:55
> 
> When I look for this device in
> 
>         /sys/class/misc/btrfs-control/dev
> 
> I see 10:234
> Kernel 2.6.38.1 (self made), no udev, no initrd, no tempfs. btrfs from  
> nov. 2010
> What goes wrong?


  No udev is wrong.  Modern Linux kernels allocate minor devices dynamically.
If you do not use udev, you need to synchronise /dev/ node with /sys/class/misc/btrfs-control/dev
manually on each boot.

-- 
Tomasz Torcz       ,,(...) today's high-end is tomorrow's embedded processor.''
xmpp: zdzichubg@chrome.pl                      -- Mitchell Blank on LKML


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

* Re: minor ID for btrfs-control
  2011-04-02 17:29 ` Tomasz Torcz
@ 2011-04-02 18:06   ` Helmut Hullen
  2011-04-03  9:42   ` Helmut Hullen
  1 sibling, 0 replies; 14+ messages in thread
From: Helmut Hullen @ 2011-04-02 18:06 UTC (permalink / raw)
  To: linux-btrfs

Hallo, Tomasz,

Du meintest am 02.04.11:

>   No udev is wrong.

Sorry - no.
On the machines I use I don't need udev (they are a kind of server, not  
end user workstations with often changing hardware). And I could abstain  
(? - please excuse my gerlish) from btrfs, but not from fixed device  
names.

I may not believe that btrfs only works under udev.

>   Modern Linux kernels allocate minor devices
> dynamically. If you do not use udev, you need to synchronise /dev/
> node with /sys/class/misc/btrfs-control/dev manually on each boot.

How and where? From where gets the system the actual minor number 234  
instead of the defined number 55?

By the way - the btrfs module is "builtin", is that a problem?

Viele Gruesse!
Helmut

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

* Re: minor ID for btrfs-control
  2011-04-02 16:45 minor ID for btrfs-control Helmut Hullen
  2011-04-02 17:29 ` Tomasz Torcz
@ 2011-04-02 22:35 ` Goffredo Baroncelli
  2011-04-02 23:30   ` Peter Stuge
  2011-04-03  3:11   ` Helmut Hullen
  1 sibling, 2 replies; 14+ messages in thread
From: Goffredo Baroncelli @ 2011-04-02 22:35 UTC (permalink / raw)
  To: helmut; +Cc: Helmut Hullen, linux-btrfs

On 04/02/2011 06:45 PM, Helmut Hullen wrote:
> Hallo,
> 
> if I've understood some mails in this list correct, then btrfs needs a  
> character device "btrfs-control"  with the ID 10:55
> 
> When I look for this device in
> 
>         /sys/class/misc/btrfs-control/dev
> 
> I see 10:234
> 
> And when I run the command
> 
>   mkfs.btrfs -d raid0 -m raid1 /dev/sda1 /dev/sdc1
> 
> I get the error messages
> 
>   failed to open /dev/btrfs-control skipping device registration
> 
> ---
> 
>   ls -l /dev/bt*
> 
> shows
> 
>   crw-rw-rw- 1 root root 10,55 2. Apr 17:55 /dev/btrfs-control
> 
> ---
> 
> Kernel 2.6.38.1 (self made), no udev, no initrd, no tempfs. btrfs from  
> nov. 2010
> 
> What goes wrong?

As wrote by Tomasz the minor number of the btrfs-control is allocated
dynamically. A lot of drivers create a device which is registered
dynamically in the "misc" group. In linux this is a well established
behavior from a long time.

If you don't want to use udev you have two choices:
- use devtmpfs
- create manually a device. But nobody guarantee that the minor/major
will not  change.



> 
> 
> Viele Gruesse!
> Helmut
> --
> 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
> .
> 


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

* Re: minor ID for btrfs-control
  2011-04-02 22:35 ` Goffredo Baroncelli
@ 2011-04-02 23:30   ` Peter Stuge
  2011-04-03  4:12     ` Helmut Hullen
  2011-04-03  3:11   ` Helmut Hullen
  1 sibling, 1 reply; 14+ messages in thread
From: Peter Stuge @ 2011-04-02 23:30 UTC (permalink / raw)
  To: linux-btrfs

Goffredo Baroncelli wrote:
> If you don't want to use udev you have two choices:
> - use devtmpfs
> - create manually a device. But nobody guarantee that the minor/major
> will not  change.

- use a udev replacement intended for embedded systems, such as mdev


//Peter

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

* Re: minor ID for btrfs-control
  2011-04-02 22:35 ` Goffredo Baroncelli
  2011-04-02 23:30   ` Peter Stuge
@ 2011-04-03  3:11   ` Helmut Hullen
  2011-04-03 10:24     ` Goffredo Baroncelli
  1 sibling, 1 reply; 14+ messages in thread
From: Helmut Hullen @ 2011-04-03  3:11 UTC (permalink / raw)
  To: linux-btrfs

Hallo, Goffredo,

Du meintest am 03.04.11:

>> if I've understood some mails in this list correct, then btrfs needs
>> a character device "btrfs-control"  with the ID 10:55
>>
>> When I look for this device in
>>
>>         /sys/class/misc/btrfs-control/dev
>>
>> I see 10:234

> As wrote by Tomasz the minor number of the btrfs-control is allocated
> dynamically.

At which place?

> If you don't want to use udev you have two choices:
> - use devtmpfs

That leads to similar problems as "udev": I have to define on another  
place ("/lib/udev/devices") the desired device.

> - create manually a device. But nobody guarantee that the minor/major
> will not  change.

That seems to be the behaviour I'm watching on my test machine. "hard  
coded" device with 10:55, but the system uses 10:234

If btrfs is designed to work only under udev then it has to check wether  
udev is running.

Viele Gruesse!
Helmut

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

* Re: minor ID for btrfs-control
  2011-04-02 23:30   ` Peter Stuge
@ 2011-04-03  4:12     ` Helmut Hullen
  0 siblings, 0 replies; 14+ messages in thread
From: Helmut Hullen @ 2011-04-03  4:12 UTC (permalink / raw)
  To: linux-btrfs

Hallo, Peter,

Du meintest am 03.04.11:

>> If you don't want to use udev you have two choices:
>> - use devtmpfs
>> - create manually a device. But nobody guarantee that the
>> minor/major will not  change.

> - use a udev replacement intended for embedded systems, such as mdev


http://wildanm.wordpress.com/2007/08/21/mdev-mini-udev-in-busybox/
http://tinderbox.dev.gentoo.org/misc/mdev.conf

I'll take a try - thank you!

Viele Gruesse!
Helmut

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

* Re: minor ID for btrfs-control
  2011-04-02 17:29 ` Tomasz Torcz
  2011-04-02 18:06   ` Helmut Hullen
@ 2011-04-03  9:42   ` Helmut Hullen
  2011-04-03 12:28     ` Peter Stuge
  1 sibling, 1 reply; 14+ messages in thread
From: Helmut Hullen @ 2011-04-03  9:42 UTC (permalink / raw)
  To: linux-btrfs

Hallo, Tomasz,

Du meintest am 02.04.11:

>> if I've understood some mails in this list correct, then btrfs needs
>> a character device "btrfs-control"  with the ID 10:55
>>
>> When I look for this device in
>>
>>         /sys/class/misc/btrfs-control/dev
>>
>> I see 10:234


> If you do not use udev, you need to synchronise /dev/
> node with /sys/class/misc/btrfs-control/dev manually on each boot.

Solved (something like reverse engineering).

I re-create the (permanent) entry /dev/btrfs-control using the actual  
contents of "/sys/class/misc/btrfs-control/dev", and btrfs is happy (and  
me too).

Works now on two of my machines for the next long time test ...

------------------

I'll watch who changes the data ... some part of some program must have  
defined 234 as minor ID.

Viele Gruesse!
Helmut

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

* Re: minor ID for btrfs-control
  2011-04-03  3:11   ` Helmut Hullen
@ 2011-04-03 10:24     ` Goffredo Baroncelli
  2011-04-03 10:52       ` Helmut Hullen
  0 siblings, 1 reply; 14+ messages in thread
From: Goffredo Baroncelli @ 2011-04-03 10:24 UTC (permalink / raw)
  To: helmut; +Cc: Helmut Hullen, linux-btrfs

Hello Helmut,

On 04/03/2011 05:11 AM, Helmut Hullen wrote:
> Hallo, Goffredo,
[..]
>> As wrote by Tomasz the minor number of the btrfs-control is allocated
>> dynamically.
> 
> At which place?

I replied you too fast. Btrfs register a "misc" device, but its number
is not dynamically allocated (see [1] for further information), but it
is static.

$ grep BTRFS_MINOR -r include/
include/linux/miscdevice.h:#define BTRFS_MINOR          234

I can conclude that _now_ the minor is 234 and not 55. But I don't know
if it is a _stable_ interface.

I think that during the boot you should check the minor with

grep btrfs-control /proc/misc | awk '{ print $1 }'


Regards
G.Baroncelli

[1] http://www.linuxjournal.com/article/2920

> 
> Viele Gruesse!
> Helmut
> --
> 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
> .
> 


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

* Re: minor ID for btrfs-control
  2011-04-03 10:24     ` Goffredo Baroncelli
@ 2011-04-03 10:52       ` Helmut Hullen
  0 siblings, 0 replies; 14+ messages in thread
From: Helmut Hullen @ 2011-04-03 10:52 UTC (permalink / raw)
  To: linux-btrfs

Hallo, Goffredo,

Du meintest am 03.04.11:

>>> As wrote by Tomasz the minor number of the btrfs-control is
>>> allocated dynamically.

>> At which place?

> I replied you too fast. Btrfs register a "misc" device, but its
> number is not dynamically allocated (see [1] for further
> information), but it is static.

> $ grep BTRFS_MINOR -r include/
> include/linux/miscdevice.h:#define BTRFS_MINOR          234

Ah - there it is!
I'd only searched in fs/btrfs

> I can conclude that _now_ the minor is 234 and not 55. But I don't
> know if it is a _stable_ interface.

We'll see ... now I know the error message and the place where I can  
examine the actual major and minor value. Should be enough information  
for the next months ...

Thank you!

Viele Gruesse!
Helmut

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

* Re: minor ID for btrfs-control
  2011-04-03  9:42   ` Helmut Hullen
@ 2011-04-03 12:28     ` Peter Stuge
  2011-04-03 13:33       ` Helmut Hullen
  0 siblings, 1 reply; 14+ messages in thread
From: Peter Stuge @ 2011-04-03 12:28 UTC (permalink / raw)
  To: linux-btrfs

Helmut Hullen wrote:
> > If you do not use udev, you need to synchronise /dev/
> > node with /sys/class/misc/btrfs-control/dev manually on each boot.
> 
> Solved (something like reverse engineering).
> 
> I re-create the (permanent) entry /dev/btrfs-control using the
> actual contents of "/sys/class/misc/btrfs-control/dev", and btrfs
> is happy (and me too).

This is fine, and is just what udev does; it creates the correct
device node using kernel data.


//Peter

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

* Re: minor ID for btrfs-control
  2011-04-03 12:28     ` Peter Stuge
@ 2011-04-03 13:33       ` Helmut Hullen
  2011-04-03 14:00         ` Peter Stuge
  0 siblings, 1 reply; 14+ messages in thread
From: Helmut Hullen @ 2011-04-03 13:33 UTC (permalink / raw)
  To: linux-btrfs

Hallo, Peter,

Du meintest am 03.04.11:

>> Solved (something like reverse engineering).
>>
>> I re-create the (permanent) entry /dev/btrfs-control using the
>> actual contents of "/sys/class/misc/btrfs-control/dev", and btrfs
>> is happy (and me too).

> This is fine, and is just what udev does; it creates the correct
> device node using kernel data.

Maybe. But if I want a cup of milk I don't buy a complete cow ...

Viele Gruesse!
Helmut

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

* Re: minor ID for btrfs-control
  2011-04-03 13:33       ` Helmut Hullen
@ 2011-04-03 14:00         ` Peter Stuge
  2011-04-03 14:33           ` Helmut Hullen
  0 siblings, 1 reply; 14+ messages in thread
From: Peter Stuge @ 2011-04-03 14:00 UTC (permalink / raw)
  To: linux-btrfs

Helmut Hullen wrote:
> >> Solved (something like reverse engineering).
> >>
> >> I re-create the (permanent) entry /dev/btrfs-control using the
> >> actual contents of "/sys/class/misc/btrfs-control/dev", and btrfs
> >> is happy (and me too).
> 
> > This is fine, and is just what udev does; it creates the correct
> > device node using kernel data.
> 
> Maybe. But if I want a cup of milk I don't buy a complete cow ...

My point was that it's not so much reverse engineering, it's exactly
how udev works, and that also makes it a really reliable solution.


//Peter

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

* Re: minor ID for btrfs-control
  2011-04-03 14:00         ` Peter Stuge
@ 2011-04-03 14:33           ` Helmut Hullen
  0 siblings, 0 replies; 14+ messages in thread
From: Helmut Hullen @ 2011-04-03 14:33 UTC (permalink / raw)
  To: linux-btrfs

Hallo, Peter,

Du meintest am 03.04.11:

>>>> Solved (something like reverse engineering).

[...]

> My point was that it's not so much reverse engineering, it's exactly
> how udev works, and that also makes it a really reliable solution.

But in this special case Goffredo has shown that I neither need udev nor  
reverse engineering: the minor number is hard coded (but may have  
changed some time ago).

Viele Gruesse!
Helmut

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

end of thread, other threads:[~2011-04-03 14:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-02 16:45 minor ID for btrfs-control Helmut Hullen
2011-04-02 17:29 ` Tomasz Torcz
2011-04-02 18:06   ` Helmut Hullen
2011-04-03  9:42   ` Helmut Hullen
2011-04-03 12:28     ` Peter Stuge
2011-04-03 13:33       ` Helmut Hullen
2011-04-03 14:00         ` Peter Stuge
2011-04-03 14:33           ` Helmut Hullen
2011-04-02 22:35 ` Goffredo Baroncelli
2011-04-02 23:30   ` Peter Stuge
2011-04-03  4:12     ` Helmut Hullen
2011-04-03  3:11   ` Helmut Hullen
2011-04-03 10:24     ` Goffredo Baroncelli
2011-04-03 10:52       ` Helmut Hullen

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).