From: Eric Biggers <ebiggers@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org
Subject: Re: [PATCH] block: change the hash used for looking up block devices
Date: Mon, 28 Sep 2020 15:21:16 -0700 [thread overview]
Message-ID: <20200928222116.GG1340@sol.localdomain> (raw)
In-Reply-To: <20200927071115.372289-1-hch@lst.de>
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
next prev parent reply other threads:[~2020-09-28 23:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2020-09-29 6:37 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200928222116.GG1340@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).