@@ -25,17 +25,17 @@ bl_free_device(struct pnfs_block_dev *dev)
25
25
} else {
26
26
if (dev -> pr_registered ) {
27
27
const struct pr_ops * ops =
28
- dev -> bdev_handle -> bdev -> bd_disk -> fops -> pr_ops ;
28
+ file_bdev ( dev -> bdev_file ) -> bd_disk -> fops -> pr_ops ;
29
29
int error ;
30
30
31
- error = ops -> pr_register (dev -> bdev_handle -> bdev ,
31
+ error = ops -> pr_register (file_bdev ( dev -> bdev_file ) ,
32
32
dev -> pr_key , 0 , false);
33
33
if (error )
34
34
pr_err ("failed to unregister PR key.\n" );
35
35
}
36
36
37
- if (dev -> bdev_handle )
38
- bdev_release (dev -> bdev_handle );
37
+ if (dev -> bdev_file )
38
+ fput (dev -> bdev_file );
39
39
}
40
40
}
41
41
@@ -169,7 +169,7 @@ static bool bl_map_simple(struct pnfs_block_dev *dev, u64 offset,
169
169
map -> start = dev -> start ;
170
170
map -> len = dev -> len ;
171
171
map -> disk_offset = dev -> disk_offset ;
172
- map -> bdev = dev -> bdev_handle -> bdev ;
172
+ map -> bdev = file_bdev ( dev -> bdev_file ) ;
173
173
return true;
174
174
}
175
175
@@ -236,26 +236,26 @@ bl_parse_simple(struct nfs_server *server, struct pnfs_block_dev *d,
236
236
struct pnfs_block_volume * volumes , int idx , gfp_t gfp_mask )
237
237
{
238
238
struct pnfs_block_volume * v = & volumes [idx ];
239
- struct bdev_handle * bdev_handle ;
239
+ struct file * bdev_file ;
240
240
dev_t dev ;
241
241
242
242
dev = bl_resolve_deviceid (server , v , gfp_mask );
243
243
if (!dev )
244
244
return - EIO ;
245
245
246
- bdev_handle = bdev_open_by_dev (dev , BLK_OPEN_READ | BLK_OPEN_WRITE ,
246
+ bdev_file = bdev_file_open_by_dev (dev , BLK_OPEN_READ | BLK_OPEN_WRITE ,
247
247
NULL , NULL );
248
- if (IS_ERR (bdev_handle )) {
248
+ if (IS_ERR (bdev_file )) {
249
249
printk (KERN_WARNING "pNFS: failed to open device %d:%d (%ld)\n" ,
250
- MAJOR (dev ), MINOR (dev ), PTR_ERR (bdev_handle ));
251
- return PTR_ERR (bdev_handle );
250
+ MAJOR (dev ), MINOR (dev ), PTR_ERR (bdev_file ));
251
+ return PTR_ERR (bdev_file );
252
252
}
253
- d -> bdev_handle = bdev_handle ;
254
- d -> len = bdev_nr_bytes (bdev_handle -> bdev );
253
+ d -> bdev_file = bdev_file ;
254
+ d -> len = bdev_nr_bytes (file_bdev ( bdev_file ) );
255
255
d -> map = bl_map_simple ;
256
256
257
257
printk (KERN_INFO "pNFS: using block device %s\n" ,
258
- bdev_handle -> bdev -> bd_disk -> disk_name );
258
+ file_bdev ( bdev_file ) -> bd_disk -> disk_name );
259
259
return 0 ;
260
260
}
261
261
@@ -300,34 +300,34 @@ bl_validate_designator(struct pnfs_block_volume *v)
300
300
}
301
301
}
302
302
303
- static struct bdev_handle *
303
+ static struct file *
304
304
bl_open_path (struct pnfs_block_volume * v , const char * prefix )
305
305
{
306
- struct bdev_handle * bdev_handle ;
306
+ struct file * bdev_file ;
307
307
const char * devname ;
308
308
309
309
devname = kasprintf (GFP_KERNEL , "/dev/disk/by-id/%s%*phN" ,
310
310
prefix , v -> scsi .designator_len , v -> scsi .designator );
311
311
if (!devname )
312
312
return ERR_PTR (- ENOMEM );
313
313
314
- bdev_handle = bdev_open_by_path (devname , BLK_OPEN_READ | BLK_OPEN_WRITE ,
314
+ bdev_file = bdev_file_open_by_path (devname , BLK_OPEN_READ | BLK_OPEN_WRITE ,
315
315
NULL , NULL );
316
- if (IS_ERR (bdev_handle )) {
316
+ if (IS_ERR (bdev_file )) {
317
317
pr_warn ("pNFS: failed to open device %s (%ld)\n" ,
318
- devname , PTR_ERR (bdev_handle ));
318
+ devname , PTR_ERR (bdev_file ));
319
319
}
320
320
321
321
kfree (devname );
322
- return bdev_handle ;
322
+ return bdev_file ;
323
323
}
324
324
325
325
static int
326
326
bl_parse_scsi (struct nfs_server * server , struct pnfs_block_dev * d ,
327
327
struct pnfs_block_volume * volumes , int idx , gfp_t gfp_mask )
328
328
{
329
329
struct pnfs_block_volume * v = & volumes [idx ];
330
- struct bdev_handle * bdev_handle ;
330
+ struct file * bdev_file ;
331
331
const struct pr_ops * ops ;
332
332
int error ;
333
333
@@ -340,43 +340,43 @@ bl_parse_scsi(struct nfs_server *server, struct pnfs_block_dev *d,
340
340
* On other distributions like Debian, the default SCSI by-id path will
341
341
* point to the dm-multipath device if one exists.
342
342
*/
343
- bdev_handle = bl_open_path (v , "dm-uuid-mpath-0x" );
344
- if (IS_ERR (bdev_handle ))
345
- bdev_handle = bl_open_path (v , "wwn-0x" );
346
- if (IS_ERR (bdev_handle ))
347
- return PTR_ERR (bdev_handle );
348
- d -> bdev_handle = bdev_handle ;
349
-
350
- d -> len = bdev_nr_bytes (d -> bdev_handle -> bdev );
343
+ bdev_file = bl_open_path (v , "dm-uuid-mpath-0x" );
344
+ if (IS_ERR (bdev_file ))
345
+ bdev_file = bl_open_path (v , "wwn-0x" );
346
+ if (IS_ERR (bdev_file ))
347
+ return PTR_ERR (bdev_file );
348
+ d -> bdev_file = bdev_file ;
349
+
350
+ d -> len = bdev_nr_bytes (file_bdev ( d -> bdev_file ) );
351
351
d -> map = bl_map_simple ;
352
352
d -> pr_key = v -> scsi .pr_key ;
353
353
354
354
if (d -> len == 0 )
355
355
return - ENODEV ;
356
356
357
357
pr_info ("pNFS: using block device %s (reservation key 0x%llx)\n" ,
358
- d -> bdev_handle -> bdev -> bd_disk -> disk_name , d -> pr_key );
358
+ file_bdev ( d -> bdev_file ) -> bd_disk -> disk_name , d -> pr_key );
359
359
360
- ops = d -> bdev_handle -> bdev -> bd_disk -> fops -> pr_ops ;
360
+ ops = file_bdev ( d -> bdev_file ) -> bd_disk -> fops -> pr_ops ;
361
361
if (!ops ) {
362
362
pr_err ("pNFS: block device %s does not support reservations." ,
363
- d -> bdev_handle -> bdev -> bd_disk -> disk_name );
363
+ file_bdev ( d -> bdev_file ) -> bd_disk -> disk_name );
364
364
error = - EINVAL ;
365
365
goto out_blkdev_put ;
366
366
}
367
367
368
- error = ops -> pr_register (d -> bdev_handle -> bdev , 0 , d -> pr_key , true);
368
+ error = ops -> pr_register (file_bdev ( d -> bdev_file ) , 0 , d -> pr_key , true);
369
369
if (error ) {
370
370
pr_err ("pNFS: failed to register key for block device %s." ,
371
- d -> bdev_handle -> bdev -> bd_disk -> disk_name );
371
+ file_bdev ( d -> bdev_file ) -> bd_disk -> disk_name );
372
372
goto out_blkdev_put ;
373
373
}
374
374
375
375
d -> pr_registered = true;
376
376
return 0 ;
377
377
378
378
out_blkdev_put :
379
- bdev_release (d -> bdev_handle );
379
+ fput (d -> bdev_file );
380
380
return error ;
381
381
}
382
382
0 commit comments