Skip to content

Commit cfb4257

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: move a few internal definitions out of blkdev.h
All these helpers are only used in core block code, so move them out of the public header. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Christian Brauner <brauner@kernel.org> Link: https://lore.kernel.org/r/20230608110258.189493-26-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent bd6abfc commit cfb4257

2 files changed

Lines changed: 21 additions & 29 deletions

File tree

block/blk.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,27 @@ static inline struct bio *blk_queue_bounce(struct bio *bio,
394394
#ifdef CONFIG_BLK_DEV_ZONED
395395
void disk_free_zone_bitmaps(struct gendisk *disk);
396396
void disk_clear_zone_settings(struct gendisk *disk);
397-
#else
397+
int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
398+
unsigned int cmd, unsigned long arg);
399+
int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode,
400+
unsigned int cmd, unsigned long arg);
401+
#else /* CONFIG_BLK_DEV_ZONED */
398402
static inline void disk_free_zone_bitmaps(struct gendisk *disk) {}
399403
static inline void disk_clear_zone_settings(struct gendisk *disk) {}
400-
#endif
404+
static inline int blkdev_report_zones_ioctl(struct block_device *bdev,
405+
fmode_t mode, unsigned int cmd, unsigned long arg)
406+
{
407+
return -ENOTTY;
408+
}
409+
static inline int blkdev_zone_mgmt_ioctl(struct block_device *bdev,
410+
fmode_t mode, unsigned int cmd, unsigned long arg)
411+
{
412+
return -ENOTTY;
413+
}
414+
#endif /* CONFIG_BLK_DEV_ZONED */
415+
416+
struct block_device *bdev_alloc(struct gendisk *disk, u8 partno);
417+
void bdev_add(struct block_device *bdev, dev_t dev);
401418

402419
int blk_alloc_ext_minor(void);
403420
void blk_free_ext_minor(unsigned int minor);
@@ -449,6 +466,8 @@ extern struct device_attribute dev_attr_events_poll_msecs;
449466

450467
extern struct attribute_group blk_trace_attr_group;
451468

469+
int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart,
470+
loff_t lend);
452471
long blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg);
453472
long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg);
454473

include/linux/blkdev.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx,
318318
void disk_set_zoned(struct gendisk *disk, enum blk_zoned_model model);
319319

320320
#ifdef CONFIG_BLK_DEV_ZONED
321-
322321
#define BLK_ALL_ZONES ((unsigned int)-1)
323322
int blkdev_report_zones(struct block_device *bdev, sector_t sector,
324323
unsigned int nr_zones, report_zones_cb cb, void *data);
@@ -328,33 +327,11 @@ extern int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op,
328327
gfp_t gfp_mask);
329328
int blk_revalidate_disk_zones(struct gendisk *disk,
330329
void (*update_driver_data)(struct gendisk *disk));
331-
332-
extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
333-
unsigned int cmd, unsigned long arg);
334-
extern int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode,
335-
unsigned int cmd, unsigned long arg);
336-
337330
#else /* CONFIG_BLK_DEV_ZONED */
338-
339331
static inline unsigned int bdev_nr_zones(struct block_device *bdev)
340332
{
341333
return 0;
342334
}
343-
344-
static inline int blkdev_report_zones_ioctl(struct block_device *bdev,
345-
fmode_t mode, unsigned int cmd,
346-
unsigned long arg)
347-
{
348-
return -ENOTTY;
349-
}
350-
351-
static inline int blkdev_zone_mgmt_ioctl(struct block_device *bdev,
352-
fmode_t mode, unsigned int cmd,
353-
unsigned long arg)
354-
{
355-
return -ENOTTY;
356-
}
357-
358335
#endif /* CONFIG_BLK_DEV_ZONED */
359336

360337
/*
@@ -1493,11 +1470,7 @@ void blkdev_put(struct block_device *bdev, void *holder);
14931470
struct block_device *blkdev_get_no_open(dev_t dev);
14941471
void blkdev_put_no_open(struct block_device *bdev);
14951472

1496-
struct block_device *bdev_alloc(struct gendisk *disk, u8 partno);
1497-
void bdev_add(struct block_device *bdev, dev_t dev);
14981473
struct block_device *I_BDEV(struct inode *inode);
1499-
int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart,
1500-
loff_t lend);
15011474

15021475
#ifdef CONFIG_BLOCK
15031476
void invalidate_bdev(struct block_device *bdev);

0 commit comments

Comments
 (0)