Skip to content

Commit 2af3a81

Browse files
toshikanistellarhopper
authored andcommitted
block: Add vfs_msg() interface
In preparation of moving DAX capability checks to the block layer from filesystem code, add a VFS message interface that aligns with filesystem's message format. For instance, a vfs_msg() message followed by XFS messages in case of a dax mount error may look like: VFS (pmem0p1): error: unaligned partition for dax XFS (pmem0p1): DAX unsupported by block device. Turning off DAX. XFS (pmem0p1): Mounting V5 Filesystem : vfs_msg() is largely based on ext4_msg(). Signed-off-by: Toshi Kani <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Jens Axboe <[email protected]> Cc: "Theodore Ts'o" <[email protected]> Cc: Andreas Dilger <[email protected]> Cc: Jan Kara <[email protected]> Cc: Dave Chinner <[email protected]> Cc: Dan Williams <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Boaz Harrosh <[email protected]> Signed-off-by: Vishal Verma <[email protected]>
1 parent 7795bec commit 2af3a81

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

fs/block_dev.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ struct block_device *I_BDEV(struct inode *inode)
5050
}
5151
EXPORT_SYMBOL(I_BDEV);
5252

53+
void __vfs_msg(struct super_block *sb, const char *prefix, const char *fmt, ...)
54+
{
55+
struct va_format vaf;
56+
va_list args;
57+
58+
va_start(args, fmt);
59+
vaf.fmt = fmt;
60+
vaf.va = &args;
61+
printk_ratelimited("%sVFS (%s): %pV\n", prefix, sb->s_id, &vaf);
62+
va_end(args);
63+
}
64+
5365
static void bdev_write_inode(struct block_device *bdev)
5466
{
5567
struct inode *inode = bdev->bd_inode;

include/linux/blkdev.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,17 @@ static inline void rq_flush_dcache_pages(struct request *rq)
767767
}
768768
#endif
769769

770+
#ifdef CONFIG_PRINTK
771+
#define vfs_msg(sb, level, fmt, ...) \
772+
__vfs_msg(sb, level, fmt, ##__VA_ARGS__)
773+
#else
774+
#define vfs_msg(sb, level, fmt, ...) \
775+
do { \
776+
no_printk(fmt, ##__VA_ARGS__); \
777+
__vfs_msg(sb, "", " "); \
778+
} while (0)
779+
#endif
780+
770781
extern int blk_register_queue(struct gendisk *disk);
771782
extern void blk_unregister_queue(struct gendisk *disk);
772783
extern blk_qc_t generic_make_request(struct bio *bio);

0 commit comments

Comments
 (0)