Re: [PATCH] btrfs-progs: print errno string when /dev/btrfs-control open fails

2013-03-14 Thread Anand Jain



I think the common pattern here is that error details follow the
message, like

+   "skipping device registration: %s\n",

I'll fix it here, if you don't mind.


 Pls do. Thanks David.

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


Re: [PATCH] btrfs-progs: print errno string when /dev/btrfs-control open fails

2013-03-14 Thread David Sterba
On Thu, Mar 14, 2013 at 11:17:19AM +0800, Anand Jain wrote:
>   fprintf(stderr, "failed to open /dev/btrfs-control "
> - "skipping device registration\n");
> + "%s, skipping device registration\n",
> + strerror(errno));

I think the common pattern here is that error details follow the
message, like

+   "skipping device registration: %s\n",

I'll fix it here, if you don't mind.

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


[PATCH] btrfs-progs: print errno string when /dev/btrfs-control open fails

2013-03-13 Thread Anand Jain
Of recently and intermittently I am seeing open fail
for /dev/btrfs-control (btrfs is loaded), and there are no
dmesg errors, this may not be a complete help in digging
this issue but something which is necessary.
Thanks

Signed-off-by: Anand Jain 
---
 utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/utils.c b/utils.c
index c29861b..17c6553 100644
--- a/utils.c
+++ b/utils.c
@@ -938,7 +938,8 @@ void btrfs_register_one_device(char *fname)
fd = open("/dev/btrfs-control", O_RDONLY);
if (fd < 0) {
fprintf(stderr, "failed to open /dev/btrfs-control "
-   "skipping device registration\n");
+   "%s, skipping device registration\n",
+   strerror(errno));
return;
}
strncpy(args.name, fname, BTRFS_PATH_NAME_MAX);
-- 
1.8.1.227.g44fe835

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


Re: Still Problems with /dev/btrfs-control

2010-01-09 Thread Johannes Hirte
Am Samstag 09 Januar 2010 12:05:34 schrieb Goffredo Baroncelli:
> Hi Michael
> 
> On Saturday 09 January 2010, Dipl.-Ing. Michael Niederle wrote:
> > Thanks for the quick reply!
> > 
> > But I still have problems with btrfsctl:
> > > stat /dev/btrfs-control
> > > 
> >   File: `/dev/btrfs-control'
> >   Size: 0   Blocks: 0  IO Block: 4096   block special file
> > 
> > Device: ch/12d  Inode: 659848  Links: 1 Device type: a,3e
> 
> Ok, two things:
> 
> 1) btrfs-control is a *character* device and _not_ a *block device*
> 2) on my system it is allocated under 10,55 (major/minor).

This must be checked on the target machine, as the minor number is allocated 
dynamically.

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


Re: Still Problems with /dev/btrfs-control

2010-01-09 Thread Goffredo Baroncelli
Hi Michael

On Saturday 09 January 2010, Dipl.-Ing. Michael Niederle wrote:
> Thanks for the quick reply!
> 
> But I still have problems with btrfsctl:
> > stat /dev/btrfs-control 
>   File: `/dev/btrfs-control'
>   Size: 0 Blocks: 0  IO Block: 4096   block special file
> Device: ch/12dInode: 659848  Links: 1 Device type: a,3e

Ok, two things:

1) btrfs-control is a *character* device and _not_ a *block device*
2) on my system it is allocated under 10,55 (major/minor).

$ stat /dev/btrfs-control
  File: `/dev/btrfs-control'
  Size: 0  Blocks: 0 IO Block: 4096   character special file
Device: fh/15d  Inode: 2404Links: 1 Device type: a,37
Access: (0660/crw-rw)  Uid: (0/ root)   Gid: ( 0/ root)
Access: 2010-01-09 11:35:30.764909719 +0100
Modify: 2010-01-09 11:35:30.764909719 +0100
Change: 2010-01-09 11:35:30.764909719 +0100
    gh...@venice:~$ ls -l /dev/btrfs-control
crw-rw 1 root root 10, 55 2010-01-09 11:35 /dev/btrfs-control

Looking at the source

btrfs-unstable/fs/btrfs$ grep -A 2 -B 2 "btrfs-control" *.c
super.c-static struct miscdevice btrfs_misc = {
super.c-.minor  = MISC_DYNAMIC_MINOR,
super.c:.name   = "btrfs-control",
super.c-.fops   = &btrfs_ctl_fops
super.c-};

It seems that it is dynamically allocated. The "major" should be always 10, 
the minor may be find with

$ cat /proc/misc  | grep btrfs-control
 55 btrfs-control

Or by

$ cat /sys/class/misc/btrfs-control/dev
10:55


Regards
Goffredo


> Access: (0644/brw-r--r--)  Uid: (0/root)   Gid: (0/root)
> Access: 2010-01-09 11:31:15.757979602 +0100
> Modify: 2010-01-09 11:31:15.757979602 +0100
> Change: 2010-01-09 11:31:15.757979602 +0100
> > mount -l -t btrfs
> /dev/sda3 on / type btrfs (rw,relatime,noacl) [Alpha4]
> > btrfsctl -A /dev/sda3
> failed to open /dev/btrfs-control: No such device or address
> 
> Remark: When the btrfs-filesystem is originally mounted (from the startup-
code
> in the initial ramdisk), /dev/btrfs-control is not yet existant, because the
> dev-directory is contained in the btrfs-filesystem.
> 
> Everything else works fine.
> 
> Greetings, Michael
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) 
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Still Problems with /dev/btrfs-control

2010-01-09 Thread Dipl.-Ing. Michael Niederle
Thanks for the quick reply!

But I still have problems with btrfsctl:

> stat /dev/btrfs-control 
  File: `/dev/btrfs-control'
  Size: 0   Blocks: 0  IO Block: 4096   block special file
Device: ch/12d  Inode: 659848  Links: 1 Device type: a,3e
Access: (0644/brw-r--r--)  Uid: (0/root)   Gid: (0/root)
Access: 2010-01-09 11:31:15.757979602 +0100
Modify: 2010-01-09 11:31:15.757979602 +0100
Change: 2010-01-09 11:31:15.757979602 +0100
> mount -l -t btrfs
/dev/sda3 on / type btrfs (rw,relatime,noacl) [Alpha4]
> btrfsctl -A /dev/sda3
failed to open /dev/btrfs-control: No such device or address

Remark: When the btrfs-filesystem is originally mounted (from the startup-code
in the initial ramdisk), /dev/btrfs-control is not yet existant, because the
dev-directory is contained in the btrfs-filesystem.

Everything else works fine.

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


Re: /dev/btrfs-control

2010-01-08 Thread Kay Sievers
On Fri, Jan 8, 2010 at 17:37, Michael Niederle  wrote:
> Some btrfs-tools make use of "/dev/btrfs-control".
>
> How should I create this node? Is this a block or a character device (I 
> suppose
> it should be a character device), which major and minor numbers should be
> assigned?

It's a char device node:
  $ cat /sys/class/misc/btrfs-control/dev
  10:62

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


/dev/btrfs-control

2010-01-08 Thread Michael Niederle
Some btrfs-tools make use of "/dev/btrfs-control".

How should I create this node? Is this a block or a character device (I suppose
it should be a character device), which major and minor numbers should be
assigned?

I do not use udev, so I have to create all device nodes "by hand" or "by
script".

I started using btrfs with the arrival of kernel 2.6.32 - no problems until
now! :-) I'm very interested in using its snapshot feature. Currently I'm not
able to mount a snapshot (subvolume), but this might be connected to the
missing device-node.

Thanks in advance for any help,

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