Lines Matching refs:bdev_file
58 struct block_device *file_bdev(struct file *bdev_file) in file_bdev() argument
60 return I_BDEV(bdev_file->f_mapping->host); in file_bdev()
845 static inline bool bdev_unclaimed(const struct file *bdev_file) in bdev_unclaimed() argument
847 return bdev_file->private_data == BDEV_I(bdev_file->f_mapping->host); in bdev_unclaimed()
850 static void bdev_yield_write_access(struct file *bdev_file) in bdev_yield_write_access() argument
857 if (bdev_unclaimed(bdev_file)) in bdev_yield_write_access()
860 bdev = file_bdev(bdev_file); in bdev_yield_write_access()
862 if (bdev_file->f_mode & FMODE_WRITE_RESTRICTED) in bdev_yield_write_access()
864 else if (bdev_file->f_mode & FMODE_WRITE) in bdev_yield_write_access()
886 const struct blk_holder_ops *hops, struct file *bdev_file) in bdev_open() argument
942 bdev_file->f_flags |= O_LARGEFILE; in bdev_open()
943 bdev_file->f_mode |= FMODE_CAN_ODIRECT; in bdev_open()
945 bdev_file->f_mode |= FMODE_NOWAIT; in bdev_open()
947 bdev_file->f_mode |= FMODE_WRITE_RESTRICTED; in bdev_open()
948 bdev_file->f_mapping = bdev->bd_mapping; in bdev_open()
949 bdev_file->f_wb_err = filemap_sample_wb_err(bdev_file->f_mapping); in bdev_open()
950 bdev_file->private_data = holder; in bdev_open()
996 struct file *bdev_file; in bdev_file_open_by_dev() local
1010 bdev_file = alloc_file_pseudo_noaccount(BD_INODE(bdev), in bdev_file_open_by_dev()
1012 if (IS_ERR(bdev_file)) { in bdev_file_open_by_dev()
1014 return bdev_file; in bdev_file_open_by_dev()
1018 ret = bdev_open(bdev, mode, holder, hops, bdev_file); in bdev_file_open_by_dev()
1021 bdev_file->private_data = ERR_PTR(ret); in bdev_file_open_by_dev()
1022 fput(bdev_file); in bdev_file_open_by_dev()
1025 return bdev_file; in bdev_file_open_by_dev()
1053 static inline void bd_yield_claim(struct file *bdev_file) in bd_yield_claim() argument
1055 struct block_device *bdev = file_bdev(bdev_file); in bd_yield_claim()
1056 void *holder = bdev_file->private_data; in bd_yield_claim()
1063 if (!bdev_unclaimed(bdev_file)) in bd_yield_claim()
1067 void bdev_release(struct file *bdev_file) in bdev_release() argument
1069 struct block_device *bdev = file_bdev(bdev_file); in bdev_release()
1070 void *holder = bdev_file->private_data; in bdev_release()
1088 bdev_yield_write_access(bdev_file); in bdev_release()
1091 bd_yield_claim(bdev_file); in bdev_release()
1119 void bdev_fput(struct file *bdev_file) in bdev_fput() argument
1121 if (WARN_ON_ONCE(bdev_file->f_op != &def_blk_fops)) in bdev_fput()
1124 if (bdev_file->private_data) { in bdev_fput()
1125 struct block_device *bdev = file_bdev(bdev_file); in bdev_fput()
1129 bdev_yield_write_access(bdev_file); in bdev_fput()
1130 bd_yield_claim(bdev_file); in bdev_fput()
1136 bdev_file->private_data = BDEV_I(bdev_file->f_mapping->host); in bdev_fput()
1140 fput(bdev_file); in bdev_fput()