Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

reiserfs: Convert to bdev_open_by_dev/path()

Convert reiserfs to use bdev_open_by_dev/path() and pass the handle
around.

CC: reiserfs-devel@vger.kernel.org
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-27-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jan Kara and committed by
Christian Brauner
ba1787a5 ebc41854

+33 -36
+25 -31
fs/reiserfs/journal.c
··· 90 90 static int can_dirty(struct reiserfs_journal_cnode *cn); 91 91 static int journal_join(struct reiserfs_transaction_handle *th, 92 92 struct super_block *sb); 93 - static void release_journal_dev(struct super_block *super, 94 - struct reiserfs_journal *journal); 93 + static void release_journal_dev(struct reiserfs_journal *journal); 95 94 static void dirty_one_transaction(struct super_block *s, 96 95 struct reiserfs_journal_list *jl); 97 96 static void flush_async_commits(struct work_struct *work); ··· 1892 1893 * j_header_bh is on the journal dev, make sure 1893 1894 * not to release the journal dev until we brelse j_header_bh 1894 1895 */ 1895 - release_journal_dev(sb, journal); 1896 + release_journal_dev(journal); 1896 1897 vfree(journal); 1897 1898 } 1898 1899 ··· 2386 2387 2387 2388 cur_dblock = SB_ONDISK_JOURNAL_1st_BLOCK(sb); 2388 2389 reiserfs_info(sb, "checking transaction log (%pg)\n", 2389 - journal->j_dev_bd); 2390 + journal->j_bdev_handle->bdev); 2390 2391 start = ktime_get_seconds(); 2391 2392 2392 2393 /* ··· 2447 2448 * device and journal device to be the same 2448 2449 */ 2449 2450 d_bh = 2450 - reiserfs_breada(journal->j_dev_bd, cur_dblock, 2451 + reiserfs_breada(journal->j_bdev_handle->bdev, cur_dblock, 2451 2452 sb->s_blocksize, 2452 2453 SB_ONDISK_JOURNAL_1st_BLOCK(sb) + 2453 2454 SB_ONDISK_JOURNAL_SIZE(sb)); ··· 2586 2587 SB_JOURNAL(sb)->j_current_jl = alloc_journal_list(sb); 2587 2588 } 2588 2589 2589 - static void release_journal_dev(struct super_block *super, 2590 - struct reiserfs_journal *journal) 2590 + static void release_journal_dev(struct reiserfs_journal *journal) 2591 2591 { 2592 - if (journal->j_dev_bd != NULL) { 2593 - void *holder = NULL; 2594 - 2595 - if (journal->j_dev_bd->bd_dev != super->s_dev) 2596 - holder = journal; 2597 - 2598 - blkdev_put(journal->j_dev_bd, holder); 2599 - journal->j_dev_bd = NULL; 2592 + if (journal->j_bdev_handle) { 2593 + bdev_release(journal->j_bdev_handle); 2594 + journal->j_bdev_handle = NULL; 2600 2595 } 2601 2596 } 2602 2597 ··· 2605 2612 2606 2613 result = 0; 2607 2614 2608 - journal->j_dev_bd = NULL; 2615 + journal->j_bdev_handle = NULL; 2609 2616 jdev = SB_ONDISK_JOURNAL_DEVICE(super) ? 2610 2617 new_decode_dev(SB_ONDISK_JOURNAL_DEVICE(super)) : super->s_dev; 2611 2618 ··· 2616 2623 if ((!jdev_name || !jdev_name[0])) { 2617 2624 if (jdev == super->s_dev) 2618 2625 holder = NULL; 2619 - journal->j_dev_bd = blkdev_get_by_dev(jdev, blkdev_mode, holder, 2620 - NULL); 2621 - if (IS_ERR(journal->j_dev_bd)) { 2622 - result = PTR_ERR(journal->j_dev_bd); 2623 - journal->j_dev_bd = NULL; 2626 + journal->j_bdev_handle = bdev_open_by_dev(jdev, blkdev_mode, 2627 + holder, NULL); 2628 + if (IS_ERR(journal->j_bdev_handle)) { 2629 + result = PTR_ERR(journal->j_bdev_handle); 2630 + journal->j_bdev_handle = NULL; 2624 2631 reiserfs_warning(super, "sh-458", 2625 2632 "cannot init journal device unknown-block(%u,%u): %i", 2626 2633 MAJOR(jdev), MINOR(jdev), result); 2627 2634 return result; 2628 2635 } else if (jdev != super->s_dev) 2629 - set_blocksize(journal->j_dev_bd, super->s_blocksize); 2636 + set_blocksize(journal->j_bdev_handle->bdev, 2637 + super->s_blocksize); 2630 2638 2631 2639 return 0; 2632 2640 } 2633 2641 2634 - journal->j_dev_bd = blkdev_get_by_path(jdev_name, blkdev_mode, holder, 2635 - NULL); 2636 - if (IS_ERR(journal->j_dev_bd)) { 2637 - result = PTR_ERR(journal->j_dev_bd); 2638 - journal->j_dev_bd = NULL; 2642 + journal->j_bdev_handle = bdev_open_by_path(jdev_name, blkdev_mode, 2643 + holder, NULL); 2644 + if (IS_ERR(journal->j_bdev_handle)) { 2645 + result = PTR_ERR(journal->j_bdev_handle); 2646 + journal->j_bdev_handle = NULL; 2639 2647 reiserfs_warning(super, "sh-457", 2640 2648 "journal_init_dev: Cannot open '%s': %i", 2641 2649 jdev_name, result); 2642 2650 return result; 2643 2651 } 2644 2652 2645 - set_blocksize(journal->j_dev_bd, super->s_blocksize); 2653 + set_blocksize(journal->j_bdev_handle->bdev, super->s_blocksize); 2646 2654 reiserfs_info(super, 2647 2655 "journal_init_dev: journal device: %pg\n", 2648 - journal->j_dev_bd); 2656 + journal->j_bdev_handle->bdev); 2649 2657 return 0; 2650 2658 } 2651 2659 ··· 2804 2810 "journal header magic %x (device %pg) does " 2805 2811 "not match to magic found in super block %x", 2806 2812 jh->jh_journal.jp_journal_magic, 2807 - journal->j_dev_bd, 2813 + journal->j_bdev_handle->bdev, 2808 2814 sb_jp_journal_magic(rs)); 2809 2815 brelse(bhjh); 2810 2816 goto free_and_return; ··· 2828 2834 reiserfs_info(sb, "journal params: device %pg, size %u, " 2829 2835 "journal first block %u, max trans len %u, max batch %u, " 2830 2836 "max commit age %u, max trans age %u\n", 2831 - journal->j_dev_bd, 2837 + journal->j_bdev_handle->bdev, 2832 2838 SB_ONDISK_JOURNAL_SIZE(sb), 2833 2839 SB_ONDISK_JOURNAL_1st_BLOCK(sb), 2834 2840 journal->j_trans_max,
+1 -1
fs/reiserfs/procfs.c
··· 354 354 "prepare: \t%12lu\n" 355 355 "prepare_retry: \t%12lu\n", 356 356 DJP(jp_journal_1st_block), 357 - SB_JOURNAL(sb)->j_dev_bd, 357 + SB_JOURNAL(sb)->j_bdev_handle->bdev, 358 358 DJP(jp_journal_dev), 359 359 DJP(jp_journal_size), 360 360 DJP(jp_journal_trans_max),
+7 -4
fs/reiserfs/reiserfs.h
··· 299 299 /* oldest journal block. start here for traverse */ 300 300 struct reiserfs_journal_cnode *j_first; 301 301 302 - struct block_device *j_dev_bd; 302 + struct bdev_handle *j_bdev_handle; 303 303 304 304 /* first block on s_dev of reserved area journal */ 305 305 int j_1st_reserved_block; ··· 2809 2809 #define journal_hash(t,sb,block) ((t)[_jhashfn((sb),(block)) & JBH_HASH_MASK]) 2810 2810 2811 2811 /* We need these to make journal.c code more readable */ 2812 - #define journal_find_get_block(s, block) __find_get_block(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) 2813 - #define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) 2814 - #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) 2812 + #define journal_find_get_block(s, block) __find_get_block(\ 2813 + SB_JOURNAL(s)->j_bdev_handle->bdev, block, s->s_blocksize) 2814 + #define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_bdev_handle->bdev,\ 2815 + block, s->s_blocksize) 2816 + #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_bdev_handle->bdev,\ 2817 + block, s->s_blocksize) 2815 2818 2816 2819 enum reiserfs_bh_state_bits { 2817 2820 BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */