tracing: fix test for blockdev inode in wb error handling tracepoints
Subsystems (3)
PATCH 1/1 tracing: fix test for blockdev inode in wb error handling tracepoints
Al pointed out that the test for whether a mapping refers to a blockdev inode in these tracepoints is garbage, as the superblock is always non-NULL.
Add a new mapping_to_dev helper function that determines this the correct way, and change the tracepoints to use it. Also, fix up the indentation in this file.
--- include/linux/fs.h | 20 +++++++ include/trace/events/filemap.h | 99 +++++++++++++++------------------- 2 files changed, 64 insertions(+), 55 deletions(-)
include/linux/fs.h +20 -0
@@ -2590,6 +2590,21 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb) {return sb == blockdev_superblock; } + +/* +* Return the device associated with this mapping. +* +* For normal inodes, return the sb of the backing filesystem, for blockdev +* inodes, return the block device number associated with the inode. +*/ +static inline dev_t mapping_to_dev (struct address_space *mapping) +{ +struct inode *inode = mapping->host; + +if (sb_is_blkdev_sb (inode->i_sb)) +return inode->i_rdev; +return inode->i_sb->s_dev; +}#else static inline void bd_forget (struct inode *inode) {}static inline int sync_blockdev (struct block_device *bdev) {return 0 ; }
@@ -2619,6 +2634,11 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb) {return false; } + +static inline dev_t mapping_to_dev (struct address_space *mapping) +{ +return mapping->host->i_sb->s_dev; +}#endif extern int sync_filesystem (struct super_block *);extern const struct file_operations def_blk_fops;
include/trace/events/filemap.h +44 -55
114 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH v2 1/1 tracing: fix test for blockdev inode in wb error handling tracepoints
Al pointed out that the test for whether a mapping refers to a blockdev inode in these tracepoints is garbage, as the superblock is always non-NULL.
Add a new mapping_to_dev helper function that determines this the correct way, and change the tracepoints to use it. Also, fix up the indentation in this file.
--- include/linux/fs.h | 16 ++++++ include/trace/events/filemap.h | 99 +++++++++++++++------------------- 2 files changed, 60 insertions(+), 55 deletions(-)
Al, sorry.
I had based the original on an older tree. This one should merge more cleanly, and also just adds a single, non-conditionally compiled helper.
include/linux/fs.h +16 -0
@@ -2616,6 +2616,22 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb) return false; }#endif + +/* +* Return the device associated with this mapping. +* +* For normal inodes, return the sb of the backing filesystem, for blockdev +* inodes, return the block device number associated with the inode. +*/ +static inline dev_t mapping_to_dev (struct address_space *mapping) +{ +struct inode *inode = mapping->host; + +if (sb_is_blkdev_sb (inode->i_sb)) +return inode->i_rdev; +return inode->i_sb->s_dev; +} +extern int sync_filesystem (struct super_block *);extern const struct file_operations def_blk_fops;extern const struct file_operations def_chr_fops;
include/trace/events/filemap.h +44 -55
114 lines not on this page · raw message
Signature · 1 line
2.24.1