Skip to content

Commit

Permalink
compat: test and cocci patch for fs_dax_get_by_bdev
Browse files Browse the repository at this point in the history
The fs_dax_get_by_bdev helper only appeared in 2017, before there was
fs_dax_get_by_host. Since fs_dax_get_by_bdev at the time of the
transition was almost trivially based on fs_dax_get_by_host, just open
code the function.
  • Loading branch information
chrboe authored and Philipp-Reisner committed Apr 7, 2022
1 parent eacd742 commit ba10add
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@@
expression b;
identifier d;
@@
- d = fs_dax_get_by_bdev(b);
+ if (!blk_queue_dax(b ->bd_queue))
+ return -ENODEV;
+ d = fs_dax_get_by_host(b->bd_disk->disk_name);
4 changes: 4 additions & 0 deletions drbd/drbd-kernel-compat/gen_patch_names.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ int main(int argc, char **argv)
patch(1, "bio_max_vecs", true, false,
COMPAT_HAVE_BIO_MAX_VECS, "present");

patch(1, "fs_dax_get_by_bdev", true, false,
COMPAT_HAVE_FS_DAX_GET_BY_BDEV, "present");


/* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
/* #define BLKDEV_ZERO_NOUNMAP */

Expand Down
9 changes: 9 additions & 0 deletions drbd/drbd-kernel-compat/tests/have_fs_dax_get_by_bdev.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* { "version": "v4.13-rc7", "commit": "78f35473508118df5ea04b9515ac3f1aaec0a980", "comment": "fs_dax_get_by_bdev was introduced", "author": "Dan Williams <dan.j.williams@intel.com>", "date": "Wed Aug 30 09:16:38 2017 -0700" } */

#include <linux/blkdev.h>
#include <linux/dax.h>

struct dax_device *foo(struct block_device *bdev)
{
return fs_dax_get_by_bdev(bdev);
}

0 comments on commit ba10add

Please sign in to comment.