* [PATCH] block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
@ 2010-07-30 9:39 Kay Sievers
2010-07-30 9:40 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Kay Sievers @ 2010-07-30 9:39 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
From: Kay Sievers <kay.sievers@vrfy.org>
Subject: block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
Disk code belongs into genhd, not into the partition scanner code.
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
---
block/genhd.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
fs/partitions/check.c | 51 -------------------------------------------------
2 files changed, 52 insertions(+), 51 deletions(-)
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1344,3 +1344,55 @@ int invalidate_partition(struct gendisk
}
EXPORT_SYMBOL(invalidate_partition);
+
+void del_gendisk(struct gendisk *disk)
+{
+ struct disk_part_iter piter;
+ struct hd_struct *part;
+
+ /* invalidate stuff */
+ disk_part_iter_init(&piter, disk,
+ DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE);
+ while ((part = disk_part_iter_next(&piter))) {
+ invalidate_partition(disk, part->partno);
+ delete_partition(disk, part->partno);
+ }
+ disk_part_iter_exit(&piter);
+
+ invalidate_partition(disk, 0);
+ blk_free_devt(disk_to_dev(disk)->devt);
+ set_capacity(disk, 0);
+ disk->flags &= ~GENHD_FL_UP;
+ unlink_gendisk(disk);
+ part_stat_set_all(&disk->part0, 0);
+ disk->part0.stamp = 0;
+
+ kobject_put(disk->part0.holder_dir);
+ kobject_put(disk->slave_dir);
+ disk->driverfs_dev = NULL;
+#ifndef CONFIG_SYSFS_DEPRECATED
+ sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk)));
+#endif
+ device_del(disk_to_dev(disk));
+}
+
+unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
+{
+ struct address_space *mapping = bdev->bd_inode->i_mapping;
+ struct page *page;
+
+ page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)),
+ NULL);
+ if (!IS_ERR(page)) {
+ if (PageError(page))
+ goto fail;
+ p->v = page;
+ return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9);
+fail:
+ page_cache_release(page);
+ }
+ p->v = NULL;
+ return NULL;
+}
+
+EXPORT_SYMBOL(read_dev_sector);
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -619,54 +619,3 @@ rescan:
return 0;
}
-unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
-{
- struct address_space *mapping = bdev->bd_inode->i_mapping;
- struct page *page;
-
- page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)),
- NULL);
- if (!IS_ERR(page)) {
- if (PageError(page))
- goto fail;
- p->v = page;
- return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9);
-fail:
- page_cache_release(page);
- }
- p->v = NULL;
- return NULL;
-}
-
-EXPORT_SYMBOL(read_dev_sector);
-
-void del_gendisk(struct gendisk *disk)
-{
- struct disk_part_iter piter;
- struct hd_struct *part;
-
- /* invalidate stuff */
- disk_part_iter_init(&piter, disk,
- DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE);
- while ((part = disk_part_iter_next(&piter))) {
- invalidate_partition(disk, part->partno);
- delete_partition(disk, part->partno);
- }
- disk_part_iter_exit(&piter);
-
- invalidate_partition(disk, 0);
- blk_free_devt(disk_to_dev(disk)->devt);
- set_capacity(disk, 0);
- disk->flags &= ~GENHD_FL_UP;
- unlink_gendisk(disk);
- part_stat_set_all(&disk->part0, 0);
- disk->part0.stamp = 0;
-
- kobject_put(disk->part0.holder_dir);
- kobject_put(disk->slave_dir);
- disk->driverfs_dev = NULL;
-#ifndef CONFIG_SYSFS_DEPRECATED
- sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk)));
-#endif
- device_del(disk_to_dev(disk));
-}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
2010-07-30 9:39 [PATCH] block: move del_gendisk() from fs/partitions/check.c to block/genhd.c Kay Sievers
@ 2010-07-30 9:40 ` Christoph Hellwig
2010-07-30 9:56 ` Kay Sievers
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2010-07-30 9:40 UTC (permalink / raw)
To: Kay Sievers; +Cc: Jens Axboe, linux-kernel
On Fri, Jul 30, 2010 at 11:39:01AM +0200, Kay Sievers wrote:
> From: Kay Sievers <kay.sievers@vrfy.org>
> Subject: block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
>
> Disk code belongs into genhd, not into the partition scanner code.
Sounds fine for del_gendisk, but read_dev_sector which isn't mentioned
here really is for partitioning.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
2010-07-30 9:40 ` Christoph Hellwig
@ 2010-07-30 9:56 ` Kay Sievers
2010-07-30 9:58 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Kay Sievers @ 2010-07-30 9:56 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jens Axboe, linux-kernel
On Fri, Jul 30, 2010 at 11:40, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Jul 30, 2010 at 11:39:01AM +0200, Kay Sievers wrote:
>> From: Kay Sievers <kay.sievers@vrfy.org>
>> Subject: block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
>>
>> Disk code belongs into genhd, not into the partition scanner code.
>
> Sounds fine for del_gendisk, but read_dev_sector which isn't mentioned
> here really is for partitioning.
Right, the next patch moves it to /block/partition.c, because all the
sysfs and driver core code really should not be below fs/.
If you want me to re reshuffle that, let me know. I was just annoyed
again, and after all these years I though it's time to move that stuff
around. :)
Thanks,
Kay
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
2010-07-30 9:56 ` Kay Sievers
@ 2010-07-30 9:58 ` Christoph Hellwig
2010-07-30 10:04 ` Kay Sievers
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2010-07-30 9:58 UTC (permalink / raw)
To: Kay Sievers; +Cc: Christoph Hellwig, Jens Axboe, linux-kernel
On Fri, Jul 30, 2010 at 11:56:56AM +0200, Kay Sievers wrote:
> > Sounds fine for del_gendisk, but read_dev_sector which isn't mentioned
> > here really is for partitioning.
>
> Right, the next patch moves it to /block/partition.c, because all the
> sysfs and driver core code really should not be below fs/.
>
> If you want me to re reshuffle that, let me know. I was just annoyed
> again, and after all these years I though it's time to move that stuff
> around. :)
So then please keep read_dev_sector in the file where it is right now,
and just move the whole directory from fs/partitions/ to
block/partitions. While you're at it fs/bio.c and fs/block_dev.c
really belong into block/, too. The latter could also need some split
up.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
2010-07-30 9:58 ` Christoph Hellwig
@ 2010-07-30 10:04 ` Kay Sievers
2010-07-30 10:40 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Kay Sievers @ 2010-07-30 10:04 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jens Axboe, linux-kernel
On Fri, Jul 30, 2010 at 11:58, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Jul 30, 2010 at 11:56:56AM +0200, Kay Sievers wrote:
>> > Sounds fine for del_gendisk, but read_dev_sector which isn't mentioned
>> > here really is for partitioning.
>>
>> Right, the next patch moves it to /block/partition.c, because all the
>> sysfs and driver core code really should not be below fs/.
>>
>> If you want me to re reshuffle that, let me know. I was just annoyed
>> again, and after all these years I though it's time to move that stuff
>> around. :)
>
> So then please keep read_dev_sector in the file where it is right now,
> and just move the whole directory from fs/partitions/ to
> block/partitions. While you're at it fs/bio.c and fs/block_dev.c
> really belong into block/, too. The latter could also need some split
> up.
Hehe, the usual thing: "If you want that, fix all of it." :)
Are you sure, that partition formats don't belong in fs/? It's kinda
specific on-disk-layout like a fs, and I would have no problem with
that staying in fs/.
Kay
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: move del_gendisk() from fs/partitions/check.c to block/genhd.c
2010-07-30 10:04 ` Kay Sievers
@ 2010-07-30 10:40 ` Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2010-07-30 10:40 UTC (permalink / raw)
To: Kay Sievers; +Cc: Christoph Hellwig, Jens Axboe, linux-kernel
On Fri, Jul 30, 2010 at 12:04:09PM +0200, Kay Sievers wrote:
> Are you sure, that partition formats don't belong in fs/? It's kinda
> specific on-disk-layout like a fs, and I would have no problem with
> that staying in fs/.
It's on disk formats, but it's not related to filesystems at all.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-07-30 10:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-30 9:39 [PATCH] block: move del_gendisk() from fs/partitions/check.c to block/genhd.c Kay Sievers
2010-07-30 9:40 ` Christoph Hellwig
2010-07-30 9:56 ` Kay Sievers
2010-07-30 9:58 ` Christoph Hellwig
2010-07-30 10:04 ` Kay Sievers
2010-07-30 10:40 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox