Skip to content

Commit

Permalink
block: remove invalidate_partition
Browse files Browse the repository at this point in the history
invalidate_partition has two callers, one of which already performs
the remove_inode_hash just after the call.  Just open code the
function in the two callsites.

Signed-off-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Apr 8, 2021
1 parent b896fa8 commit 4561183
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,18 +646,6 @@ void device_add_disk_no_queue_reg(struct device *parent, struct gendisk *disk)
}
EXPORT_SYMBOL(device_add_disk_no_queue_reg);

static void invalidate_partition(struct block_device *bdev)
{
fsync_bdev(bdev);
__invalidate_device(bdev, true);

/*
* Unhash the bdev inode for this device so that it can't be looked
* up any more even if openers still hold references to it.
*/
remove_inode_hash(bdev->bd_inode);
}

/**
* del_gendisk - remove the gendisk
* @disk: the struct gendisk to remove
Expand Down Expand Up @@ -699,12 +687,21 @@ void del_gendisk(struct gendisk *disk)
/* invalidate stuff */
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter))) {
invalidate_partition(part);
fsync_bdev(part);
__invalidate_device(part, true);
delete_partition(part);
}
disk_part_iter_exit(&piter);

invalidate_partition(disk->part0);
fsync_bdev(disk->part0);
__invalidate_device(disk->part0, true);

/*
* Unhash the bdev inode for this device so that it can't be looked
* up any more even if openers still hold references to it.
*/
remove_inode_hash(disk->part0->bd_inode);

set_capacity(disk, 0);
disk->flags &= ~GENHD_FL_UP;
up_write(&bdev_lookup_sem);
Expand Down

0 comments on commit 4561183

Please sign in to comment.