1

jfs: Convert to bdev_open_by_dev()

Convert jfs to use bdev_open_by_dev() and pass the handle around.

CC: Dave Kleikamp <shaggy@kernel.org>
CC: jfs-discussion@lists.sourceforge.net
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-24-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Jan Kara 2023-09-27 11:34:30 +02:00 committed by Christian Brauner
parent 2b107946f8
commit 898c57f456
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
3 changed files with 18 additions and 16 deletions

View File

@ -1058,7 +1058,7 @@ void jfs_syncpt(struct jfs_log *log, int hard_sync)
int lmLogOpen(struct super_block *sb) int lmLogOpen(struct super_block *sb)
{ {
int rc; int rc;
struct block_device *bdev; struct bdev_handle *bdev_handle;
struct jfs_log *log; struct jfs_log *log;
struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_sb_info *sbi = JFS_SBI(sb);
@ -1070,7 +1070,7 @@ int lmLogOpen(struct super_block *sb)
mutex_lock(&jfs_log_mutex); mutex_lock(&jfs_log_mutex);
list_for_each_entry(log, &jfs_external_logs, journal_list) { list_for_each_entry(log, &jfs_external_logs, journal_list) {
if (log->bdev->bd_dev == sbi->logdev) { if (log->bdev_handle->bdev->bd_dev == sbi->logdev) {
if (!uuid_equal(&log->uuid, &sbi->loguuid)) { if (!uuid_equal(&log->uuid, &sbi->loguuid)) {
jfs_warn("wrong uuid on JFS journal"); jfs_warn("wrong uuid on JFS journal");
mutex_unlock(&jfs_log_mutex); mutex_unlock(&jfs_log_mutex);
@ -1100,14 +1100,14 @@ int lmLogOpen(struct super_block *sb)
* file systems to log may have n-to-1 relationship; * file systems to log may have n-to-1 relationship;
*/ */
bdev = blkdev_get_by_dev(sbi->logdev, BLK_OPEN_READ | BLK_OPEN_WRITE, bdev_handle = bdev_open_by_dev(sbi->logdev,
log, NULL); BLK_OPEN_READ | BLK_OPEN_WRITE, log, NULL);
if (IS_ERR(bdev)) { if (IS_ERR(bdev_handle)) {
rc = PTR_ERR(bdev); rc = PTR_ERR(bdev_handle);
goto free; goto free;
} }
log->bdev = bdev; log->bdev_handle = bdev_handle;
uuid_copy(&log->uuid, &sbi->loguuid); uuid_copy(&log->uuid, &sbi->loguuid);
/* /*
@ -1141,7 +1141,7 @@ journal_found:
lbmLogShutdown(log); lbmLogShutdown(log);
close: /* close external log device */ close: /* close external log device */
blkdev_put(bdev, log); bdev_release(bdev_handle);
free: /* free log descriptor */ free: /* free log descriptor */
mutex_unlock(&jfs_log_mutex); mutex_unlock(&jfs_log_mutex);
@ -1162,7 +1162,7 @@ static int open_inline_log(struct super_block *sb)
init_waitqueue_head(&log->syncwait); init_waitqueue_head(&log->syncwait);
set_bit(log_INLINELOG, &log->flag); set_bit(log_INLINELOG, &log->flag);
log->bdev = sb->s_bdev; log->bdev_handle = sb->s_bdev_handle;
log->base = addressPXD(&JFS_SBI(sb)->logpxd); log->base = addressPXD(&JFS_SBI(sb)->logpxd);
log->size = lengthPXD(&JFS_SBI(sb)->logpxd) >> log->size = lengthPXD(&JFS_SBI(sb)->logpxd) >>
(L2LOGPSIZE - sb->s_blocksize_bits); (L2LOGPSIZE - sb->s_blocksize_bits);
@ -1436,7 +1436,7 @@ int lmLogClose(struct super_block *sb)
{ {
struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_sb_info *sbi = JFS_SBI(sb);
struct jfs_log *log = sbi->log; struct jfs_log *log = sbi->log;
struct block_device *bdev; struct bdev_handle *bdev_handle;
int rc = 0; int rc = 0;
jfs_info("lmLogClose: log:0x%p", log); jfs_info("lmLogClose: log:0x%p", log);
@ -1482,10 +1482,10 @@ int lmLogClose(struct super_block *sb)
* external log as separate logical volume * external log as separate logical volume
*/ */
list_del(&log->journal_list); list_del(&log->journal_list);
bdev = log->bdev; bdev_handle = log->bdev_handle;
rc = lmLogShutdown(log); rc = lmLogShutdown(log);
blkdev_put(bdev, log); bdev_release(bdev_handle);
kfree(log); kfree(log);
@ -1972,7 +1972,7 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
bp->l_flag |= lbmREAD; bp->l_flag |= lbmREAD;
bio = bio_alloc(log->bdev, 1, REQ_OP_READ, GFP_NOFS); bio = bio_alloc(log->bdev_handle->bdev, 1, REQ_OP_READ, GFP_NOFS);
bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9);
__bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset);
BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); BUG_ON(bio->bi_iter.bi_size != LOGPSIZE);
@ -2113,7 +2113,8 @@ static void lbmStartIO(struct lbuf * bp)
jfs_info("lbmStartIO"); jfs_info("lbmStartIO");
bio = bio_alloc(log->bdev, 1, REQ_OP_WRITE | REQ_SYNC, GFP_NOFS); bio = bio_alloc(log->bdev_handle->bdev, 1, REQ_OP_WRITE | REQ_SYNC,
GFP_NOFS);
bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9);
__bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset);
BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); BUG_ON(bio->bi_iter.bi_size != LOGPSIZE);

View File

@ -356,7 +356,7 @@ struct jfs_log {
* before writing syncpt. * before writing syncpt.
*/ */
struct list_head journal_list; /* Global list */ struct list_head journal_list; /* Global list */
struct block_device *bdev; /* 4: log lv pointer */ struct bdev_handle *bdev_handle; /* 4: log lv pointer */
int serial; /* 4: log mount serial number */ int serial; /* 4: log mount serial number */
s64 base; /* @8: log extent address (inline log ) */ s64 base; /* @8: log extent address (inline log ) */

View File

@ -430,7 +430,8 @@ int updateSuper(struct super_block *sb, uint state)
if (state == FM_MOUNT) { if (state == FM_MOUNT) {
/* record log's dev_t and mount serial number */ /* record log's dev_t and mount serial number */
j_sb->s_logdev = cpu_to_le32(new_encode_dev(sbi->log->bdev->bd_dev)); j_sb->s_logdev = cpu_to_le32(
new_encode_dev(sbi->log->bdev_handle->bdev->bd_dev));
j_sb->s_logserial = cpu_to_le32(sbi->log->serial); j_sb->s_logserial = cpu_to_le32(sbi->log->serial);
} else if (state == FM_CLEAN) { } else if (state == FM_CLEAN) {
/* /*