* [PATCH] block: change the hash used for looking up block devices
@ 2020-09-27 7:11 Christoph Hellwig
2020-09-28 22:21 ` Eric Biggers
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-09-27 7:11 UTC (permalink / raw)
To: axboe; +Cc: linux-block
Adding the minor to the major creates tons of pointless conflicts. Just
use the dev_t itself, which is 32-bits and thus is guaranteed to fit
into ino_t.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/block_dev.c | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 6b9d19ffa5af7b..da7d4868057632 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -870,35 +870,12 @@ void __init bdev_cache_init(void)
blockdev_superblock = bd_mnt->mnt_sb; /* For writeback */
}
-/*
- * Most likely _very_ bad one - but then it's hardly critical for small
- * /dev and can be fixed when somebody will need really large one.
- * Keep in mind that it will be fed through icache hash function too.
- */
-static inline unsigned long hash(dev_t dev)
-{
- return MAJOR(dev)+MINOR(dev);
-}
-
-static int bdev_test(struct inode *inode, void *data)
-{
- return BDEV_I(inode)->bdev.bd_dev == *(dev_t *)data;
-}
-
-static int bdev_set(struct inode *inode, void *data)
-{
- BDEV_I(inode)->bdev.bd_dev = *(dev_t *)data;
- return 0;
-}
-
struct block_device *bdget(dev_t dev)
{
struct block_device *bdev;
struct inode *inode;
- inode = iget5_locked(blockdev_superblock, hash(dev),
- bdev_test, bdev_set, &dev);
-
+ inode = iget_locked(blockdev_superblock, dev);
if (!inode)
return NULL;
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: change the hash used for looking up block devices
2020-09-27 7:11 [PATCH] block: change the hash used for looking up block devices Christoph Hellwig
@ 2020-09-28 22:21 ` Eric Biggers
2020-09-29 6:37 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2020-09-28 22:21 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: axboe, linux-block
On Sun, Sep 27, 2020 at 09:11:15AM +0200, Christoph Hellwig wrote:
> Adding the minor to the major creates tons of pointless conflicts. Just
> use the dev_t itself, which is 32-bits and thus is guaranteed to fit
> into ino_t.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/block_dev.c | 25 +------------------------
> 1 file changed, 1 insertion(+), 24 deletions(-)
>
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 6b9d19ffa5af7b..da7d4868057632 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -870,35 +870,12 @@ void __init bdev_cache_init(void)
> blockdev_superblock = bd_mnt->mnt_sb; /* For writeback */
> }
>
> -/*
> - * Most likely _very_ bad one - but then it's hardly critical for small
> - * /dev and can be fixed when somebody will need really large one.
> - * Keep in mind that it will be fed through icache hash function too.
> - */
> -static inline unsigned long hash(dev_t dev)
> -{
> - return MAJOR(dev)+MINOR(dev);
> -}
> -
> -static int bdev_test(struct inode *inode, void *data)
> -{
> - return BDEV_I(inode)->bdev.bd_dev == *(dev_t *)data;
> -}
> -
> -static int bdev_set(struct inode *inode, void *data)
> -{
> - BDEV_I(inode)->bdev.bd_dev = *(dev_t *)data;
> - return 0;
> -}
> -
> struct block_device *bdget(dev_t dev)
> {
> struct block_device *bdev;
> struct inode *inode;
>
> - inode = iget5_locked(blockdev_superblock, hash(dev),
> - bdev_test, bdev_set, &dev);
> -
> + inode = iget_locked(blockdev_superblock, dev);
> if (!inode)
> return NULL;
Doesn't ->bd_dev still need to be set somewhere?
- Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: change the hash used for looking up block devices
2020-09-28 22:21 ` Eric Biggers
@ 2020-09-29 6:37 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-09-29 6:37 UTC (permalink / raw)
To: Eric Biggers; +Cc: Christoph Hellwig, axboe, linux-block
On Mon, Sep 28, 2020 at 03:21:16PM -0700, Eric Biggers wrote:
> Doesn't ->bd_dev still need to be set somewhere?
Yes. This was fixed in the next patch in my series which isn't
quite ready..
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-29 6:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 7:11 [PATCH] block: change the hash used for looking up block devices Christoph Hellwig
2020-09-28 22:21 ` Eric Biggers
2020-09-29 6:37 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.