From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Mike Christie <michaelc@cs.wisc.edu>,
Hannes Reinecke <hare@suse.de>,
James Bottomley <James.Bottomley@suse.de>,
Boaz Harrosh <bharrosh@panasas.com>, Jens Axboe <axboe@kernel.dk>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Douglas Gilbert <dgilbert@interlog.com>,
Richard Sharpe <realrichardsharpe@gmail.com>
Subject: Re: [PATCH 4/5] tcm: Unify UNMAP and WRITE_SAME w/ UNMAP=1 subsystem plugin handling
Date: Wed, 13 Oct 2010 13:56:08 -0700 [thread overview]
Message-ID: <1287003368.7334.64.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <20101013111920.GB26366@lst.de>
On Wed, 2010-10-13 at 13:19 +0200, Christoph Hellwig wrote:
> > +static int iblock_do_discard(struct se_task *task, enum blk_discard_type type)
> > +{
> > + struct iblock_dev *ibd = task->se_dev->dev_ptr;
> > + struct block_device *bd = ibd->ibd_bd;
> > + struct se_cmd *cmd = TASK_CMD(task);
> > +
> > + if (type == DISCARD_UNMAP)
> > + return transport_generic_unmap(cmd, bd);
> > + else if (type == DISCARD_WRITE_SAME_UNMAP)
> > + return iblock_emulate_write_same_unmap(task);
> > + else {
> > + printk(KERN_ERR "Unsupported discard_type_t: %d\n", type);
> > + return -ENOSYS;
> > + }
> > +
> > + return -ENOSYS;
> > +}
> > +
>
> I don't think the discard code is quite, nor nicely structured.
>
> The parsing of the WRITE SAME and UNMAP CDBs is something the generic
> CDB parsing code should do,
Ok, so you are thinking about a seperate transport_emulate_write_same()
and transport_emulate_unmap() called from
transport_emulate_control_cdb(), right..?
> and just give a range of lists of lba/len
> pairs to the ->discard method in the backed.
Yes, these are already available from the passed struct
se_task->task_lba and ->task_size values.
> Also your generic
> discard helpers aren't actually generic - they require a block device
> and thus should be only in iblock.c. While your hack in the file
> backend to use it if we're using a block device as backing file
> works it's rather gross. Having the file backend general enough to
> work with a block devices is fine, but adding special hacks that
> only work on block device while having a fully working bio based backed
> is a bit gross.
Yes, so the problem of trying to make this code generic (eg: outside of
TCM subsystem plugins) is that blk_issue_discard() takes struct
block_device, which means we the subsystem plugin has to locate struct
block_device inside of non generic cide.
So, then the main issue becomes FILEIO + block level discard and how to
issue an blk_issue_discard() from struct fileio in the most sane way.
If there is no sane way then I will just drop this bit, or just do the
file level 'hole punch' that you are speaking about.
> Btw, at least on XFS you can implement discard using
> hole punch operations, although that can lead to quite bad fragmentation
> in cases. Just as block-level discards can lead to quite bad
> performance - I'd suggest to not enable them by default.
>
Ok, I will disable these by default for IBLOCK and FILEIO, and require
an explict override from user with the emulate_tpu and emulate_tpws
values in /sys/kernel/config/target/core/$HBA/$DEV/attrib/
> One other thing I noticed is that you use igrab a lot. In general
> drivers have absolutely no need for a igrab. If you have a reference
> to the file behind an inode you keep the inode in core and there's no
> need at all to grab a second reference to it.
The igrab() and iput() usage in FILEIO code are used for locating the
struct block_device for blk_issue_discard(). If this is the case then I
will remove these from FILEIO.
Thanks!
--nab
next prev parent reply other threads:[~2010-10-13 21:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-13 8:48 Nicholas A. Bellinger
2010-10-13 11:19 ` Christoph Hellwig
2010-10-13 20:56 ` Nicholas A. Bellinger [this message]
2010-10-14 0:03 ` Christoph Hellwig
2010-10-14 4:27 ` Nicholas A. Bellinger
2010-10-17 15:52 ` Boaz Harrosh
2010-10-17 20:53 ` Nicholas A. Bellinger
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=1287003368.7334.64.camel@haakon2.linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=James.Bottomley@suse.de \
--cc=axboe@kernel.dk \
--cc=bharrosh@panasas.com \
--cc=dgilbert@interlog.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michaelc@cs.wisc.edu \
--cc=realrichardsharpe@gmail.com \
/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
all inboxes | Powered by JetHome®