Skip to content

Commit 87b355f

Browse files
committed
erofs: port 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 9ae061c commit 87b355f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

fs/erofs/data.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *map)
220220
up_read(&devs->rwsem);
221221
return 0;
222222
}
223-
map->m_bdev = dif->bdev_handle ? dif->bdev_handle->bdev : NULL;
223+
map->m_bdev = dif->bdev_file ? file_bdev(dif->bdev_file) : NULL;
224224
map->m_daxdev = dif->dax_dev;
225225
map->m_dax_part_off = dif->dax_part_off;
226226
map->m_fscache = dif->fscache;
@@ -238,8 +238,8 @@ int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *map)
238238
if (map->m_pa >= startoff &&
239239
map->m_pa < startoff + length) {
240240
map->m_pa -= startoff;
241-
map->m_bdev = dif->bdev_handle ?
242-
dif->bdev_handle->bdev : NULL;
241+
map->m_bdev = dif->bdev_file ?
242+
file_bdev(dif->bdev_file) : NULL;
243243
map->m_daxdev = dif->dax_dev;
244244
map->m_dax_part_off = dif->dax_part_off;
245245
map->m_fscache = dif->fscache;

fs/erofs/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typedef u32 erofs_blk_t;
4949
struct erofs_device_info {
5050
char *path;
5151
struct erofs_fscache *fscache;
52-
struct bdev_handle *bdev_handle;
52+
struct file *bdev_file;
5353
struct dax_device *dax_dev;
5454
u64 dax_part_off;
5555

fs/erofs/super.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
177177
struct erofs_sb_info *sbi = EROFS_SB(sb);
178178
struct erofs_fscache *fscache;
179179
struct erofs_deviceslot *dis;
180-
struct bdev_handle *bdev_handle;
180+
struct file *bdev_file;
181181
void *ptr;
182182

183183
ptr = erofs_read_metabuf(buf, sb, erofs_blknr(sb, *pos), EROFS_KMAP);
@@ -201,12 +201,12 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
201201
return PTR_ERR(fscache);
202202
dif->fscache = fscache;
203203
} else if (!sbi->devs->flatdev) {
204-
bdev_handle = bdev_open_by_path(dif->path, BLK_OPEN_READ,
204+
bdev_file = bdev_file_open_by_path(dif->path, BLK_OPEN_READ,
205205
sb->s_type, NULL);
206-
if (IS_ERR(bdev_handle))
207-
return PTR_ERR(bdev_handle);
208-
dif->bdev_handle = bdev_handle;
209-
dif->dax_dev = fs_dax_get_by_bdev(bdev_handle->bdev,
206+
if (IS_ERR(bdev_file))
207+
return PTR_ERR(bdev_file);
208+
dif->bdev_file = bdev_file;
209+
dif->dax_dev = fs_dax_get_by_bdev(file_bdev(bdev_file),
210210
&dif->dax_part_off, NULL, NULL);
211211
}
212212

@@ -754,8 +754,8 @@ static int erofs_release_device_info(int id, void *ptr, void *data)
754754
struct erofs_device_info *dif = ptr;
755755

756756
fs_put_dax(dif->dax_dev, NULL);
757-
if (dif->bdev_handle)
758-
bdev_release(dif->bdev_handle);
757+
if (dif->bdev_file)
758+
fput(dif->bdev_file);
759759
erofs_fscache_unregister_cookie(dif->fscache);
760760
dif->fscache = NULL;
761761
kfree(dif->path);

0 commit comments

Comments
 (0)