From: Jan Schmidt <list.btrfs@jan-o-sch.net>
To: Al Viro <viro@ZenIV.linux.org.uk>, Christoph Hellwig <hch@infradead.org>
Cc: Chris Mason <chris.mason@oracle.com>,
Matthew Wilcox <matthew@wil.cx>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: [RFC] Passing stream to userspace
Date: Fri, 12 Aug 2011 17:30:32 +0200 [thread overview]
Message-ID: <4E454718.6000206@jan-o-sch.net> (raw)
Hi there,
I was promised you (viro, hch) have a decided opinion on this topic. The
original mail ("Getting a lot of fs-generated information to user
space") contains a lot of background and is way too long. Point is: I
want to get a bunch of data generated by the kernel (btrfs) to userland
(really).
Matthew Wilcox suggested to use an ioctl changing f_ops.read. Userland
would be like:
> int fd = open("/mnt/btrfs");
> ioctl(fd, BTRFS_IOC_STREAM);
> while (...) {
> read(fd, buf, 4096);
> ...
> }
> close(fd);
To avoid doing buffering myself, I suggested passing a fd to the kernel
where it is expected to dump the generated information, like:
> int fd;
> int pipefd[2];
> struct io_args io_args;
>
> fd = open("/mnt/btrfs");
> pipe(pipefd);
> io_agrs.dest = pipefd[0];
>
> /* thread 1 */
> ioctl(fd, BTRFS_IOC_STREAM, &io_args);
> /* thread 2 */
> while (...) {
> read(pipefd[1], buf, 4096);
> ...
> }
Any opinions on those or different suggestions? Thanks,
-Jan
next reply other threads:[~2011-08-12 15:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-12 15:30 Jan Schmidt [this message]
2011-08-16 2:49 ` [RFC] Passing stream to userspace Anand Jain
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=4E454718.6000206@jan-o-sch.net \
--to=list.btrfs@jan-o-sch.net \
--cc=chris.mason@oracle.com \
--cc=hch@infradead.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=viro@ZenIV.linux.org.uk \
/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.