From: Joel Becker <Joel.Becker@oracle.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: Greg KH <greg@kroah.com>, LKML <linux-kernel@vger.kernel.org>,
Linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
"Linux-iSCSI.org Target Dev"
<linux-iscsi-target-dev@googlegroups.com>,
SCST-Devel <scst-devel@lists.sourceforge.net>,
Alan Stern <stern@rowland.harvard.edu>,
Andrew Morton <akpm@osdl.org>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] [ConfigFS]: Allow symbolic links from a SysFS struct kobject source.
Date: Fri, 17 Oct 2008 12:48:57 -0700 [thread overview]
Message-ID: <20081017194857.GD5633@mail.oracle.com> (raw)
In-Reply-To: <1224231739.5556.303.camel@haakon2.linux-iscsi.org>
On Fri, Oct 17, 2008 at 01:22:18AM -0700, Nicholas A. Bellinger wrote:
> On Fri, 2008-10-17 at 00:44 -0700, Greg KH wrote:
> > What is the problem you are attempting to solve here?
> >
>
> So, the generic target_core_mod engine that lives
> under /sys/kernel/config/target/core needs a method to locate struct
> block_device and struct scsi_device for access via bio_submit() and
> scsi_execute_() respectively.
>
> Originally, target_core_mod used key echoed through configfs attributes
> like so:
>
> export TARGET=/sys/kernel/config/target/core/
>
> # Create $STORAGE_OBJECT of type Linux/BLOCK in generic target_core_mod
> mkdir -p $TARGET/iblock_0/lvm_test0
> # OLD METHOD to reference struct block_device
> echo iblock_major=254,iblock_minor=2 > $TARGET/iblock_0/lvm_test0/control
> echo 1 > $TARGET/iblock_0/lvm_test0/enable
> # NEW METHOD using sysfs ->configfs symlinks to reference struct block_device
> ln -s /sys/block/dm-2 $TARGET/iblock_0/lvm_test0/dm-2
Pass an open file descriptor. In bash(1):
exec 3<>/dev/dm-7
echo 3 >$TARGET/iblock_0/lvm_test0/control # I'd call it 'fd'
In kernel, in the ->store() function of 'control':
p = (char *)page;
fd = simple_strtol(p, &p, 0);
filp = fget(fd);
inode = igrab(filp->f_mapping->host);
dev = I_BDEV(filp->f_mapping->host);
blkdev_get(dev, FMODE_WRITE | FMODE_READ, 0);
Error handling is left up to you (validate the strtol, fd range, ISBLK,
etc). This assumes you want the struct block_device and want to pin it
in memory. I assume you do.
Joel
--
Life's Little Instruction Book #450
"Don't be afraid to say, 'I need help.'"
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
next prev parent reply other threads:[~2008-10-17 19:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-17 6:55 [PATCH] [ConfigFS]: Allow symbolic links from a SysFS struct kobject source Nicholas A. Bellinger
2008-10-17 7:44 ` Greg KH
2008-10-17 8:22 ` Nicholas A. Bellinger
2008-10-17 11:32 ` Matthew Wilcox
2008-10-17 19:02 ` Nicholas A. Bellinger
2008-10-17 17:39 ` Greg KH
2008-10-17 19:19 ` Nicholas A. Bellinger
2008-10-17 20:10 ` Greg KH
2008-10-18 2:41 ` Nicholas A. Bellinger
2008-10-17 19:48 ` Joel Becker [this message]
2008-10-17 20:03 ` Nicholas A. Bellinger
2008-10-17 20:07 ` Nicholas A. Bellinger
2008-10-17 19:39 ` Joel Becker
2008-10-17 19:50 ` 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=20081017194857.GD5633@mail.oracle.com \
--to=joel.becker@oracle.com \
--cc=akpm@osdl.org \
--cc=greg@kroah.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-iscsi-target-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=scst-devel@lists.sourceforge.net \
--cc=stern@rowland.harvard.edu \
/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).