LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Duane Griffin <duaneg@dghda.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel@vger.kernel.org,
"Eric W. Biederman" <ebiederm@xmission.com>,
Andrew Morton <akpm@linux-foundation.org>,
rob@landley.net, Jens Axboe <axboe@kernel.dk>
Subject: [patch] rd: support XIP (updated)
Date: Tue, 4 Dec 2007 14:03:26 +0100 [thread overview]
Message-ID: <20071204130326.GA19041@wotan.suse.de> (raw)
In-Reply-To: <e9e943910712040406g17ae4293u72ddb63b55549e63@mail.gmail.com>
On Tue, Dec 04, 2007 at 12:06:23PM +0000, Duane Griffin wrote:
> On 04/12/2007, Nick Piggin <npiggin@suse.de> wrote:
> > + gfp_flags = GFP_NOIO | __GFP_ZERO;
> > +#ifndef CONFIG_BLK_DEV_XIP
> > + gfp_flags |= __GFP_HIGHMEM;
> > +#endif
> > page = alloc_page(GFP_NOIO | __GFP_HIGHMEM | __GFP_ZERO);
>
> I think that should be alloc_page(gfp_flags), no?
Yes. Here is a resend. Andrew, please apply this one (has passed some
testing with ext2 XIP).
--
Support direct_access XIP method with brd.
Signed-off-by: Nick Piggin <npiggin@suse.de>
---
Index: linux-2.6/drivers/block/Kconfig
===================================================================
--- linux-2.6.orig/drivers/block/Kconfig
+++ linux-2.6/drivers/block/Kconfig
@@ -346,6 +346,16 @@ config BLK_DEV_RAM_SIZE
The default value is 4096 kilobytes. Only change this if you know
what you are doing.
+config BLK_DEV_XIP
+ bool "Support XIP filesystems on RAM block device"
+ depends on BLK_DEV_RAM
+ default n
+ help
+ Support XIP filesystems (such as ext2 with XIP support on) on
+ top of block ram device. This will slightly enlarge the kernel, and
+ will prevent RAM block device backing store memory from being
+ allocated from highmem (only a problem for highmem systems).
+
config CDROM_PKTCDVD
tristate "Packet writing on CD/DVD media"
depends on !UML
Index: linux-2.6/drivers/block/brd.c
===================================================================
--- linux-2.6.orig/drivers/block/brd.c
+++ linux-2.6/drivers/block/brd.c
@@ -89,6 +89,7 @@ static struct page *brd_insert_page(stru
{
pgoff_t idx;
struct page *page;
+ gfp_t gfp_flags;
page = brd_lookup_page(brd, sector);
if (page)
@@ -97,8 +98,17 @@ static struct page *brd_insert_page(stru
/*
* Must use NOIO because we don't want to recurse back into the
* block or filesystem layers from page reclaim.
+ *
+ * Cannot support XIP and highmem, because our ->direct_access
+ * routine for XIP must return memory that is always addressable.
+ * If XIP was reworked to use pfns and kmap throughout, this
+ * restriction might be able to be lifted.
*/
- page = alloc_page(GFP_NOIO | __GFP_HIGHMEM | __GFP_ZERO);
+ gfp_flags = GFP_NOIO | __GFP_ZERO;
+#ifndef CONFIG_BLK_DEV_XIP
+ gfp_flags |= __GFP_HIGHMEM;
+#endif
+ page = alloc_page(gfp_flags);
if (!page)
return NULL;
@@ -307,6 +317,28 @@ out:
return 0;
}
+#ifdef CONFIG_BLK_DEV_XIP
+static int brd_direct_access (struct block_device *bdev, sector_t sector,
+ unsigned long *data)
+{
+ struct brd_device *brd = bdev->bd_disk->private_data;
+ struct page *page;
+
+ if (!brd)
+ return -ENODEV;
+ if (sector & (PAGE_SECTORS-1))
+ return -EINVAL;
+ if (sector + PAGE_SECTORS > get_capacity(bdev->bd_disk))
+ return -ERANGE;
+ page = brd_insert_page(brd, sector);
+ if (!page)
+ return -ENOMEM;
+ *data = (unsigned long)page_address(page);
+
+ return 0;
+}
+#endif
+
static int brd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
@@ -342,8 +374,11 @@ static int brd_ioctl(struct inode *inode
}
static struct block_device_operations brd_fops = {
- .owner = THIS_MODULE,
- .ioctl = brd_ioctl,
+ .owner = THIS_MODULE,
+ .ioctl = brd_ioctl,
+#ifdef CONFIG_BLK_DEV_XIP
+ .direct_access = brd_direct_access,
+#endif
};
/*
next prev parent reply other threads:[~2007-12-04 13:03 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-04 4:26 [patch] rewrite rd Nick Piggin
2007-12-04 6:29 ` Andrew Morton
2007-12-04 7:01 ` Nick Piggin
2007-12-04 7:08 ` Nick Piggin
2007-12-04 7:55 ` Rob Landley
2007-12-04 9:29 ` Nick Piggin
2007-12-04 19:53 ` Rob Landley
2007-12-04 9:54 ` Christian Borntraeger
2007-12-04 10:10 ` Nick Piggin
2007-12-04 11:21 ` [patch] rd: support XIP Nick Piggin
2007-12-04 11:23 ` [patch] ext2: xip check fix Nick Piggin
2007-12-05 15:43 ` Carsten Otte
2007-12-05 23:33 ` Nick Piggin
2007-12-06 8:43 ` Carsten Otte
2007-12-06 8:52 ` Nick Piggin
2007-12-06 9:59 ` Carsten Otte
2007-12-06 10:18 ` Nick Piggin
2007-12-06 10:24 ` Carsten Otte
2007-12-06 18:11 ` Rob Landley
2007-12-07 3:22 ` Jared Hulbert
2007-12-07 4:17 ` Rob Landley
2007-12-07 4:23 ` Nick Piggin
2007-12-07 4:40 ` Jared Hulbert
2007-12-07 8:59 ` Carsten Otte
2007-12-07 9:52 ` Jared Hulbert
2007-12-04 11:26 ` [patch] rd: support XIP Andrew Morton
2007-12-04 11:35 ` Nick Piggin
2007-12-04 13:00 ` [patch] mm: fix XIP file writes Nick Piggin
2007-12-10 14:38 ` Christian Borntraeger
2007-12-12 4:03 ` Nick Piggin
2007-12-04 12:06 ` [patch] rd: support XIP Duane Griffin
2007-12-04 13:03 ` Nick Piggin [this message]
2008-01-14 16:47 ` [patch] rewrite rd Matthew Wilcox
2008-01-14 17:21 ` 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=20071204130326.GA19041@wotan.suse.de \
--to=npiggin@suse.de \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=borntraeger@de.ibm.com \
--cc=duaneg@dghda.com \
--cc=ebiederm@xmission.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob@landley.net \
--subject='Re: [patch] rd: support XIP (updated)' \
/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
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).