@@ -426,11 +426,11 @@ static void reset_bdev(struct zram *zram)
426426 if (!zram -> backing_dev )
427427 return ;
428428
429- bdev_release (zram -> bdev_handle );
429+ fput (zram -> bdev_file );
430430 /* hope filp_close flush all of IO */
431431 filp_close (zram -> backing_dev , NULL );
432432 zram -> backing_dev = NULL ;
433- zram -> bdev_handle = NULL ;
433+ zram -> bdev_file = NULL ;
434434 zram -> disk -> fops = & zram_devops ;
435435 kvfree (zram -> bitmap );
436436 zram -> bitmap = NULL ;
@@ -476,7 +476,7 @@ static ssize_t backing_dev_store(struct device *dev,
476476 struct address_space * mapping ;
477477 unsigned int bitmap_sz ;
478478 unsigned long nr_pages , * bitmap = NULL ;
479- struct bdev_handle * bdev_handle = NULL ;
479+ struct file * bdev_file = NULL ;
480480 int err ;
481481 struct zram * zram = dev_to_zram (dev );
482482
@@ -513,11 +513,11 @@ static ssize_t backing_dev_store(struct device *dev,
513513 goto out ;
514514 }
515515
516- bdev_handle = bdev_open_by_dev (inode -> i_rdev ,
516+ bdev_file = bdev_file_open_by_dev (inode -> i_rdev ,
517517 BLK_OPEN_READ | BLK_OPEN_WRITE , zram , NULL );
518- if (IS_ERR (bdev_handle )) {
519- err = PTR_ERR (bdev_handle );
520- bdev_handle = NULL ;
518+ if (IS_ERR (bdev_file )) {
519+ err = PTR_ERR (bdev_file );
520+ bdev_file = NULL ;
521521 goto out ;
522522 }
523523
@@ -531,7 +531,7 @@ static ssize_t backing_dev_store(struct device *dev,
531531
532532 reset_bdev (zram );
533533
534- zram -> bdev_handle = bdev_handle ;
534+ zram -> bdev_file = bdev_file ;
535535 zram -> backing_dev = backing_dev ;
536536 zram -> bitmap = bitmap ;
537537 zram -> nr_pages = nr_pages ;
@@ -544,8 +544,8 @@ static ssize_t backing_dev_store(struct device *dev,
544544out :
545545 kvfree (bitmap );
546546
547- if (bdev_handle )
548- bdev_release ( bdev_handle );
547+ if (bdev_file )
548+ fput ( bdev_file );
549549
550550 if (backing_dev )
551551 filp_close (backing_dev , NULL );
@@ -587,7 +587,7 @@ static void read_from_bdev_async(struct zram *zram, struct page *page,
587587{
588588 struct bio * bio ;
589589
590- bio = bio_alloc (zram -> bdev_handle -> bdev , 1 , parent -> bi_opf , GFP_NOIO );
590+ bio = bio_alloc (file_bdev ( zram -> bdev_file ) , 1 , parent -> bi_opf , GFP_NOIO );
591591 bio -> bi_iter .bi_sector = entry * (PAGE_SIZE >> 9 );
592592 __bio_add_page (bio , page , PAGE_SIZE , 0 );
593593 bio_chain (bio , parent );
@@ -703,7 +703,7 @@ static ssize_t writeback_store(struct device *dev,
703703 continue ;
704704 }
705705
706- bio_init (& bio , zram -> bdev_handle -> bdev , & bio_vec , 1 ,
706+ bio_init (& bio , file_bdev ( zram -> bdev_file ) , & bio_vec , 1 ,
707707 REQ_OP_WRITE | REQ_SYNC );
708708 bio .bi_iter .bi_sector = blk_idx * (PAGE_SIZE >> 9 );
709709 __bio_add_page (& bio , page , PAGE_SIZE , 0 );
@@ -785,7 +785,7 @@ static void zram_sync_read(struct work_struct *work)
785785 struct bio_vec bv ;
786786 struct bio bio ;
787787
788- bio_init (& bio , zw -> zram -> bdev_handle -> bdev , & bv , 1 , REQ_OP_READ );
788+ bio_init (& bio , file_bdev ( zw -> zram -> bdev_file ) , & bv , 1 , REQ_OP_READ );
789789 bio .bi_iter .bi_sector = zw -> entry * (PAGE_SIZE >> 9 );
790790 __bio_add_page (& bio , zw -> page , PAGE_SIZE , 0 );
791791 zw -> error = submit_bio_wait (& bio );
0 commit comments