You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(32) |
Jun
(66) |
Jul
(102) |
Aug
(78) |
Sep
(106) |
Oct
(137) |
Nov
(147) |
Dec
(147) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(71) |
Feb
(139) |
Mar
(86) |
Apr
(76) |
May
(57) |
Jun
(10) |
Jul
(12) |
Aug
(6) |
Sep
(8) |
Oct
(12) |
Nov
(12) |
Dec
(18) |
| 2011 |
Jan
(16) |
Feb
(19) |
Mar
(3) |
Apr
(1) |
May
(16) |
Jun
(17) |
Jul
(74) |
Aug
(22) |
Sep
(18) |
Oct
(24) |
Nov
(21) |
Dec
(30) |
| 2012 |
Jan
(31) |
Feb
(16) |
Mar
(22) |
Apr
(25) |
May
(18) |
Jun
(13) |
Jul
(83) |
Aug
(49) |
Sep
(20) |
Oct
(60) |
Nov
(35) |
Dec
(28) |
| 2013 |
Jan
(39) |
Feb
(61) |
Mar
(35) |
Apr
(21) |
May
(45) |
Jun
(56) |
Jul
(20) |
Aug
(9) |
Sep
(10) |
Oct
(31) |
Nov
(8) |
Dec
(4) |
| 2014 |
Jan
(6) |
Feb
(7) |
Mar
(7) |
Apr
(6) |
May
(4) |
Jun
(8) |
Jul
(5) |
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
(11) |
Dec
(5) |
| 2015 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(4) |
May
(9) |
Jun
(4) |
Jul
(15) |
Aug
(8) |
Sep
(16) |
Oct
(18) |
Nov
(15) |
Dec
(7) |
| 2016 |
Jan
(20) |
Feb
(9) |
Mar
(15) |
Apr
(24) |
May
(16) |
Jun
(28) |
Jul
(22) |
Aug
(23) |
Sep
(18) |
Oct
(30) |
Nov
(40) |
Dec
(9) |
| 2017 |
Jan
(1) |
Feb
(8) |
Mar
(37) |
Apr
(26) |
May
(25) |
Jun
(46) |
Jul
(24) |
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Tejun H. <tj...@ke...> - 2011-08-25 10:16:14
|
Hello, On Thu, Aug 25, 2011 at 06:03:59PM +0900, Nao Nishijima wrote: > This patch series provide an "alias" of the disk into kernel messages. > > A raw device name of a disk does not always point a same disk at each boot-up > time. Therefore, users have to use persistent device names, which udev creates > to always access the same disk. However, kernel messages still display the raw > device names. > > My proposal is that users can use and see persistent device names which were > assigned by themselves because users expect same name to point same disk > anytime. > > Why need to modify kernel messages? > - We can see mapping of device names and persistent device names in udev log. > If those logs output to syslog, we can search persistent device name from > device name, but it can cause a large amount of syslog output. > > - If we can use the persistent device names and can always see the same name on > the kernel log, we don't need to pay additional cost for searching and picking > a correct pair of device name and persistent device name from udev log. > > - Kernel messages are output to serial console when kenel crashes, it's so hard > to convert a device name to the alias. Just some general comments. This may already be a horse which is beaten to death but anyways... I'm not really convinced this is something we need. What we're missing is structured error reporting which can be understood, processed, presented and reacted by programs implementing system management policies. Such facility would be useful in general but for block devices I think it's a must that we're sorely missing. Free format kernel message is a very undiscoverable way of communicating these information. For developing and debugging, it's fine. It's easy, flexible and you don't really have to think too much about what should be presented how. For anything else, it's basically horrible. I don't really see what the point of this feature is. For developing and debugging, pretty names might be nice but almost completely unnecessary. For anything else, this falls way too short and can be easily replaced by some smart scripting from userland. After all, matching different device names is the least of the worries when trying to use kernel log for general management and post-processing w/ good amount of heuristics is necessary to be useful anyway. So, FWIW, I object. Thank you. -- tejun |
|
From: Nao N. <nao...@hi...> - 2011-08-25 09:10:38
|
From: Joe Perches <jo...@pe...>
Reduce size of code and text of scmd_printk and sd_printk
macros by converting to the macros to functions and using
vsprintf extension %pV. This moves the code out-of-line
and centralizes the code used to emit additional arguments.
Save ~32KB of space in an x86 allyesconfig.
$ size drivers/scsi/built-in.o*
text data bss dec hex filename
5860439 135396 1393024 7388859 70bebb drivers/scsi/built-in.o.new
5882368 135396 1395848 7413612 711f6c drivers/scsi/built-in.o.old
5887100 135396 1397264 7419760 713770 drivers/scsi/built-in.o.with_patch_1_and_2
Signed-off-by: Joe Perches <jo...@pe...>
Reviewed-by: Nao Nishijima <nao...@hi...>
---
drivers/scsi/scsi_lib.c | 26 ++++++++++++++++++++++++++
drivers/scsi/sd.c | 23 +++++++++++++++++++++++
drivers/scsi/sd.h | 8 +++-----
include/scsi/scsi_device.h | 8 +++-----
4 files changed, 55 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index fc3f168..63579d4 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2574,3 +2574,29 @@ void scsi_kunmap_atomic_sg(void *virt)
kunmap_atomic(virt, KM_BIO_SRC_IRQ);
}
EXPORT_SYMBOL(scsi_kunmap_atomic_sg);
+
+/* Logging utilities */
+
+int scmd_printk(const char *prefix, const struct scsi_cmnd *scmd,
+ const char *format, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int r;
+
+ va_start(args, format);
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ if (scmd->request->rq_disk)
+ r = sdev_printk(prefix, scmd->device, "[%s] %pV",
+ alias_name(scmd->request->rq_disk), &vaf);
+ else
+ r = sdev_printk(prefix, scmd->device, "%pV", &vaf);
+
+ va_end(args);
+
+ return r;
+}
+EXPORT_SYMBOL(scmd_printk);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a7942e5..7824f7a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2889,3 +2889,26 @@ static void sd_print_result(struct scsi_disk *sdkp, int result)
scsi_show_result(result);
}
+int sd_printk(const char *prefix, const struct scsi_disk *sdsk,
+ const char *format, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int r;
+
+ va_start(args, format);
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ if (sdsk->disk)
+ r = sdev_printk(prefix, sdsk->device, "[%s] %pV",
+ alias_name(sdsk->disk), &vaf);
+ else
+ r = sdev_printk(prefix, sdsk->device, "%pV", &vaf);
+
+ va_end(args);
+
+ return r;
+}
+EXPORT_SYMBOL(sd_printk);
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 6ad798b..46aa748 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -88,11 +88,9 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
return container_of(disk->private_data, struct scsi_disk, driver);
}
-#define sd_printk(prefix, sdsk, fmt, a...) \
- (sdsk)->disk ? \
- sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
- (sdsk)->disk->disk_name, ##a) : \
- sdev_printk(prefix, (sdsk)->device, fmt, ##a)
+extern __attribute__((format (printf, 3, 4)))
+int sd_printk(const char *prefix, const struct scsi_disk *sdsk,
+ const char *format, ...);
/*
* A DIF-capable target device can be formatted with different
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d371c3c..2632502 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -216,11 +216,9 @@ struct scsi_dh_data {
#define sdev_printk(prefix, sdev, fmt, a...) \
dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
-#define scmd_printk(prefix, scmd, fmt, a...) \
- (scmd)->request->rq_disk ? \
- sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \
- (scmd)->request->rq_disk->disk_name, ##a) : \
- sdev_printk(prefix, (scmd)->device, fmt, ##a)
+extern __attribute__((format (printf, 3, 4)))
+int scmd_printk(const char *prefix, const struct scsi_cmnd *scmd,
+ const char *format, ...);
enum scsi_target_state {
STARGET_CREATED = 1,
|
|
From: Nao N. <nao...@hi...> - 2011-08-25 09:10:31
|
sd_ioctl() still use printk() for log output.
It should use sd_printk() instead of printk(), as well as other sd_*.
All SCSI messages should output via s*_printk() instead of printk().
Signed-off-by: Nao Nishijima <nao...@hi...>
---
drivers/scsi/sd.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 953773c..a7942e5 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1066,12 +1066,13 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
struct gendisk *disk = bdev->bd_disk;
- struct scsi_device *sdp = scsi_disk(disk)->device;
+ struct scsi_disk *sdkp = scsi_disk(disk);
+ struct scsi_device *sdp = sdkp->device;
void __user *p = (void __user *)arg;
int error;
- SCSI_LOG_IOCTL(1, printk("sd_ioctl: disk=%s, cmd=0x%x\n",
- disk->disk_name, cmd));
+ SCSI_LOG_IOCTL(1, sd_printk(KERN_INFO, sdkp, "sd_ioctl: disk=%s, "
+ "cmd=0x%x\n", disk->disk_name, cmd));
/*
* If we are in the middle of error recovery, don't let anyone
|
|
From: Nao N. <nao...@hi...> - 2011-08-25 09:10:22
|
This patch allows the user to set an "alias" of the disk via sysfs interface.
This patch only adds a new attribute "alias" in gendisk structure.
To show the alias instead of the device name in kernel messages,
we need to revise printk messages and use alias_name() in them.
Example:
(current) printk("disk name is %s\n", disk->disk_name);
(new) printk("disk name is %s\n", alias_name(disk));
Users can use alphabets, numbers, '-' and '_' in "alias" attribute. A disk can
have an "alias" which length is up to 255 bytes. This attribute is write-once.
Suggested-by: James Bottomley <Jam...@Ha...>
Suggested-by: Jon Masters <jc...@re...>
Signed-off-by: Nao Nishijima <nao...@hi...>
---
Documentation/ABI/testing/sysfs-block | 13 ++++++
block/genhd.c | 71 +++++++++++++++++++++++++++++++++
include/linux/genhd.h | 4 ++
3 files changed, 88 insertions(+), 0 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block
index c1eb41c..2b5d561 100644
--- a/Documentation/ABI/testing/sysfs-block
+++ b/Documentation/ABI/testing/sysfs-block
@@ -206,3 +206,16 @@ Description:
when a discarded area is read the discard_zeroes_data
parameter will be set to one. Otherwise it will be 0 and
the result of reading a discarded area is undefined.
+What: /sys/block/<disk>/alias
+Date: Aug 2011
+Contact: Nao Nishijima <nao...@hi...>
+Description:
+ A raw device name of a disk does not always point a same disk
+ each boot-up time. Therefore, users have to use persistent
+ device names, which udev creates when the kernel finds a disk,
+ instead of raw device name. However, kernel doesn't show those
+ persistent names on its messages (e.g. dmesg).
+ This file can store an alias of the disk and it would be
+ appeared in kernel messages if it is set. A disk can have an
+ alias which length is up to 255bytes. Users can use alphabets,
+ numbers, "-" and "_" in alias name. This file is writeonce.
diff --git a/block/genhd.c b/block/genhd.c
index e2f6790..94855a9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -19,6 +19,7 @@
#include <linux/mutex.h>
#include <linux/idr.h>
#include <linux/log2.h>
+#include <linux/ctype.h>
#include "blk.h"
@@ -909,6 +910,74 @@ static int __init genhd_device_init(void)
subsys_initcall(genhd_device_init);
+static ssize_t alias_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ ssize_t ret = 0;
+
+ if (disk->alias)
+ ret = snprintf(buf, ALIAS_LEN, "%s\n", disk->alias);
+ return ret;
+}
+
+static ssize_t alias_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ char *alias;
+ char *envp[] = { NULL, NULL };
+ unsigned char c;
+ int i;
+ ssize_t ret = count;
+
+ if (!count)
+ return -EINVAL;
+
+ if (count >= ALIAS_LEN) {
+ printk(KERN_ERR "alias: alias is too long\n");
+ return -EINVAL;
+ }
+
+ /* Validation check */
+ for (i = 0; i < count; i++) {
+ c = buf[i];
+ if (i == count - 1 && c == '\n')
+ break;
+ if (!isalnum(c) && c != '_' && c != '-') {
+ printk(KERN_ERR "alias: invalid alias\n");
+ return -EINVAL;
+ }
+ }
+
+ if (disk->alias) {
+ printk(KERN_INFO "alias: %s is already assigned (%s)\n",
+ disk->disk_name, disk->alias);
+ return -EINVAL;
+ }
+
+ alias = kasprintf(GFP_KERNEL, "%s", buf);
+ if (!alias)
+ return -ENOMEM;
+
+ if (alias[count - 1] == '\n')
+ alias[count - 1] = '\0';
+
+ envp[0] = kasprintf(GFP_KERNEL, "ALIAS=%s", alias);
+ if (!envp[0]) {
+ kfree(alias);
+ return -ENOMEM;
+ }
+
+ disk->alias = alias;
+ printk(KERN_INFO "alias: assigned %s to %s\n", alias, disk->disk_name);
+
+ kobject_uevent_env(&dev->kobj, KOBJ_ADD, envp);
+
+ kfree(envp[0]);
+ return ret;
+}
+
static ssize_t disk_range_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -968,6 +1037,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
}
+static DEVICE_ATTR(alias, S_IRUGO|S_IWUSR, alias_show, alias_store);
static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL);
static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL);
static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL);
@@ -990,6 +1060,7 @@ static struct device_attribute dev_attr_fail_timeout =
#endif
static struct attribute *disk_attrs[] = {
+ &dev_attr_alias.attr,
&dev_attr_range.attr,
&dev_attr_ext_range.attr,
&dev_attr_removable.attr,
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 02fa469..6957350 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -21,6 +21,8 @@
#define dev_to_part(device) container_of((device), struct hd_struct, __dev)
#define disk_to_dev(disk) (&(disk)->part0.__dev)
#define part_to_dev(part) (&((part)->__dev))
+#define alias_name(disk) ((disk)->alias ? (disk)->alias : \
+ (disk)->disk_name)
extern struct device_type part_type;
extern struct kobject *block_depr;
@@ -58,6 +60,7 @@ enum {
#define DISK_MAX_PARTS 256
#define DISK_NAME_LEN 32
+#define ALIAS_LEN 256
#include <linux/major.h>
#include <linux/device.h>
@@ -162,6 +165,7 @@ struct gendisk {
* disks that can't be partitioned. */
char disk_name[DISK_NAME_LEN]; /* name of major driver */
+ char *alias; /* alias name of disk */
char *(*devnode)(struct gendisk *gd, mode_t *mode);
unsigned int events; /* supported events */
|
|
From: Nao N. <nao...@hi...> - 2011-08-25 09:10:15
|
Hi,
This patch series provide an "alias" of the disk into kernel messages.
A raw device name of a disk does not always point a same disk at each boot-up
time. Therefore, users have to use persistent device names, which udev creates
to always access the same disk. However, kernel messages still display the raw
device names.
My proposal is that users can use and see persistent device names which were
assigned by themselves because users expect same name to point same disk
anytime.
Why need to modify kernel messages?
- We can see mapping of device names and persistent device names in udev log.
If those logs output to syslog, we can search persistent device name from
device name, but it can cause a large amount of syslog output.
- If we can use the persistent device names and can always see the same name on
the kernel log, we don't need to pay additional cost for searching and picking
a correct pair of device name and persistent device name from udev log.
- Kernel messages are output to serial console when kenel crashes, it's so hard
to convert a device name to the alias.
Of course, I am going to modify the commands using device name so that users
can use an alias of the disk.
Changes in v3:
- "alias_name" was changed to "alias"
- The function to notify the partitions of uevent was deleted
How to use:
1. Build and install the kernel with this series, and reboot with the kernel.
2. Check device names.
[localhost]# cat /proc/partitions
major minor #blocks name
8 0 12582912 sda
8 1 12582878 sda1
8 0 8388608 sdb
8 1 512000 sdb1
8 2 7875584 sdb2
3. Make a script of get alias
[localhost]# vi /lib/udev/get_alias
#!/bin/sh -e
DEVNAME=`echo $1 | sed -e 's/[0-9]//g'`
echo "ALIAS=`cat /sys/block/$DEVNAME/alias`"
exit 0
And you should set an execute bit,
[localhost]# chmod +x /lib/udev/get_alias
4. Check disk's id
Here is an example to get the serial id and the path of the device.
Some devices have not the serial id. Therefore, to identify a device,
users need to get the path of the device.
[localhost]# udevadm info --query=property --path=/sys/block/sda \
| grep ID_SERIAL=
ID_SERIAL=0QEMU_QEMU_HARDDISK_drive-scsi0-0-1
or you can also use the path of the device
[localhost]# udevadm info --query=property --path=/sys/block/sr0 \
| grep ID_PATH=
ID_PATH=pci-0000:00:01.1-scsi-1:0:0:0
5. Write udev rules as follows
(The user assigns "foo" to sda and "bar" to sr0)
We use ENV{ID_SERIAL} or ENV{ID_PATH} (get by 3) to identify a disk.
And to assign automatically an "alias", we use ATTR key.
If ENV{ALIAS} is empty, we use to get an "alias" by get_alias script.
[localhost]# vi /etc/udev/rules.d/70-persistent-alias.rules
SUBSYSTEM!="block", GOTO="end"
ATTR{alias}!="", GOTO="symlink"
# write alias for sdX
KERNEL=="sd*[!0-9]", ACTION=="add", ATTR{alias}="foo", \
ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_drive-scsi0-0-1"
# write alias for srX
KERNEL=="sr[0-9]", ACTION=="add", ATTR{alias}="bar", \
ENV{ID_PATH}=="pci-0000:00:01.1-scsi-1:0:0:0"
LABEL="symlink"
# make symlink
ENV{DEVTYPE}=="disk|partition", ENV{ALIAS}=="", \
IMPORT{program}="/lib/udev/get_alias %k"
ENV{DEVTYPE}=="disk", ENV{ALIAS}=="?*", SYMLINK+="disk/by-alias/$env{ALIAS}"
ENV{DEVTYPE}=="partition", ENV{ALIAS}=="?*", \
SYMLINK+="disk/by-alias/$env{ALIAS}%n"
LABEL="end"
6. reboot
After reboot, we can see aliases in kernel messages.
[localhost]# ls -l /dev/disk/by-alias/
total 0
lrwxrwxrwx. 1 root root 9 Jul 1 21:21 bar -> ../../sr0
lrwxrwxrwx. 1 root root 9 Jul 1 21:21 foo -> ../../sda
lrwxrwxrwx. 1 root root 10 Jul 1 21:21 foo1 -> ../../sda1
[localhost]# dmesg
...
sd 2:0:1:0: [sda] Attached SCSI disk
alias: assigned foo to sda
sd 2:0:1:0: [foo] Send: 0xffff88007a82cd00
sd 2:0:1:0: [foo] CDB: Write(10): 2a 00 01 58 0c 8a 00 00 08 00
buffer = 0xffff88007a82c500, bufflen = 4096, queuecommand 0xffffffffa00277fd
leaving scsi_dispatch_cmnd()
sd 2:0:1:0: [foo] Done: 0xffff88007a82cd00 SUCCESS
sd 2:0:1:0: [foo] Result: hostbyte=DID_OK driverbyte=DRIVER_OK
sd 2:0:1:0: [foo] CDB: Write(10): 2a 00 01 58 0c 8a 00 00 08 00
...
When a new device is added, the udev appends a new rule manually.
In the future, it is appended automatically, as like NIC.
Best Regards,
---
Joe Perches (1):
sd: modify printk for alias name
Nao Nishijima (2):
sd: [cleanup] Use sd_printk() instead of printk()
block: add a new attribute "alias" in gendisk
Documentation/ABI/testing/sysfs-block | 13 ++++++
block/genhd.c | 71 +++++++++++++++++++++++++++++++++
drivers/scsi/scsi_lib.c | 26 ++++++++++++
drivers/scsi/sd.c | 30 +++++++++++++-
drivers/scsi/sd.h | 8 +---
include/linux/genhd.h | 4 ++
include/scsi/scsi_device.h | 8 +---
7 files changed, 147 insertions(+), 13 deletions(-)
--
Nao Nishijima (nao...@hi...)
|
|
From: Nao N. <nao...@hi...> - 2011-08-25 09:07:42
|
This patch allows the user to set an "alias" of the disk via sysfs interface.
This patch only adds a new attribute "alias" in gendisk structure.
To show the alias instead of the device name in kernel messages,
we need to revise printk messages and use alias_name() in them.
Example:
(current) printk("disk name is %s\n", disk->disk_name);
(new) printk("disk name is %s\n", alias_name(disk));
Users can use alphabets, numbers, '-' and '_' in "alias" attribute. A disk can
have an "alias" which length is up to 255 bytes. This attribute is write-once.
Suggested-by: James Bottomley <Jam...@Ha...>
Suggested-by: Jon Masters <jc...@re...>
Signed-off-by: Nao Nishijima <nao...@hi...>
---
Documentation/ABI/testing/sysfs-block | 13 ++++++
block/genhd.c | 71 +++++++++++++++++++++++++++++++++
include/linux/genhd.h | 4 ++
3 files changed, 88 insertions(+), 0 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block
index c1eb41c..2b5d561 100644
--- a/Documentation/ABI/testing/sysfs-block
+++ b/Documentation/ABI/testing/sysfs-block
@@ -206,3 +206,16 @@ Description:
when a discarded area is read the discard_zeroes_data
parameter will be set to one. Otherwise it will be 0 and
the result of reading a discarded area is undefined.
+What: /sys/block/<disk>/alias
+Date: Aug 2011
+Contact: Nao Nishijima <nao...@hi...>
+Description:
+ A raw device name of a disk does not always point a same disk
+ each boot-up time. Therefore, users have to use persistent
+ device names, which udev creates when the kernel finds a disk,
+ instead of raw device name. However, kernel doesn't show those
+ persistent names on its messages (e.g. dmesg).
+ This file can store an alias of the disk and it would be
+ appeared in kernel messages if it is set. A disk can have an
+ alias which length is up to 255bytes. Users can use alphabets,
+ numbers, "-" and "_" in alias name. This file is writeonce.
diff --git a/block/genhd.c b/block/genhd.c
index e2f6790..94855a9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -19,6 +19,7 @@
#include <linux/mutex.h>
#include <linux/idr.h>
#include <linux/log2.h>
+#include <linux/ctype.h>
#include "blk.h"
@@ -909,6 +910,74 @@ static int __init genhd_device_init(void)
subsys_initcall(genhd_device_init);
+static ssize_t alias_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ ssize_t ret = 0;
+
+ if (disk->alias)
+ ret = snprintf(buf, ALIAS_LEN, "%s\n", disk->alias);
+ return ret;
+}
+
+static ssize_t alias_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ char *alias;
+ char *envp[] = { NULL, NULL };
+ unsigned char c;
+ int i;
+ ssize_t ret = count;
+
+ if (!count)
+ return -EINVAL;
+
+ if (count >= ALIAS_LEN) {
+ printk(KERN_ERR "alias: alias is too long\n");
+ return -EINVAL;
+ }
+
+ /* Validation check */
+ for (i = 0; i < count; i++) {
+ c = buf[i];
+ if (i == count - 1 && c == '\n')
+ break;
+ if (!isalnum(c) && c != '_' && c != '-') {
+ printk(KERN_ERR "alias: invalid alias\n");
+ return -EINVAL;
+ }
+ }
+
+ if (disk->alias) {
+ printk(KERN_INFO "alias: %s is already assigned (%s)\n",
+ disk->disk_name, disk->alias);
+ return -EINVAL;
+ }
+
+ alias = kasprintf(GFP_KERNEL, "%s", buf);
+ if (!alias)
+ return -ENOMEM;
+
+ if (alias[count - 1] == '\n')
+ alias[count - 1] = '\0';
+
+ envp[0] = kasprintf(GFP_KERNEL, "ALIAS=%s", alias);
+ if (!envp[0]) {
+ kfree(alias);
+ return -ENOMEM;
+ }
+
+ disk->alias = alias;
+ printk(KERN_INFO "alias: assigned %s to %s\n", alias, disk->disk_name);
+
+ kobject_uevent_env(&dev->kobj, KOBJ_ADD, envp);
+
+ kfree(envp[0]);
+ return ret;
+}
+
static ssize_t disk_range_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -968,6 +1037,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
}
+static DEVICE_ATTR(alias, S_IRUGO|S_IWUSR, alias_show, alias_store);
static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL);
static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL);
static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL);
@@ -990,6 +1060,7 @@ static struct device_attribute dev_attr_fail_timeout =
#endif
static struct attribute *disk_attrs[] = {
+ &dev_attr_alias.attr,
&dev_attr_range.attr,
&dev_attr_ext_range.attr,
&dev_attr_removable.attr,
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 02fa469..6957350 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -21,6 +21,8 @@
#define dev_to_part(device) container_of((device), struct hd_struct, __dev)
#define disk_to_dev(disk) (&(disk)->part0.__dev)
#define part_to_dev(part) (&((part)->__dev))
+#define alias_name(disk) ((disk)->alias ? (disk)->alias : \
+ (disk)->disk_name)
extern struct device_type part_type;
extern struct kobject *block_depr;
@@ -58,6 +60,7 @@ enum {
#define DISK_MAX_PARTS 256
#define DISK_NAME_LEN 32
+#define ALIAS_LEN 256
#include <linux/major.h>
#include <linux/device.h>
@@ -162,6 +165,7 @@ struct gendisk {
* disks that can't be partitioned. */
char disk_name[DISK_NAME_LEN]; /* name of major driver */
+ char *alias; /* alias name of disk */
char *(*devnode)(struct gendisk *gd, mode_t *mode);
unsigned int events; /* supported events */
|
|
From: Nao N. <nao...@hi...> - 2011-08-25 09:07:32
|
Hi,
This patch series provide an "alias" of the disk into kernel messages.
A raw device name of a disk does not always point a same disk at each boot-up
time. Therefore, users have to use persistent device names, which udev creates
to always access the same disk. However, kernel messages still display the raw
device names.
My proposal is that users can use and see persistent device names which were
assigned by themselves because users expect same name to point same disk
anytime.
Why need to modify kernel messages?
- We can see mapping of device names and persistent device names in udev log.
If those logs output to syslog, we can search persistent device name from
device name, but it can cause a large amount of syslog output.
- If we can use the persistent device names and can always see the same name on
the kernel log, we don't need to pay additional cost for searching and picking
a correct pair of device name and persistent device name from udev log.
- Kernel messages are output to serial console when kenel crashes, it's so hard
to convert a device name to the alias.
Of course, I am going to modify the commands using device name so that users
can use an alias of the disk.
Changes in v3:
- "alias_name" was changed to "alias"
- The function to notify the partitions of uevent was deleted
How to use:
1. Build and install the kernel with this series, and reboot with the kernel.
2. Check device names.
[localhost]# cat /proc/partitions
major minor #blocks name
8 0 12582912 sda
8 1 12582878 sda1
8 0 8388608 sdb
8 1 512000 sdb1
8 2 7875584 sdb2
3. Make a script of get alias
[localhost]# vi /lib/udev/get_alias
#!/bin/sh -e
DEVNAME=`echo $1 | sed -e 's/[0-9]//g'`
echo "ALIAS=`cat /sys/block/$DEVNAME/alias`"
exit 0
And you should set an execute bit,
[localhost]# chmod +x /lib/udev/get_alias
4. Check disk's id
Here is an example to get the serial id and the path of the device.
Some devices have not the serial id. Therefore, to identify a device,
users need to get the path of the device.
[localhost]# udevadm info --query=property --path=/sys/block/sda \
| grep ID_SERIAL=
ID_SERIAL=0QEMU_QEMU_HARDDISK_drive-scsi0-0-1
or you can also use the path of the device
[localhost]# udevadm info --query=property --path=/sys/block/sr0 \
| grep ID_PATH=
ID_PATH=pci-0000:00:01.1-scsi-1:0:0:0
5. Write udev rules as follows
(The user assigns "foo" to sda and "bar" to sr0)
We use ENV{ID_SERIAL} or ENV{ID_PATH} (get by 3) to identify a disk.
And to assign automatically an "alias", we use ATTR key.
If ENV{ALIAS} is empty, we use to get an "alias" by get_alias script.
[localhost]# vi /etc/udev/rules.d/70-persistent-alias.rules
SUBSYSTEM!="block", GOTO="end"
ATTR{alias}!="", GOTO="symlink"
# write alias for sdX
KERNEL=="sd*[!0-9]", ACTION=="add", ATTR{alias}="foo", \
ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_drive-scsi0-0-1"
# write alias for srX
KERNEL=="sr[0-9]", ACTION=="add", ATTR{alias}="bar", \
ENV{ID_PATH}=="pci-0000:00:01.1-scsi-1:0:0:0"
LABEL="symlink"
# make symlink
ENV{DEVTYPE}=="disk|partition", ENV{ALIAS}=="", \
IMPORT{program}="/lib/udev/get_alias %k"
ENV{DEVTYPE}=="disk", ENV{ALIAS}=="?*", SYMLINK+="disk/by-alias/$env{ALIAS}"
ENV{DEVTYPE}=="partition", ENV{ALIAS}=="?*", \
SYMLINK+="disk/by-alias/$env{ALIAS}%n"
LABEL="end"
6. reboot
After reboot, we can see aliases in kernel messages.
[localhost]# ls -l /dev/disk/by-alias/
total 0
lrwxrwxrwx. 1 root root 9 Jul 1 21:21 bar -> ../../sr0
lrwxrwxrwx. 1 root root 9 Jul 1 21:21 foo -> ../../sda
lrwxrwxrwx. 1 root root 10 Jul 1 21:21 foo1 -> ../../sda1
[localhost]# dmesg
...
sd 2:0:1:0: [sda] Attached SCSI disk
alias: assigned foo to sda
sd 2:0:1:0: [foo] Send: 0xffff88007a82cd00
sd 2:0:1:0: [foo] CDB: Write(10): 2a 00 01 58 0c 8a 00 00 08 00
buffer = 0xffff88007a82c500, bufflen = 4096, queuecommand 0xffffffffa00277fd
leaving scsi_dispatch_cmnd()
sd 2:0:1:0: [foo] Done: 0xffff88007a82cd00 SUCCESS
sd 2:0:1:0: [foo] Result: hostbyte=DID_OK driverbyte=DRIVER_OK
sd 2:0:1:0: [foo] CDB: Write(10): 2a 00 01 58 0c 8a 00 00 08 00
...
When a new device is added, the udev appends a new rule manually.
In the future, it is appended automatically, as like NIC.
Best Regards,
---
Nao Nishijima (1):
block: add a new attribute "alias" in gendisk
Documentation/ABI/testing/sysfs-block | 13 ++++++
block/genhd.c | 71 +++++++++++++++++++++++++++++++++
include/linux/genhd.h | 4 ++
3 files changed, 88 insertions(+), 0 deletions(-)
--
Nao Nishijima (nao...@hi...)
|
|
From: Masami H. <mas...@hi...> - 2011-08-10 02:02:04
|
(2011/08/04 2:16), Borislav Petkov wrote: > On Sat, Jul 09, 2011 at 03:11:45PM +0900, Masami Hiramatsu wrote: >> BTW, I'm also interested in that structured error events, from the long >> term view and viewpoint of tracers :) > > Let me chime in a "mee too" from the HW errors perspective. Of course, :) and I guess this may be related to Fredrdic's work. >> I think we could expand current TRACE_EVENT macro to define those >> error events. > > Concerning structure, we can use the format file in debugfs which > currently describes the fields of a tracepoint: > > /sys/kernel/debug/tracing/events/../../format > > and expand those to generic kernel events. Userspace parses the format > and knows exactly at what data it is looking at. Also, the idea is to > move that events hierarchy into sysfs so it will be present on every > system. Yeah, that is exactly what I've thought. Current trace events strongly depends on ftrace and perf. And both of them are not enough for handling events as error monitoring. Maybe we have to prepare another monitor for this purpose, because, usually, error monitoring should be run always on the machine, separately from (and concurrently with) performance tuning or debugging tools. Even though, I think the trace-event macros (include/trace/events/) are good starting point. Thank you, -- Masami HIRAMATSU Software Platform Research Dept. Linux Technology Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: mas...@hi... |
|
From: 松涵 <qiv...@si...> - 2011-08-05 13:48:22
|
青色的缎子面,上面细细地绣着小桥流水、庭院楼阁,扉页上有淡淡 宏达中心是一家网上多年的教育中心. 各大高校毕业本,学信网验查,英语四六级, 建造师及各类资格书。 点击此处加QQ或者回复邮件咨询!啸的,又怎么只有令狐冲一个人了。多少年里,多心心念念地想看看 |
|
From: Borislav P. <bp...@am...> - 2011-08-03 17:33:28
|
On Sat, Jul 09, 2011 at 03:11:45PM +0900, Masami Hiramatsu wrote: > BTW, I'm also interested in that structured error events, from the long > term view and viewpoint of tracers :) Let me chime in a "mee too" from the HW errors perspective. > I think we could expand current TRACE_EVENT macro to define those > error events. Concerning structure, we can use the format file in debugfs which currently describes the fields of a tracepoint: /sys/kernel/debug/tracing/events/../../format and expand those to generic kernel events. Userspace parses the format and knows exactly at what data it is looking at. Also, the idea is to move that events hierarchy into sysfs so it will be present on every system. Hmm... -- Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551 |
|
From: Nao N. <nao...@hi...> - 2011-07-29 09:09:58
|
Hi James,
Could you review this patches?
Best regards,
(2011/07/22 19:59), Nao Nishijima wrote:
> Hi,
>
> This patch series provide an "alias name" of the disk into kernel messages.
> Users can assign a preferred name to an alias name of the device.
>
> A raw device name of a disk does not always point a same disk at each boot-up
> time. Therefore, users have to use persistent device names, which udev creates
> to always access the same disk. However, kernel messages still display the raw
> device names.
>
> My proposal is that users can use and see persistent device names which were
> assigned by they because users expect same name to point same disk anytime.
>
> Why need to modify kernel messages?
> - We can see mapping of device names and persistent device names in udev log.
> If those logs output to syslog, we can search persistent device name from
> device name, but it can cause a large amount of syslog output.
>
> - If we can use the persistent device names and can always see the same name on
> the kernel log, we don't need to pay additional cost for searching and picking
> a correct pair of device name and persistent device name from udev log.
>
> - Kernel messages are output to serial console when kenel crashes,
> it's so hard to convert device name to alias name.
>
>
> Of course, I am going to modify the commands using device name so that users
> can use alias names.
>
>
> How to use:
> 1. Build and install the kernel with this series, and reboot with the kernel.
>
> 2. Make a script of get alias_name
>
> [localhost]# vi /lib/udev/get_alias_name
> #!/bin/sh -e
> DEVNAME=`echo $1 | sed -e 's/[0-9]//g'`
> echo "ALIAS=`cat /sys/block/$DEVNAME/alias_name`"
> exit 0
>
> And you should set an execute bit,
> [localhost]# chmod +x /lib/udev/get_alias_name
>
> 3. Check disk's id
> Here is an example to get the serial id and the path of the device.
>
> [localhost]# udevadm info --query=property --path=/sys/block/sda \
> | grep ID_SERIAL=
> ID_SERIAL=0QEMU_QEMU_HARDDISK_drive-scsi0-0-1
>
> Some devices does not have the serial id. For such devices,
> you may use the device path.
>
> [localhost]# udevadm info --query=property --path=/sys/block/sr0 \
> | grep ID_PATH=
> ID_PATH=pci-0000:00:01.1-scsi-1:0:0:0
>
>
> 4. Write udev rules as follows
> (The user assigns "foo" to sda and "bar" to sr0)
> We use ENV{ID_SERIAL} or ENV{ID_PATH} (get by 3) to identify a disk.
> And to assign automatically an "alias name", we use ATTR key.
> If ENV{ALIAS} is empty, we use to get an "alias_name" by get_alias_name script.
>
> [localhost]# vi /etc/udev/rules.d/70-alias_name.rules
> SUBSYSTEM!="block", GOTO="end"
>
> # write alias name for sdX
> KERNEL=="sd*[!0-9]", ACTION=="add", ATTR{alias_name}="foo", \
> ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_drive-scsi0-0-1"
>
> # write alias name for srX
> KERNEL=="sr[0-9]", ACTION=="add", ATTR{alias_name}="bar", \
> ENV{ID_PATH}=="pci-0000:00:01.1-scsi-1:0:0:0"
>
> # make symlink
> ENV{DEVTYPE}=="disk", ENV{ALIAS}=="?*", SYMLINK+="disk/by-alias/$env{ALIAS}"
> ENV{DEVTYPE}=="partition", ENV{ALIAS}=="", \
> IMPORT{program}="/lib/udev/get_alias_name %k"
> ENV{DEVTYPE}=="partition", ENV{ALIAS}=="?*", \
> SYMLINK+="disk/by-alias/$env{ALIAS}%n"
>
> LABEL="end"
>
>
> 5. reboot
> After reboot, we can see alias name in kernel messages.
>
> [localhost]# ls -l /dev/disk/by-alias/
> total 0
> lrwxrwxrwx. 1 root root 9 Jul 1 21:21 bar -> ../../sr0
> lrwxrwxrwx. 1 root root 9 Jul 1 21:21 foo -> ../../sda
> lrwxrwxrwx. 1 root root 10 Jul 1 21:21 foo1 -> ../../sda1
>
> [localhost]# dmesg
> ...
> sd 2:0:0:0: [foo] sd_init_command: block=17382146, count=56
> sd 2:0:0:0: [foo] block=17382146
> sd 2:0:0:0: [foo] reading 56/56 512 byte blocks.
> sd 2:0:0:0: [foo] Send: 0xffff88007ab1a900
> ...
>
> Currently, the user must add the naming rule manually for new devices.
> In the future, it is appended automatically, as like NIC.
>
> Changes in v2:
> - Change alias_name string to pointer
> - Change alias_name writable to write at once
> - Drop procfs patch
>
> Best regards,
>
> ---
>
> Joe Perches (1):
> sd: modify printk for alias name
>
> Nao Nishijima (2):
> block: add a new attribute "alias name" in gendisk structure
> sd: [BUGFIX] Use sd_printk instead of printk
>
>
> Documentation/ABI/testing/sysfs-block | 15 ++++++
> block/genhd.c | 84 +++++++++++++++++++++++++++++++++
> drivers/scsi/scsi_lib.c | 26 ++++++++++
> drivers/scsi/sd.c | 30 +++++++++++-
> drivers/scsi/sd.h | 8 +--
> include/linux/genhd.h | 4 ++
> include/scsi/scsi_device.h | 8 +--
> 7 files changed, 162 insertions(+), 13 deletions(-)
>
>
> --
> Nao Nishijima (nao...@hi...)
>
--
Nao NISHIJIMA
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., YOKOHAMA Research Laboratory
Email: nao...@hi...
|
|
From: MyBonusWeb S. <ne...@my...> - 2011-07-29 05:54:48
|
in...@my... a tu libreta de direcciones y llegaremos siempre a tu bandeja de entrada. Ofertas Solidarias en Tu Ciudad Sé solidario, colabora con los que lo necesitan solo con tu email 30% Dto. Consigue un moreno espectacular Broncea tu piel! SOLO: 35,00€ original: 50€ 30% 15,00€ Dale tono a tu piel con el bronceado de rayos UVA. 10 sesiones a un precio espectacular para que puedas estar moreno sin tomar el sol.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 35% Dto. Comparte este menú en el mejor chiringuito de la playa de Barcelona Cena con alguien en la playa... SOLO: 56,00€ original: 86€ 35% 30,00€ Disfruta en el mejor chiringuito de la playa de Barcelona, de una cena en una ubicación única.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto.Curso de Bailes de Salón, nivel debutante para dos personas Aprende a bailar... SOLO: 140,00€ original: 280€ 50% 140,00€ Aprende baile de salón, 10 tipos diferentes de baile para que escojas el que más te guste. Compra ahora y comienza en Septiembre.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto. Armoniza cuerpo y mente gracias a la energía de la luz Técnica milenaria de Cromoterapia... SOLO: 50,00€ original: 100€ 50% 50,00€ Tendrás dos sesiones totalmente personalizadas de esta técnica milenaria de Cromoterapia que utiliza las propiedades del color para tratar dolencias físicas y trastornos emocionales.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. Si nos referencias a tus amigos o familiares todos tendréis un gran descuento en la compra de vuestros ¡MyBonus! Sé el primero en recibir nuestras ofertas, para ello haz click en tu ciudad: Madrid · Barcelona · Bilbao · Valencia · Zaragoza · Sevilla · Málaga · A Coruña · Mallorca · Alicante · Las Palmas · Valladolid · Córdoba · Granada · Oviedo · Otra Descuentos solidarios de hasta el 90% en tu ciudad www.mybonusweb.com Actualmente estás suscrito a este boletín con la cuenta (dle...@li...). Tus datos se encuentran recogidos en un fichero automatizado cuyo responsable es Mybonus Experience S.L., a través de la web www.mybonusweb.com podrás ejercitar los derechos de acceso, rectificación, cancelación y oposición. Todo ello en cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de 13 de Diciembre de Protección de Datos de Carácter Personal. Por favor no respondas a este mail. Si tienes cualquier duda o sugerencia contacta con in...@my... (in...@my...) Si NO deseas recibir las fantásticas ofertas solidarias de tu ciudad con las que tienes un ahorro de hasta el 90% y además ayudas a proyectos solidarios, haz click aquí |
|
From: MyBonusWeb S. <ne...@my...> - 2011-07-28 01:16:05
|
in...@my... a tu libreta de direcciones y llegaremos siempre a tu bandeja de entrada. Ofertas Solidarias en Tu Ciudad Sé solidario, colabora con los que lo necesitan solo con tu email 70% Dto. Consigue este tratamiento de depilación láser para ingles y axilas aunque estés morena. Tu cuerpo suave y perfecto... SOLO: 27,00€ original: 90€ 70% 63,00€ Comienza el verano sin la preocupación de ese bello que tanto odiamos con 1 sesión de depilación láser de ingles y axilas, en poco tiempo notarás unos resultados increíbles¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 52% Dto. ¿Te gusta el Bogavante? Disfruta de este excepcional menú para una cena Oferta increíble! SOLO: 40,00€ original: 81,82€ 52% 41,82€ Date un capricho con una cena de lujo en una zona de lujo. Un menú para cenar que incluye entre otros platos Arroz con Bogavante¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto.Más sencillo que una escalada, disfruta de una Vía Ferrata. La Via Ferrata es lo más parecido a la escalada! SOLO: 17,00€ original: 34€ 50% 17,00€ ¿Te gustaría escalar pero no sabes? Consigue esta aventura por un increíble precio, Vía Ferrata, más sencillo que la escalada!¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. 60% Dto. Consigue unos brillos espectaculares sin dañar tu cabello Oferta especial! SOLO: 24,00€ original: 60€ 60% 36,00€ Dale a tu pelo un aspecto cuidado y bonito con los Velos de Color (Valido para cabellos teñidos y naturales)¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. Si nos referencias a tus amigos o familiares todos tendréis un gran descuento en la compra de vuestros ¡MyBonus! Sé el primero en recibir nuestras ofertas, para ello haz click en tu ciudad: Madrid · Barcelona · Bilbao · Valencia · Zaragoza · Sevilla · Málaga · A Coruña · Mallorca · Alicante · Las Palmas · Valladolid · Córdoba · Granada · Oviedo · Otra Descuentos solidarios de hasta el 90% en tu ciudad www.mybonusweb.com Actualmente estás suscrito a este boletín con la cuenta (dle...@li...). Tus datos se encuentran recogidos en un fichero automatizado cuyo responsable es Mybonus Experience S.L., a través de la web www.mybonusweb.com podrás ejercitar los derechos de acceso, rectificación, cancelación y oposición. Todo ello en cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de 13 de Diciembre de Protección de Datos de Carácter Personal. Por favor no respondas a este mail. Si tienes cualquier duda o sugerencia contacta con in...@my... (in...@my...) Si NO deseas recibir las fantásticas ofertas solidarias de tu ciudad con las que tienes un ahorro de hasta el 90% y además ayudas a proyectos solidarios, haz click aquí |
|
From: MyBonusWeb S. <ne...@my...> - 2011-07-27 01:37:17
|
in...@my... a tu libreta de direcciones y llegaremos siempre a tu bandeja de entrada. Ofertas Solidarias en Tu Ciudad Sé solidario, colabora con los que lo necesitan solo con tu email 50% Dto. Date un capricho con el menú degustación de alta cocina internacional Menú especial... SOLO: 18,50€ original: 37€ 50% 18,50€ Degusta este exquisito menú de entrante, primero, segundo y postre. Un menú de alta cocina Internacional elaborado con productos de la mejor calidad.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto. Disfruta de una auténtica pasta Italiana, genuina y casera hecha a mano Degusta un completísimo menú a la Italiana... SOLO: 35,00€ original: 70€ 50% 35,00€ El sabor original de la Italia tradicional, genuina pasta casera hecha a mano, un verdadero y completísimo menú italiano con el que disfrutarás del sabor de la auténtica Italia.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto.Aprovéchate de una coloración de INOA el tinte sin amoniaco Cuida tu pelo! SOLO: 30,00€ original: 60€ 50% 30,00€ Consigue esta coloración con una amplia gama de colores más una hidratación, todo con INOA la coloración del futuro con una potencia de color infinita y un brillo sublime¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto. Disfruta de unas uñas elegantes, cuidadas y bonitas Uñas perfectas... . SOLO: 10,00€ original: 20€ 50% 10,00€ Muestra tus manos perfectas hasta el más mínimo detalle gracias a la manicura con decoración a pincel que te ofrece Toscano Estilistas.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. Si nos referencias a tus amigos o familiares todos tendréis un gran descuento en la compra de vuestros ¡MyBonus! Sé el primero en recibir nuestras ofertas, para ello haz click en tu ciudad: Madrid · Barcelona · Bilbao · Valencia · Zaragoza · Sevilla · Málaga · A Coruña · Mallorca · Alicante · Las Palmas · Valladolid · Córdoba · Granada · Oviedo · Otra Descuentos solidarios de hasta el 90% en tu ciudad www.mybonusweb.com Actualmente estás suscrito a este boletín con la cuenta (dle...@li...). Tus datos se encuentran recogidos en un fichero automatizado cuyo responsable es Mybonus Experience S.L., a través de la web www.mybonusweb.com podrás ejercitar los derechos de acceso, rectificación, cancelación y oposición. Todo ello en cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de 13 de Diciembre de Protección de Datos de Carácter Personal. Por favor no respondas a este mail. Si tienes cualquier duda o sugerencia contacta con in...@my... (in...@my...) Si NO deseas recibir las fantásticas ofertas solidarias de tu ciudad con las que tienes un ahorro de hasta el 90% y además ayudas a proyectos solidarios, haz click aquí |
|
From: MyBonusWeb S. <ne...@my...> - 2011-07-26 01:28:43
|
in...@my... a tu libreta de direcciones y llegaremos siempre a tu bandeja de entrada. Ofertas Solidarias en Tu Ciudad Sé solidario, colabora con los que lo necesitan solo con tu email 55% Dto. Disfruta de una sesión de peluquería completa: tinte+lavar+cortar+peinar. Oferta especial! SOLO: 16,00€ original: 36€ 55% 20,00€ Un tratamiento completísimo de peluquería por muy poco dinero: tinte, corte, lavado y secado del cabello.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. 30% Dto. Relájate y olvídate del estrés a través de la Ruta del Bienestar Simplemente relájate... SOLO: 35,70€ original: 51€ 30% 15,30€ Te olvidarás del estrés con la Relajación Sensorial. Vas a disfrutar de todas las técnicas hidrotermales de una manera ordenada e individual bajo el asesoramiento de un terapeuta.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto.Un salto al vacio, adrenalina en estado puro Aumenta tu adrenalina! SOLO: 26,00€ original: 52€ 50% 26,00€ Salto al vacio desde el puente de Murillo (25 metros) atados a través de un arnés integral a las cuerdas dinamicas, especificas de esta modalidad, que nos sujetara en el aire.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. 50% Dto. Tu mejor aspecto gracias a una sesión de peluquería+maquillaje Sesión completa de peluquería... SOLO: 30,00€ original: 60€ 50% 30,00€ Disfruta de una completísima sesión de belleza en la Peluquería Terciopelo. Le darán a tu pelo un aspecto impecable, y te enseñarán a maquillarte paso a paso de una manera totalmente personalizada.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. Si nos referencias a tus amigos o familiares todos tendréis un gran descuento en la compra de vuestros ¡MyBonus! Sé el primero en recibir nuestras ofertas, para ello haz click en tu ciudad: Madrid · Barcelona · Bilbao · Valencia · Zaragoza · Sevilla · Málaga · A Coruña · Mallorca · Alicante · Las Palmas · Valladolid · Córdoba · Granada · Oviedo · Otra Descuentos solidarios de hasta el 90% en tu ciudad www.mybonusweb.com Actualmente estás suscrito a este boletín con la cuenta (dle...@li...). Tus datos se encuentran recogidos en un fichero automatizado cuyo responsable es Mybonus Experience S.L., a través de la web www.mybonusweb.com podrás ejercitar los derechos de acceso, rectificación, cancelación y oposición. Todo ello en cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de 13 de Diciembre de Protección de Datos de Carácter Personal. Por favor no respondas a este mail. Si tienes cualquier duda o sugerencia contacta con in...@my... (in...@my...) Si NO deseas recibir las fantásticas ofertas solidarias de tu ciudad con las que tienes un ahorro de hasta el 90% y además ayudas a proyectos solidarios, haz click aquí |
|
From: Karel Z. <kz...@re...> - 2011-07-25 11:22:42
|
On Fri, Jul 22, 2011 at 07:59:26PM +0900, Nao Nishijima wrote:
> Changes in v2:
> - Drop procfs patch
Thanks.
Karel
--
Karel Zak <kz...@re...>
http://karelzak.blogspot.com
|
|
From: MyBonusWeb S. <ne...@my...> - 2011-07-25 00:44:44
|
in...@my... a tu libreta de direcciones y llegaremos siempre a tu bandeja de entrada. Ofertas Solidarias en Tu Ciudad Sé solidario, colabora con los que lo necesitan solo con tu email 53% Dto. Disfruta de este suculento menú Disfruta de este menú tan especial! SOLO: 19,00€ original: 40€ 53% 21,00€ Es un local acogedor y desenfadado donde compartir una suculenta cena a un precio excepcional.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 86,60% Dto. ¿Quieres estar en forma? Este es el momento! Ponte en forma! SOLO: 20,00€ original: 150€ 86,60% 130,00€ Quieres iniciarte en el mundo del deporte? Tendrás dos clases privadas a elegir entre fitness, defensa personal, kick boxing o karate, además te regalarán una camiseta y un pantalón.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 76% Dto.Tratamiento compuesto por una limpieza bucal más pulido Oferta espectacular! SOLO: 19,00€ original: 80€ 76% 61,00€ Realiza este tratamiento de limpieza bucal más pulido más revisión y presupuesto¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 41% Dto. Ponte guapa con una sesión de peluquería, Lavar, tinte y peinado Sesión completa! SOLO: 13,00€ original: 22€ 41% 9,00€ Consigue un pelo brillante, con color y forma, y disfruta de un nuevo look.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. Si nos referencias a tus amigos o familiares todos tendréis un gran descuento en la compra de vuestros ¡MyBonus! Sé el primero en recibir nuestras ofertas, para ello haz click en tu ciudad: Madrid · Barcelona · Bilbao · Valencia · Zaragoza · Sevilla · Málaga · A Coruña · Mallorca · Alicante · Las Palmas · Valladolid · Córdoba · Granada · Oviedo · Otra Descuentos solidarios de hasta el 90% en tu ciudad www.mybonusweb.com Actualmente estás suscrito a este boletín con la cuenta (dle...@li...). Tus datos se encuentran recogidos en un fichero automatizado cuyo responsable es Mybonus Experience S.L., a través de la web www.mybonusweb.com podrás ejercitar los derechos de acceso, rectificación, cancelación y oposición. Todo ello en cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de 13 de Diciembre de Protección de Datos de Carácter Personal. Por favor no respondas a este mail. Si tienes cualquier duda o sugerencia contacta con in...@my... (in...@my...) Si NO deseas recibir las fantásticas ofertas solidarias de tu ciudad con las que tienes un ahorro de hasta el 90% y además ayudas a proyectos solidarios, haz click aquí |
|
From: Greg KH <gr...@kr...> - 2011-07-22 13:34:38
|
On Fri, Jul 22, 2011 at 07:59:26PM +0900, Nao Nishijima wrote: > Hi, > > This patch series provide an "alias name" of the disk into kernel messages. > Users can assign a preferred name to an alias name of the device. > > A raw device name of a disk does not always point a same disk at each boot-up > time. Therefore, users have to use persistent device names, which udev creates > to always access the same disk. However, kernel messages still display the raw > device names. > > My proposal is that users can use and see persistent device names which were > assigned by they because users expect same name to point same disk anytime. > > Why need to modify kernel messages? > - We can see mapping of device names and persistent device names in udev log. > If those logs output to syslog, we can search persistent device name from > device name, but it can cause a large amount of syslog output. > > - If we can use the persistent device names and can always see the same name on > the kernel log, we don't need to pay additional cost for searching and picking > a correct pair of device name and persistent device name from udev log. > > - Kernel messages are output to serial console when kenel crashes, > it's so hard to convert device name to alias name. > > > Of course, I am going to modify the commands using device name so that users > can use alias names. Please do that first, and then you will not need any kernel changes in the first place :) Anyway, you all know my objections to this patch series, but again, as I'm not the block subsystem maintainer, I really can't do anything. greg k-h |
|
From: Nao N. <nao...@hi...> - 2011-07-22 11:06:17
|
From: Joe Perches <jo...@pe...>
Reduce size of code and text of scmd_printk and sd_printk
macros by converting to the macros to functions and using
vsprintf extension %pV. This moves the code out-of-line
and centralizes the code used to emit additional arguments.
Save ~32KB of space in an x86 allyesconfig.
$ size drivers/scsi/built-in.o*
text data bss dec hex filename
5860439 135396 1393024 7388859 70bebb drivers/scsi/built-in.o.new
5882368 135396 1395848 7413612 711f6c drivers/scsi/built-in.o.old
5887100 135396 1397264 7419760 713770 drivers/scsi/built-in.o.with_patch_1_and_2
Signed-off-by: Joe Perches <jo...@pe...>
Reviewed-by: Nao Nishijima <nao...@hi...>
---
drivers/scsi/scsi_lib.c | 26 ++++++++++++++++++++++++++
drivers/scsi/sd.c | 23 +++++++++++++++++++++++
drivers/scsi/sd.h | 8 +++-----
include/scsi/scsi_device.h | 8 +++-----
4 files changed, 55 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ec1803a..249c54c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2571,3 +2571,29 @@ void scsi_kunmap_atomic_sg(void *virt)
kunmap_atomic(virt, KM_BIO_SRC_IRQ);
}
EXPORT_SYMBOL(scsi_kunmap_atomic_sg);
+
+/* Logging utilities */
+
+int scmd_printk(const char *prefix, const struct scsi_cmnd *scmd,
+ const char *format, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int r;
+
+ va_start(args, format);
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ if (scmd->request->rq_disk)
+ r = sdev_printk(prefix, scmd->device, "[%s] %pV",
+ alias_name(scmd->request->rq_disk), &vaf);
+ else
+ r = sdev_printk(prefix, scmd->device, "%pV", &vaf);
+
+ va_end(args);
+
+ return r;
+}
+EXPORT_SYMBOL(scmd_printk);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e434e5f..bb1b3e5 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2889,3 +2889,26 @@ static void sd_print_result(struct scsi_disk *sdkp, int result)
scsi_show_result(result);
}
+int sd_printk(const char *prefix, const struct scsi_disk *sdsk,
+ const char *format, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int r;
+
+ va_start(args, format);
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ if (sdsk->disk)
+ r = sdev_printk(prefix, sdsk->device, "[%s] %pV",
+ alias_name(sdsk->disk), &vaf);
+ else
+ r = sdev_printk(prefix, sdsk->device, "%pV", &vaf);
+
+ va_end(args);
+
+ return r;
+}
+EXPORT_SYMBOL(sd_printk);
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 6ad798b..46aa748 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -88,11 +88,9 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
return container_of(disk->private_data, struct scsi_disk, driver);
}
-#define sd_printk(prefix, sdsk, fmt, a...) \
- (sdsk)->disk ? \
- sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
- (sdsk)->disk->disk_name, ##a) : \
- sdev_printk(prefix, (sdsk)->device, fmt, ##a)
+extern __attribute__((format (printf, 3, 4)))
+int sd_printk(const char *prefix, const struct scsi_disk *sdsk,
+ const char *format, ...);
/*
* A DIF-capable target device can be formatted with different
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index dd82e02..c79631b 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -216,11 +216,9 @@ struct scsi_dh_data {
#define sdev_printk(prefix, sdev, fmt, a...) \
dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
-#define scmd_printk(prefix, scmd, fmt, a...) \
- (scmd)->request->rq_disk ? \
- sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \
- (scmd)->request->rq_disk->disk_name, ##a) : \
- sdev_printk(prefix, (scmd)->device, fmt, ##a)
+extern __attribute__((format (printf, 3, 4)))
+int scmd_printk(const char *prefix, const struct scsi_cmnd *scmd,
+ const char *format, ...);
enum scsi_target_state {
STARGET_CREATED = 1,
|
|
From: Nao N. <nao...@hi...> - 2011-07-22 11:06:10
|
This patch allows the user to set an "alias name" of the disk via sysfs
interface.
A raw device name of a disk does not always point a same disk at each boot-up
time. Therefore, users have to use persistent device names, which udev creates
to always access the same disk. However, kernel messages still display the raw
device names.
This patch adds a new attribute "alias name" in gendisk structure. And if users
set their preferred name to an "alias name" of the disk, it would be appeared
in kernel messages. A disk can have an "alias name" which length is up to
255bytes. Users can use alphabets, numbers, '-' and '_' in alias name.
Suggested-by: James Bottomley <Jam...@Ha...>
Suggested-by: Jon Masters <jc...@re...>
Signed-off-by: Nao Nishijima <nao...@hi...>
---
Documentation/ABI/testing/sysfs-block | 15 ++++++
block/genhd.c | 84 +++++++++++++++++++++++++++++++++
include/linux/genhd.h | 4 ++
3 files changed, 103 insertions(+), 0 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block
index c1eb41c..c42be33 100644
--- a/Documentation/ABI/testing/sysfs-block
+++ b/Documentation/ABI/testing/sysfs-block
@@ -206,3 +206,18 @@ Description:
when a discarded area is read the discard_zeroes_data
parameter will be set to one. Otherwise it will be 0 and
the result of reading a discarded area is undefined.
+
+What: /sys/block/<disk>/alias_name
+Date: July 2011
+Contact: Nao Nishijima <nao...@hi...>
+Description:
+ A raw device name of a disk does not always point a same disk
+ each boot-up time. Therefore, users have to use persistent
+ device names, which udev creates when the kernel finds a disk,
+ instead of raw device name. However, kernel doesn't show those
+ persistent names on its message.
+ This file can store an alias name of the disk and it would be
+ appeared in kernel messages if it is set. A disk can have an
+ alias name which length is up to 255bytes. Users can use
+ use alphabets, numbers, "-" and "_" in alias name. An alias
+ name is write at once.
diff --git a/block/genhd.c b/block/genhd.c
index 3608289..04136e6 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -19,6 +19,7 @@
#include <linux/mutex.h>
#include <linux/idr.h>
#include <linux/log2.h>
+#include <linux/ctype.h>
#include "blk.h"
@@ -909,6 +910,86 @@ static int __init genhd_device_init(void)
subsys_initcall(genhd_device_init);
+static ssize_t alias_name_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ ssize_t ret = 0;
+
+ if (disk->alias_name)
+ ret = snprintf(buf, ALIAS_NAME_LEN + 1, "%s\n",
+ disk->alias_name);
+ return ret;
+}
+
+static ssize_t alias_name_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t count)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ struct disk_part_iter piter;
+ struct hd_struct *part;
+
+ char *new_alias_name;
+ char *envp[] = { NULL, NULL };
+ unsigned char c;
+ int idx;
+ ssize_t ret = count;
+
+ if (!count)
+ return -EINVAL;
+
+ if (count >= ALIAS_NAME_LEN) {
+ printk(KERN_ERR "alias_name: alias name is too long\n");
+ return -EINVAL;
+ }
+
+ /* Validation check */
+ for (idx = 0; idx < count; idx++) {
+ c = buf[idx];
+ if (idx == count - 1 && c == '\n')
+ break;
+ if (!isalnum(c) && c != '_' && c != '-') {
+ printk(KERN_ERR "alias_name: invalid alias name\n");
+ return -EINVAL;
+ }
+ }
+
+ if (disk->alias_name) {
+ printk(KERN_INFO "alias_name: %s is already assigned (%s)\n",
+ disk->disk_name, disk->alias_name);
+ return -EINVAL;
+ }
+
+ new_alias_name = kasprintf(GFP_KERNEL, "%s", buf);
+ if (!new_alias_name)
+ return -ENOMEM;
+
+ if (new_alias_name[count - 1] == '\n')
+ new_alias_name[count - 1] = '\0';
+
+ envp[0] = kasprintf(GFP_KERNEL, "ALIAS=%s", new_alias_name);
+ if (!envp[0]) {
+ kfree(new_alias_name);
+ return -ENOMEM;
+ }
+
+ disk->alias_name = new_alias_name;
+ printk(KERN_INFO "alias_name: assigned %s to %s\n",
+ new_alias_name, disk->disk_name);
+
+ kobject_uevent_env(&dev->kobj, KOBJ_ADD, envp);
+
+ /* announce possible partitions */
+ disk_part_iter_init(&piter, disk, 0);
+ while ((part = disk_part_iter_next(&piter)))
+ kobject_uevent_env(&part_to_dev(part)->kobj, KOBJ_ADD, envp);
+ disk_part_iter_exit(&piter);
+
+ kfree(envp[0]);
+ return ret;
+}
+
static ssize_t disk_range_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -968,6 +1049,8 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
}
+static DEVICE_ATTR(alias_name, S_IRUGO|S_IWUSR, alias_name_show,
+ alias_name_store);
static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL);
static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL);
static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL);
@@ -990,6 +1073,7 @@ static struct device_attribute dev_attr_fail_timeout =
#endif
static struct attribute *disk_attrs[] = {
+ &dev_attr_alias_name.attr,
&dev_attr_range.attr,
&dev_attr_ext_range.attr,
&dev_attr_removable.attr,
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 300d758..e9ad85d 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -21,6 +21,8 @@
#define dev_to_part(device) container_of((device), struct hd_struct, __dev)
#define disk_to_dev(disk) (&(disk)->part0.__dev)
#define part_to_dev(part) (&((part)->__dev))
+#define alias_name(disk) ((disk)->alias_name ? (disk)->alias_name \
+ : (disk)->disk_name)
extern struct device_type part_type;
extern struct kobject *block_depr;
@@ -58,6 +60,7 @@ enum {
#define DISK_MAX_PARTS 256
#define DISK_NAME_LEN 32
+#define ALIAS_NAME_LEN 256
#include <linux/major.h>
#include <linux/device.h>
@@ -162,6 +165,7 @@ struct gendisk {
* disks that can't be partitioned. */
char disk_name[DISK_NAME_LEN]; /* name of major driver */
+ char *alias_name; /* alias name of disk */
char *(*devnode)(struct gendisk *gd, mode_t *mode);
unsigned int events; /* supported events */
|
|
From: Nao N. <nao...@hi...> - 2011-07-22 11:06:06
|
sd_ioctl still use printk for log output.
It should use sd_printk instead of printk, as well as other sd_*.
All SCSI messages should output via s*_printk instead of printk.
Signed-off-by: Nao Nishijima <nao...@hi...>
Reviewed-by: Masami Hiramatsu <mas...@hi...>
---
drivers/scsi/sd.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 953773c..e434e5f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1066,12 +1066,13 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
struct gendisk *disk = bdev->bd_disk;
- struct scsi_device *sdp = scsi_disk(disk)->device;
+ struct scsi_disk *sdkp = scsi_disk(disk);
+ struct scsi_device *sdp = sdkp->device;
void __user *p = (void __user *)arg;
int error;
- SCSI_LOG_IOCTL(1, printk("sd_ioctl: disk=%s, cmd=0x%x\n",
- disk->disk_name, cmd));
+ SCSI_LOG_IOCTL(1, sd_printk(KERN_INFO, sdkp, "sd_ioctl: disk=%s,"
+ " cmd=0x%x\n", disk->disk_name, cmd));
/*
* If we are in the middle of error recovery, don't let anyone
|
|
From: Nao N. <nao...@hi...> - 2011-07-22 11:05:55
|
Hi,
This patch series provide an "alias name" of the disk into kernel messages.
Users can assign a preferred name to an alias name of the device.
A raw device name of a disk does not always point a same disk at each boot-up
time. Therefore, users have to use persistent device names, which udev creates
to always access the same disk. However, kernel messages still display the raw
device names.
My proposal is that users can use and see persistent device names which were
assigned by they because users expect same name to point same disk anytime.
Why need to modify kernel messages?
- We can see mapping of device names and persistent device names in udev log.
If those logs output to syslog, we can search persistent device name from
device name, but it can cause a large amount of syslog output.
- If we can use the persistent device names and can always see the same name on
the kernel log, we don't need to pay additional cost for searching and picking
a correct pair of device name and persistent device name from udev log.
- Kernel messages are output to serial console when kenel crashes,
it's so hard to convert device name to alias name.
Of course, I am going to modify the commands using device name so that users
can use alias names.
How to use:
1. Build and install the kernel with this series, and reboot with the kernel.
2. Make a script of get alias_name
[localhost]# vi /lib/udev/get_alias_name
#!/bin/sh -e
DEVNAME=`echo $1 | sed -e 's/[0-9]//g'`
echo "ALIAS=`cat /sys/block/$DEVNAME/alias_name`"
exit 0
And you should set an execute bit,
[localhost]# chmod +x /lib/udev/get_alias_name
3. Check disk's id
Here is an example to get the serial id and the path of the device.
[localhost]# udevadm info --query=property --path=/sys/block/sda \
| grep ID_SERIAL=
ID_SERIAL=0QEMU_QEMU_HARDDISK_drive-scsi0-0-1
Some devices does not have the serial id. For such devices,
you may use the device path.
[localhost]# udevadm info --query=property --path=/sys/block/sr0 \
| grep ID_PATH=
ID_PATH=pci-0000:00:01.1-scsi-1:0:0:0
4. Write udev rules as follows
(The user assigns "foo" to sda and "bar" to sr0)
We use ENV{ID_SERIAL} or ENV{ID_PATH} (get by 3) to identify a disk.
And to assign automatically an "alias name", we use ATTR key.
If ENV{ALIAS} is empty, we use to get an "alias_name" by get_alias_name script.
[localhost]# vi /etc/udev/rules.d/70-alias_name.rules
SUBSYSTEM!="block", GOTO="end"
# write alias name for sdX
KERNEL=="sd*[!0-9]", ACTION=="add", ATTR{alias_name}="foo", \
ENV{ID_SERIAL}=="0QEMU_QEMU_HARDDISK_drive-scsi0-0-1"
# write alias name for srX
KERNEL=="sr[0-9]", ACTION=="add", ATTR{alias_name}="bar", \
ENV{ID_PATH}=="pci-0000:00:01.1-scsi-1:0:0:0"
# make symlink
ENV{DEVTYPE}=="disk", ENV{ALIAS}=="?*", SYMLINK+="disk/by-alias/$env{ALIAS}"
ENV{DEVTYPE}=="partition", ENV{ALIAS}=="", \
IMPORT{program}="/lib/udev/get_alias_name %k"
ENV{DEVTYPE}=="partition", ENV{ALIAS}=="?*", \
SYMLINK+="disk/by-alias/$env{ALIAS}%n"
LABEL="end"
5. reboot
After reboot, we can see alias name in kernel messages.
[localhost]# ls -l /dev/disk/by-alias/
total 0
lrwxrwxrwx. 1 root root 9 Jul 1 21:21 bar -> ../../sr0
lrwxrwxrwx. 1 root root 9 Jul 1 21:21 foo -> ../../sda
lrwxrwxrwx. 1 root root 10 Jul 1 21:21 foo1 -> ../../sda1
[localhost]# dmesg
...
sd 2:0:0:0: [foo] sd_init_command: block=17382146, count=56
sd 2:0:0:0: [foo] block=17382146
sd 2:0:0:0: [foo] reading 56/56 512 byte blocks.
sd 2:0:0:0: [foo] Send: 0xffff88007ab1a900
...
Currently, the user must add the naming rule manually for new devices.
In the future, it is appended automatically, as like NIC.
Changes in v2:
- Change alias_name string to pointer
- Change alias_name writable to write at once
- Drop procfs patch
Best regards,
---
Joe Perches (1):
sd: modify printk for alias name
Nao Nishijima (2):
block: add a new attribute "alias name" in gendisk structure
sd: [BUGFIX] Use sd_printk instead of printk
Documentation/ABI/testing/sysfs-block | 15 ++++++
block/genhd.c | 84 +++++++++++++++++++++++++++++++++
drivers/scsi/scsi_lib.c | 26 ++++++++++
drivers/scsi/sd.c | 30 +++++++++++-
drivers/scsi/sd.h | 8 +--
include/linux/genhd.h | 4 ++
include/scsi/scsi_device.h | 8 +--
7 files changed, 162 insertions(+), 13 deletions(-)
--
Nao Nishijima (nao...@hi...)
|
|
From: MyBonusWeb S. <ne...@my...> - 2011-07-22 01:46:01
|
in...@my... a tu libreta de direcciones y llegaremos siempre a tu bandeja de entrada. Ofertas Solidarias en Tu Ciudad Sé solidario, colabora con los que lo necesitan solo con tu email 66% Dto. Déjate mimar con un Masaje Japonés Shiatsu con aceites esenciales Oferta especial! SOLO: 20,00€ original: 60€ 66% 40,00€ El Shiatsu es una técnica de masaje Japonés muy antigua que combate el desequilibrio del cuerpo, mantiene y promueve la salud.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. 50% Dto. Los verdaderos sabores y aromas de Italia al alcance de tu paladar Completísimo menú, tanto para una comida como para una cena... SOLO: 15,00€ original: 30€ 50% 15,00€ Disfruta de los verdaderos sabores y aromas tradicionales de Italia con productos naturales de origen¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto.Menú degustación para dos "La Olla Vegetal" Disfruta de un menú vegetariano "muy especial" para dos personas... SOLO: 21,00€ original: 42€ 50% 21,00€ Vas a conocer la gran variedad de posibilidades que te brinda la cocina vegetariana, con una gran variedad de sabores y texturas.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto. Tu mejor aspecto gracias a una sesión de peluquería+maquillaje Oferta magnífica! ! ! SOLO: 30,00€ original: 60€ 50% 30,00€ Disfruta de una completísima sesión de belleza en la Peluquería Terciopelo. Le darán a tu pelo un aspecto impecable, y te enseñarán a maquillarte paso a paso de una manera totalmente personalizada.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. Si nos referencias a tus amigos o familiares todos tendréis un gran descuento en la compra de vuestros ¡MyBonus! Sé el primero en recibir nuestras ofertas, para ello haz click en tu ciudad: Madrid · Barcelona · Bilbao · Valencia · Zaragoza · Sevilla · Málaga · A Coruña · Mallorca · Alicante · Las Palmas · Valladolid · Córdoba · Granada · Oviedo · Otra Descuentos solidarios de hasta el 90% en tu ciudad www.mybonusweb.com Actualmente estás suscrito a este boletín con la cuenta (dle...@li...). Tus datos se encuentran recogidos en un fichero automatizado cuyo responsable es Mybonus Experience S.L., a través de la web www.mybonusweb.com podrás ejercitar los derechos de acceso, rectificación, cancelación y oposición. Todo ello en cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de 13 de Diciembre de Protección de Datos de Carácter Personal. Por favor no respondas a este mail. Si tienes cualquier duda o sugerencia contacta con in...@my... (in...@my...) Si NO deseas recibir las fantásticas ofertas solidarias de tu ciudad con las que tienes un ahorro de hasta el 90% y además ayudas a proyectos solidarios, haz click aquí |
|
From: MyBonusWeb S. <ne...@my...> - 2011-07-21 00:20:47
|
in...@my... a tu libreta de direcciones y llegaremos siempre a tu bandeja de entrada. Ofertas Solidarias en Tu Ciudad Sé solidario, colabora con los que lo necesitan solo con tu email 53% Dto. Luce una melena luminosa con el tratamiento de oro hidro-nutritivo, corte y secado Una melena cuidada y perfecta... SOLO: 19,50€ original: 42,50€ 53% 23,00€ Tratamiento para una mayor sedosidad, brillo y ligereza de tu cabello. Champú específico personalizado y tratamiento de oro.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto. Despídete definitivamente del vello que ya no deseas Con la Fotodepilación... SOLO: 15,00€ original: 30€ 50% 15,00€ Si quieres que desaparezcan esos molestos vellos y olvidarte de la depilación Prueba la Fotodepilación es sistema de depilación más seguro y efectivo que existe en la actualidad¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 50% Dto.Ponte unas auténticas Uñas 100% de Gel Luce uñas perfectas... SOLO: 25,00€ original: 50€ 50% 25,00€ Ponte unas auténticas Uñas 100% de Gel en ¡People Estilistas!. ¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 3 meses. 66% Dto. Muestra tu mejor aspecto gracias a una completa sesión de peluquería y maquillaje Oferta única! SOLO: 15,00€ original: 45€ 66% 30,00€ Disfruta de una completísima sesión de belleza en la Peluquería Terciopelo. Le darán a tu pelo un aspecto impecable, y le enseñarán a maquillarse paso a paso de una manera totalmente personalizada.¡Consigue tu MyBonus Ya! Con reserva previa. Validez del MyBonus, 6 meses. Si nos referencias a tus amigos o familiares todos tendréis un gran descuento en la compra de vuestros ¡MyBonus! Sé el primero en recibir nuestras ofertas, para ello haz click en tu ciudad: Madrid · Barcelona · Bilbao · Valencia · Zaragoza · Sevilla · Málaga · A Coruña · Mallorca · Alicante · Las Palmas · Valladolid · Córdoba · Granada · Oviedo · Otra Descuentos solidarios de hasta el 90% en tu ciudad www.mybonusweb.com Actualmente estás suscrito a este boletín con la cuenta (dle...@li...). Tus datos se encuentran recogidos en un fichero automatizado cuyo responsable es Mybonus Experience S.L., a través de la web www.mybonusweb.com podrás ejercitar los derechos de acceso, rectificación, cancelación y oposición. Todo ello en cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de 13 de Diciembre de Protección de Datos de Carácter Personal. Por favor no respondas a este mail. Si tienes cualquier duda o sugerencia contacta con in...@my... (in...@my...) Si NO deseas recibir las fantásticas ofertas solidarias de tu ciudad con las que tienes un ahorro de hasta el 90% y además ayudas a proyectos solidarios, haz click aquí |
|
From: Seiji A. <sei...@hd...> - 2011-07-20 22:34:54
|
Hi Vivek, > Why can't we log something in user space when user initiates a reboot, > Why does kernel need to capture that info in NVRAM. As I explained in following thread, customers sometimes ask us to investigate the reason why system reboots. https://lkml.org/lkml/2010/11/17/249 We can solve following scenario by logging messages in kernel space. - Syslogd is killed by mistake. (user kills syslogd with command or other applications send signal). - And then, system reboots. If we log messages in user space, we can't see messages. Seiji >-----Original Message----- >From: Vivek Goyal [mailto:vg...@re...] >Sent: Tuesday, July 19, 2011 2:48 PM >To: Seiji Aguchi >Cc: ke...@li...; lin...@vg...; lin...@li...; Eric W. Biederman; KOSAKI >Motohiro; Americo Wang; Matthew Garrett; ton...@in...; Andrew Morton; Jarod Wilson; hp...@zy...; >dz...@re...; dle...@li...; Satoru Moriya >Subject: Re: [RFC][PATCH -mmotm 0/4] Improvement of pstore/kmsg_dump in kexec/panic path > >On Tue, Jul 19, 2011 at 02:23:26PM -0400, Seiji Aguchi wrote: >> Hi, >> >> [Upstream status] >> Discussion about kmsg_dump() in kdump path: >> - Eric and Vivek are worried about reliability of existing kmsg_dump(). >> - Especially, Vivek would like to remove a RCU function call chain in kdump path >> which kernel modules can register their function calls freely. >> >> Discussion about pstore in nmi_hander. >> - Don Zickus found an issue of pstore in nmi_handler due to its mutex_lock. > >You did not answer my questions in the last posting mail thread and gone >ahead with the new posting. How are we supposed to discuss something. This >has been a problem on this mail thread since the beginneing. There is >little open discussion. > >So if you want to make any progress in this direction, what will help >is open discussion. > >Locking is going to be a problem. So atleast we can remove kmsg_dump() >infrastructure from reboot path. Why can't we log something in user >space when user initiates a reboot, let it get logged in /var/log/messages >and then umount the file root and go ahead with reboot. Why does kernel >need to capture that info in NVRAM. > >If we can get rid of all the logging thing on reboot path, then at least >it does not need to be lock protected with crash path. > >Thanks >Vivek |