mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: Andrew Morton <akpm@zip.com.au>
Cc: Douglas Gilbert <dougg@torque.net>, linux-kernel@vger.kernel.org
Subject: Re: direct-to-BIO for O_DIRECT
Date: Tue, 9 Jul 2002 10:16:15 +0200	[thread overview]
Message-ID: <20020709101615.B14399@nightmaster.csn.tu-chemnitz.de> (raw)
In-Reply-To: <3D2A6608.7C43EE3@zip.com.au>; from akpm@zip.com.au on Mon, Jul 08, 2002 at 09:26:48PM -0700

On Mon, Jul 08, 2002 at 09:26:48PM -0700, Andrew Morton wrote:
> > > It would be nice if we could just map a set of user pages
> > > to a scatterlist.
> > 
> > After disabling kiobufs in sg I would like such a drop
> > in replacement.
> 
> Ben had lightweight sg structures called `kvecs' and `kveclets'. And
> library functions to map pages into them.  And code to attach them
> to BIOs.  So we'll be looking at getting that happening.

BIOs are for BLOCK devices we want sth. like this for CHARACTER
devices.

I just want sth. along the lines of this:

/* Pin down (COMPLETE!) user pages and put them into a scatter gather list */
int sg_map_user_pages(struct scatterlist *sgl, const unsigned int nr_pages, 
		unsigned long uaddr, int rw) {
	int res, i;
	struct page *pages[nr_pages];

	down_read(&current->mm->mmap_sem);
	res = get_user_pages(
			current,
			current->mm,
			uaddr,
			nr_pages,
			rw == READ, /* logic is perversed^Wreversed here :-( */
			0, /* don't force */
			&pages[0],
			NULL);
	up_read(&current->mm->mmap_sem);

	/* Errors and no page mapped should return here */
	if (res <= 0) return res;

	for (i=1; i < res; i++) {
		sgl[i].page = pages[i];	
	}
	return res;
}

/* And unmap them... */
int sg_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_pages) {
	int i;

	for (i=0; i < nr_pages; i++)
		page_cache_release(sgl[i].page);

	return 0;
}

Possibly more complicated and less error prone, but you get the
idea ;-)

Regards

Ingo Oeser
-- 
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth

  reply	other threads:[~2002-07-09  8:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-09  3:57 Douglas Gilbert
2002-07-09  4:26 ` Andrew Morton
2002-07-09  8:16   ` Ingo Oeser [this message]
2002-07-11 17:28   ` Ingo Oeser
2002-07-11 20:43   ` Daniel Phillips
  -- strict thread matches above, loose matches on Subject: below --
2002-07-11  6:09 Adam J. Richter
     [not found] <3D2904C5.53E38ED4@zip.com.au.suse.lists.linux.kernel>
2002-07-08  7:26 ` Andi Kleen
2002-07-08  9:19   ` Suparna Bhattacharya
2002-07-08 15:03   ` Matt D. Robinson
2002-07-08  3:19 Andrew Morton
2002-07-08  3:30 ` Lincoln Dale
2002-07-08  7:44 ` Ingo Oeser
2002-07-11  2:25 ` Lincoln Dale
2002-07-11  3:24   ` Andrew Morton
2002-07-11  3:25     ` Lincoln Dale
2002-07-11 19:52   ` Jesse Barnes
2002-07-11 23:40     ` Lincoln Dale

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=20020709101615.B14399@nightmaster.csn.tu-chemnitz.de \
    --to=ingo.oeser@informatik.tu-chemnitz.de \
    --cc=akpm@zip.com.au \
    --cc=dougg@torque.net \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®