block: remove __bdevname
authorChristoph Hellwig <hch@lst.de>
Tue, 24 Mar 2020 07:25:11 +0000 (08:25 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 24 Mar 2020 13:57:07 +0000 (07:57 -0600)
There is no good reason for __bdevname to exist.  Just open code
printing the string in the callers.  For three of them the format
string can be trivially merged into existing printk statements,
and in init/do_mounts.c we can at least do the scnprintf once at
the start of the function, and unconditional of CONFIG_BLOCK to
make the output for tiny configfs a little more helpful.

Acked-by: Theodore Ts'o <tytso@mit.edu> # for ext4
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/partition-generic.c
drivers/md/md.c
fs/ext4/super.c
fs/reiserfs/journal.c
include/linux/fs.h
init/do_mounts.c

index 564fae77711df6cb1bc45e7fdd3d0b8e17272e3f..98256e6beabbac70878b2ae3bf27f28f4f5923e5 100644 (file)
@@ -57,20 +57,6 @@ const char *bio_devname(struct bio *bio, char *buf)
 }
 EXPORT_SYMBOL(bio_devname);
 
-/*
- * There's very little reason to use this, you should really
- * have a struct block_device just about everywhere and use
- * bdevname() instead.
- */
-const char *__bdevname(dev_t dev, char *buffer)
-{
-       scnprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)",
-                               MAJOR(dev), MINOR(dev));
-       return buffer;
-}
-
-EXPORT_SYMBOL(__bdevname);
-
 static ssize_t part_partition_show(struct device *dev,
                                   struct device_attribute *attr, char *buf)
 {
index 469f551863bead9ca419a2a11f20a5a18677f67d..8238fb64f87fb4e5741213c28fcd7787ead05fe3 100644 (file)
@@ -2491,12 +2491,12 @@ static int lock_rdev(struct md_rdev *rdev, dev_t dev, int shared)
 {
        int err = 0;
        struct block_device *bdev;
-       char b[BDEVNAME_SIZE];
 
        bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL,
                                 shared ? (struct md_rdev *)lock_rdev : rdev);
        if (IS_ERR(bdev)) {
-               pr_warn("md: could not open %s.\n", __bdevname(dev, b));
+               pr_warn("md: could not open device unknown-block(%u,%u).\n",
+                       MAJOR(dev), MINOR(dev));
                return PTR_ERR(bdev);
        }
        rdev->bdev = bdev;
index 0c7c4adb664ec993651ae6dabba860ccd7827567..4cbd1cc34dfa3d703362d9ab43c642dd19dc0e05 100644 (file)
@@ -927,7 +927,6 @@ void ext4_update_dynamic_rev(struct super_block *sb)
 static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb)
 {
        struct block_device *bdev;
-       char b[BDEVNAME_SIZE];
 
        bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb);
        if (IS_ERR(bdev))
@@ -935,8 +934,9 @@ static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb)
        return bdev;
 
 fail:
-       ext4_msg(sb, KERN_ERR, "failed to open journal device %s: %ld",
-                       __bdevname(dev, b), PTR_ERR(bdev));
+       ext4_msg(sb, KERN_ERR,
+                "failed to open journal device unknown-block(%u,%u) %ld",
+                MAJOR(dev), MINOR(dev), PTR_ERR(bdev));
        return NULL;
 }
 
index 072156c4f8951efc3095ff4251e77619863d54f5..5c766330e493bdd43be1ee7615cd98d9d2430bcc 100644 (file)
@@ -2599,7 +2599,6 @@ static int journal_init_dev(struct super_block *super,
        int result;
        dev_t jdev;
        fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
-       char b[BDEVNAME_SIZE];
 
        result = 0;
 
@@ -2621,8 +2620,8 @@ static int journal_init_dev(struct super_block *super,
                        result = PTR_ERR(journal->j_dev_bd);
                        journal->j_dev_bd = NULL;
                        reiserfs_warning(super, "sh-458",
-                                        "cannot init journal device '%s': %i",
-                                        __bdevname(jdev, b), result);
+                                        "cannot init journal device unknown-block(%u,%u): %i",
+                                        MAJOR(jdev), MINOR(jdev), result);
                        return result;
                } else if (jdev != super->s_dev)
                        set_blocksize(journal->j_dev_bd, super->s_blocksize);
index 3cd4fe6b845e7ff8c6263488030bd3553c302850..561b35e3b95b47ea62e67bc18cfda61116429dca 100644 (file)
@@ -2699,7 +2699,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name)
 
 #ifdef CONFIG_BLOCK
 #define BLKDEV_MAJOR_MAX       512
-extern const char *__bdevname(dev_t, char *buffer);
 extern const char *bdevname(struct block_device *bdev, char *buffer);
 extern struct block_device *lookup_bdev(const char *);
 extern void blkdev_show(struct seq_file *,off_t);
index 0ae9cc22f2ae255c55337812b121a9a2d2eec9ca..29d326b6c29d2d05b05adf647e1f38bb1bef07d1 100644 (file)
@@ -429,12 +429,10 @@ void __init mount_block_root(char *name, int flags)
        struct page *page = alloc_page(GFP_KERNEL);
        char *fs_names = page_address(page);
        char *p;
-#ifdef CONFIG_BLOCK
        char b[BDEVNAME_SIZE];
-#else
-       const char *b = name;
-#endif
 
+       scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)",
+                 MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
        get_fs_names(fs_names);
 retry:
        for (p = fs_names; *p; p += strlen(p)+1) {
@@ -451,9 +449,6 @@ retry:
                 * and bad superblock on root device.
                 * and give them a list of the available devices
                 */
-#ifdef CONFIG_BLOCK
-               __bdevname(ROOT_DEV, b);
-#endif
                printk("VFS: Cannot open root device \"%s\" or %s: error %d\n",
                                root_device_name, b, err);
                printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
@@ -476,9 +471,6 @@ retry:
        for (p = fs_names; *p; p += strlen(p)+1)
                printk(" %s", p);
        printk("\n");
-#ifdef CONFIG_BLOCK
-       __bdevname(ROOT_DEV, b);
-#endif
        panic("VFS: Unable to mount root fs on %s", b);
 out:
        put_page(page);