From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-s390@vger.kernel.org, linux-bcache@vger.kernel.org,
Coly Li <colyli@suse.de>,
linux-raid@vger.kernel.org, Song Liu <song@kernel.org>,
dm-devel@redhat.com, linux-block@vger.kernel.org,
Tejun Heo <tj@kernel.org>
Subject: Re: [dm-devel] [PATCH 3/9] block: store a block_device pointer in struct bio
Date: Thu, 3 Dec 2020 17:32:01 +0800 [thread overview]
Message-ID: <20201203093201.GC633702@T590> (raw)
In-Reply-To: <20201203082951.GA15581@lst.de>
On Thu, Dec 03, 2020 at 09:29:51AM +0100, Christoph Hellwig wrote:
> On Thu, Dec 03, 2020 at 03:10:55PM +0800, Ming Lei wrote:
> > On Thu, Dec 03, 2020 at 02:40:04PM +0800, Ming Lei wrote:
> > > On Tue, Dec 01, 2020 at 05:54:18PM +0100, Christoph Hellwig wrote:
> > > > Replace the gendisk pointer in struct bio with a pointer to the newly
> > > > improved struct block device. From that the gendisk can be trivially
> > > > accessed with an extra indirection, but it also allows to directly
> > > > look up all information related to partition remapping.
> > >
> > > The extra indirection is often done in fast path, so just wondering why
> > > you don't consider to embed gendisk into block_device? Then the extra
> > > indirection can be avoided.
> >
> > oops, that is only possible for disk, and indirection is still needed
> > for partitions.
>
> I looked into that, but given that the block device is allocated as part
> of the inode we'd need to tell ->alloc_inode if we want to allocate the
> small inode without the gendisk, or the large one with it which doesn't
> work with the current interface.
I guess it could be done without fs code change, because now block device is
always allocated by bdev_alloc() since 22ae8ce8b892("block: simplify bdev/disk
lookup in blkdev_get"). And one manual inode allocation with a bit duplication
from new_inode_pseudo() should be fine:
allocate big inode for disk, and small for partition
inode_init_always(sb, inode);
if (inode) {
spin_lock(&inode->i_lock);
inode->i_state = 0;
spin_unlock(&inode->i_lock);
INIT_LIST_HEAD(&inode->i_sb_list);
inode_sb_list_add(inode);
}
> Beause the hd_struct is gone we're
> still not using more structures in the I/O path than we did before.
Indeed, and block_device instance is often cached in IO path.
thanks,
Ming
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
WARNING: multiple messages have this Message-ID (diff)
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Tejun Heo <tj@kernel.org>,
Coly Li <colyli@suse.de>, Song Liu <song@kernel.org>,
dm-devel@redhat.com, linux-bcache@vger.kernel.org,
linux-raid@vger.kernel.org, linux-s390@vger.kernel.org,
linux-block@vger.kernel.org
Subject: Re: [PATCH 3/9] block: store a block_device pointer in struct bio
Date: Thu, 3 Dec 2020 17:32:01 +0800 [thread overview]
Message-ID: <20201203093201.GC633702@T590> (raw)
In-Reply-To: <20201203082951.GA15581@lst.de>
On Thu, Dec 03, 2020 at 09:29:51AM +0100, Christoph Hellwig wrote:
> On Thu, Dec 03, 2020 at 03:10:55PM +0800, Ming Lei wrote:
> > On Thu, Dec 03, 2020 at 02:40:04PM +0800, Ming Lei wrote:
> > > On Tue, Dec 01, 2020 at 05:54:18PM +0100, Christoph Hellwig wrote:
> > > > Replace the gendisk pointer in struct bio with a pointer to the newly
> > > > improved struct block device. From that the gendisk can be trivially
> > > > accessed with an extra indirection, but it also allows to directly
> > > > look up all information related to partition remapping.
> > >
> > > The extra indirection is often done in fast path, so just wondering why
> > > you don't consider to embed gendisk into block_device? Then the extra
> > > indirection can be avoided.
> >
> > oops, that is only possible for disk, and indirection is still needed
> > for partitions.
>
> I looked into that, but given that the block device is allocated as part
> of the inode we'd need to tell ->alloc_inode if we want to allocate the
> small inode without the gendisk, or the large one with it which doesn't
> work with the current interface.
I guess it could be done without fs code change, because now block device is
always allocated by bdev_alloc() since 22ae8ce8b892("block: simplify bdev/disk
lookup in blkdev_get"). And one manual inode allocation with a bit duplication
from new_inode_pseudo() should be fine:
allocate big inode for disk, and small for partition
inode_init_always(sb, inode);
if (inode) {
spin_lock(&inode->i_lock);
inode->i_state = 0;
spin_unlock(&inode->i_lock);
INIT_LIST_HEAD(&inode->i_sb_list);
inode_sb_list_add(inode);
}
> Beause the hd_struct is gone we're
> still not using more structures in the I/O path than we did before.
Indeed, and block_device instance is often cached in IO path.
thanks,
Ming
next prev parent reply other threads:[~2020-12-03 9:34 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 16:54 [dm-devel] store a pointer to the block_device in struct bio (again) Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-01 16:54 ` [dm-devel] [PATCH 1/9] brd: remove the end of device check in brd_do_bvec Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 22:39 ` [dm-devel] " Tejun Heo
2020-12-02 22:39 ` Tejun Heo
2020-12-01 16:54 ` [dm-devel] [PATCH 2/9] dcssblk: " Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 22:39 ` [dm-devel] " Tejun Heo
2020-12-02 22:39 ` Tejun Heo
2020-12-01 16:54 ` [dm-devel] [PATCH 3/9] block: store a block_device pointer in struct bio Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 22:54 ` [dm-devel] " Tejun Heo
2020-12-02 22:54 ` Tejun Heo
2020-12-03 6:39 ` [dm-devel] " Ming Lei
2020-12-03 6:39 ` Ming Lei
2020-12-03 7:10 ` [dm-devel] " Ming Lei
2020-12-03 7:10 ` Ming Lei
2020-12-03 8:29 ` [dm-devel] " Christoph Hellwig
2020-12-03 8:29 ` Christoph Hellwig
2020-12-03 9:32 ` Ming Lei [this message]
2020-12-03 9:32 ` Ming Lei
2020-12-03 20:53 ` [dm-devel] " Keith Busch
2020-12-03 20:53 ` Keith Busch
2020-12-01 16:54 ` [dm-devel] [PATCH 4/9] block: simplify submit_bio_checks a bit Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 22:55 ` [dm-devel] " Tejun Heo
2020-12-02 22:55 ` Tejun Heo
2020-12-01 16:54 ` [dm-devel] [PATCH 5/9] block: use ->bi_bdev for bio based I/O accounting Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 23:05 ` [dm-devel] " Tejun Heo
2020-12-02 23:05 ` Tejun Heo
2020-12-01 16:54 ` [dm-devel] [PATCH 6/9] blk-mq: use ->bi_bdev for " Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 23:06 ` [dm-devel] " Tejun Heo
2020-12-02 23:06 ` Tejun Heo
2020-12-01 16:54 ` [dm-devel] [PATCH 7/9] block: add a disk_uevent helper Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 23:08 ` [dm-devel] " Tejun Heo
2020-12-02 23:08 ` Tejun Heo
2020-12-01 16:54 ` [dm-devel] [PATCH 8/9] block: remove DISK_PITER_REVERSE Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 23:15 ` [dm-devel] " Tejun Heo
2020-12-02 23:15 ` Tejun Heo
2020-12-01 16:54 ` [dm-devel] [PATCH 9/9] block: use an xarray for disk->part_tbl Christoph Hellwig
2020-12-01 16:54 ` Christoph Hellwig
2020-12-02 23:22 ` [dm-devel] " Tejun Heo
2020-12-02 23:22 ` Tejun Heo
2020-12-02 22:35 ` [dm-devel] store a pointer to the block_device in struct bio (again) Tejun Heo
2020-12-02 22:35 ` Tejun Heo
2020-12-02 22:37 ` [dm-devel] " Tejun Heo
2020-12-02 22:37 ` Tejun Heo
2020-12-04 16:43 ` [dm-devel] " Jens Axboe
2020-12-04 16:43 ` Jens Axboe
2020-12-07 18:56 ` [dm-devel] " Qian Cai
2020-12-07 18:56 ` Qian Cai
2020-12-07 19:01 ` [dm-devel] " Christoph Hellwig
2020-12-07 19:01 ` Christoph Hellwig
2020-12-07 20:20 ` [dm-devel] " Jens Axboe
2020-12-07 20:20 ` Jens Axboe
2020-12-08 11:04 ` [dm-devel] " Christoph Hellwig
2020-12-08 11:04 ` Christoph Hellwig
2020-12-08 13:08 ` [dm-devel] " Qian Cai
2020-12-08 13:08 ` Qian Cai
2020-12-08 13:38 ` [dm-devel] " Daniel Wagner
2020-12-08 13:38 ` Daniel Wagner
2020-12-08 14:15 ` [dm-devel] " Jens Axboe
2020-12-08 14:15 ` Jens Axboe
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=20201203093201.GC633702@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=dm-devel@redhat.com \
--cc=hch@lst.de \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=song@kernel.org \
--cc=tj@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 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.