Skip to content

Commit 1d3aa0b

Browse files
committed
ocfs2: port block device access to file
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 4b2cfbd commit 1d3aa0b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

fs/ocfs2/cluster/heartbeat.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ struct o2hb_region {
213213
unsigned int hr_num_pages;
214214

215215
struct page **hr_slot_data;
216-
struct bdev_handle *hr_bdev_handle;
216+
struct file *hr_bdev_file;
217217
struct o2hb_disk_slot *hr_slots;
218218

219219
/* live node map of this region */
@@ -263,7 +263,7 @@ struct o2hb_region {
263263

264264
static inline struct block_device *reg_bdev(struct o2hb_region *reg)
265265
{
266-
return reg->hr_bdev_handle ? reg->hr_bdev_handle->bdev : NULL;
266+
return reg->hr_bdev_file ? file_bdev(reg->hr_bdev_file) : NULL;
267267
}
268268

269269
struct o2hb_bio_wait_ctxt {
@@ -1509,8 +1509,8 @@ static void o2hb_region_release(struct config_item *item)
15091509
kfree(reg->hr_slot_data);
15101510
}
15111511

1512-
if (reg->hr_bdev_handle)
1513-
bdev_release(reg->hr_bdev_handle);
1512+
if (reg->hr_bdev_file)
1513+
fput(reg->hr_bdev_file);
15141514

15151515
kfree(reg->hr_slots);
15161516

@@ -1569,7 +1569,7 @@ static ssize_t o2hb_region_block_bytes_store(struct config_item *item,
15691569
unsigned long block_bytes;
15701570
unsigned int block_bits;
15711571

1572-
if (reg->hr_bdev_handle)
1572+
if (reg->hr_bdev_file)
15731573
return -EINVAL;
15741574

15751575
status = o2hb_read_block_input(reg, page, &block_bytes,
@@ -1598,7 +1598,7 @@ static ssize_t o2hb_region_start_block_store(struct config_item *item,
15981598
char *p = (char *)page;
15991599
ssize_t ret;
16001600

1601-
if (reg->hr_bdev_handle)
1601+
if (reg->hr_bdev_file)
16021602
return -EINVAL;
16031603

16041604
ret = kstrtoull(p, 0, &tmp);
@@ -1623,7 +1623,7 @@ static ssize_t o2hb_region_blocks_store(struct config_item *item,
16231623
unsigned long tmp;
16241624
char *p = (char *)page;
16251625

1626-
if (reg->hr_bdev_handle)
1626+
if (reg->hr_bdev_file)
16271627
return -EINVAL;
16281628

16291629
tmp = simple_strtoul(p, &p, 0);
@@ -1642,7 +1642,7 @@ static ssize_t o2hb_region_dev_show(struct config_item *item, char *page)
16421642
{
16431643
unsigned int ret = 0;
16441644

1645-
if (to_o2hb_region(item)->hr_bdev_handle)
1645+
if (to_o2hb_region(item)->hr_bdev_file)
16461646
ret = sprintf(page, "%pg\n", reg_bdev(to_o2hb_region(item)));
16471647

16481648
return ret;
@@ -1753,7 +1753,7 @@ static int o2hb_populate_slot_data(struct o2hb_region *reg)
17531753
}
17541754

17551755
/*
1756-
* this is acting as commit; we set up all of hr_bdev_handle and hr_task or
1756+
* this is acting as commit; we set up all of hr_bdev_file and hr_task or
17571757
* nothing
17581758
*/
17591759
static ssize_t o2hb_region_dev_store(struct config_item *item,
@@ -1769,7 +1769,7 @@ static ssize_t o2hb_region_dev_store(struct config_item *item,
17691769
ssize_t ret = -EINVAL;
17701770
int live_threshold;
17711771

1772-
if (reg->hr_bdev_handle)
1772+
if (reg->hr_bdev_file)
17731773
goto out;
17741774

17751775
/* We can't heartbeat without having had our node number
@@ -1795,11 +1795,11 @@ static ssize_t o2hb_region_dev_store(struct config_item *item,
17951795
if (!S_ISBLK(f.file->f_mapping->host->i_mode))
17961796
goto out2;
17971797

1798-
reg->hr_bdev_handle = bdev_open_by_dev(f.file->f_mapping->host->i_rdev,
1798+
reg->hr_bdev_file = bdev_file_open_by_dev(f.file->f_mapping->host->i_rdev,
17991799
BLK_OPEN_WRITE | BLK_OPEN_READ, NULL, NULL);
1800-
if (IS_ERR(reg->hr_bdev_handle)) {
1801-
ret = PTR_ERR(reg->hr_bdev_handle);
1802-
reg->hr_bdev_handle = NULL;
1800+
if (IS_ERR(reg->hr_bdev_file)) {
1801+
ret = PTR_ERR(reg->hr_bdev_file);
1802+
reg->hr_bdev_file = NULL;
18031803
goto out2;
18041804
}
18051805

@@ -1903,8 +1903,8 @@ static ssize_t o2hb_region_dev_store(struct config_item *item,
19031903

19041904
out3:
19051905
if (ret < 0) {
1906-
bdev_release(reg->hr_bdev_handle);
1907-
reg->hr_bdev_handle = NULL;
1906+
fput(reg->hr_bdev_file);
1907+
reg->hr_bdev_file = NULL;
19081908
}
19091909
out2:
19101910
fdput(f);

0 commit comments

Comments
 (0)