From: "Jörn Engel" <joern@lazybastard.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mtd@lists.infradead.org, akpm@osdl.org,
Sam Ravnborg <sam@ravnborg.org>, John Stoffel <john@stoffel.org>,
David Woodhouse <dwmw2@infradead.org>,
Jamie Lokier <jamie@shareable.org>,
Artem Bityutskiy <dedekind@infradead.org>, CaT <cat@zip.com.au>,
Jan Engelhardt <jengelh@linux01.gwdg.de>,
Evgeniy Polyakov <johnpol@2ka.mipt.ru>,
David Weinehall <tao@acc.umu.se>, Willy Tarreau <w@1wt.eu>,
Kyle Moffett <mrmacman_g4@mac.com>,
Dongjun Shin <djshin90@gmail.com>, Pavel Machek <pavel@ucw.cz>,
Bill Davidsen <davidsen@tmr.com>,
Thomas Gleixner <tglx@linutronix.de>,
Albert Cahalan <acahalan@gmail.com>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Roland Dreier <rdreier@cisco.com>,
Ondrej Zajicek <santiago@crfreenet.org>,
Ulisses Furquim <ulissesf@gmail.com>
Subject: Re: [Patch 15/18] fs/logfs/super.c
Date: Sun, 10 Jun 2007 19:38:29 +0200 [thread overview]
Message-ID: <20070610173828.GA32619@lazybastard.org> (raw)
In-Reply-To: <200706101827.50948.arnd@arndb.de>
On Sun, 10 June 2007 18:27:49 +0200, Arnd Bergmann wrote:
> On Sunday 03 June 2007, Jörn Engel wrote:
> > +static int mtdwrite(struct super_block *sb, loff_t ofs, size_t len, void *buf)
> > +{
> > + struct logfs_super *super = logfs_super(sb);
> > + struct mtd_info *mtd = super->s_mtd;
> > + struct inode *inode = super->s_dev_inode;
> > + size_t retlen;
> > + loff_t page_start, page_end;
> > + int ret;
> > +
> > + if (super->s_flags & LOGFS_SB_FLAG_RO)
> > + return -EROFS;
> > +
> > + BUG_ON((ofs >= mtd->size) || (len > mtd->size - ofs));
> > + BUG_ON(ofs != (ofs >> super->s_writeshift) << super->s_writeshift);
> > + BUG_ON(len > PAGE_CACHE_SIZE);
> > + page_start = ofs & PAGE_CACHE_MASK;
> > + page_end = PAGE_CACHE_ALIGN(ofs + len) - 1;
> > + truncate_inode_pages_range(&inode->i_data, page_start, page_end);
> > + ret = mtd->write(mtd, ofs, len, &retlen, buf);
> > + if (ret || (retlen != len))
> > + return -EIO;
> > +
> > + return 0;
> > +}
>
> It seems that these functions are completely synchronous and afaics, the
> writes are called in the pdflush context, effectively blocking out operations
> on other file systems at the time. Not sure if this is something that
> should be fixed, but it seems to limit scalability on mtd backends.
>
> It seems that jffs2 has the same behaviour.
Most flash chips are synchronous. Some support erase suspend - an erase
operation can be indefinitely suspended to give faster read and write
operations priority. That's about it.
For the foreseeable future I believe synchronous operations are the
correct way to deal with raw flash chips.
> > +static int bdwrite(struct super_block *sb, loff_t to, size_t len, void *buf)
> > +{
> > + struct block_device *bdev = logfs_super(sb)->s_bdev;
> > + struct address_space *mapping = bdev->bd_inode->i_mapping;
> > + struct page *page;
> > + long index = to >> PAGE_SHIFT;
> > + long offset = to & (PAGE_SIZE-1);
> > + long copylen;
> > +
> > + while (len) {
> > + copylen = min((ulong)len, PAGE_SIZE - offset);
> > +
> > + page = read_cache_page(mapping, index,
> > + (filler_t*)mapping->a_ops->readpage, NULL);
> > + if (!page)
> > + return -ENOMEM;
> > + if (IS_ERR(page))
> > + return PTR_ERR(page);
> > + lock_page(page);
> > + memcpy(page_address(page) + offset, buf, copylen);
> > + set_page_dirty(page);
> > + unlock_page(page);
> > + page_cache_release(page);
> > +
> > + buf += copylen;
> > + len -= copylen;
> > + offset = 0;
> > + index++;
> > + }
> > + return 0;
> > +}
>
> How about using submit_bio here instead of going to the page cache?
> That would avoid doubling all the memory consumption here.
That may make sense, yes. "May", because there is no simple mapping
between physical data and logical data. In ext3, everything is
block-aligned, usually to 4KiB == PAGE_SIZE. So the exact same content
would exists in two pages. In LogFS, data is compressed and
byte-aligned. A bdev page can contain several full objects that after
uncompression get stored in one page each.
> > +/*
> > + * logfs_crash_dump - dump debug information to device
> > + *
> > + * The LogFS superblock only occupies part of a segment. This function will
> > + * write as much debug information as it can gather into the spare space.
> > + */
> > +void logfs_crash_dump(struct super_block *sb)
> > +{
> > + struct logfs_super *super = logfs_super(sb);
> > + int i, blockno = 2, bs = sb->s_blocksize;
> > + void *scratch = super->s_wblock[0];
> > + void *stack = (void *) ((ulong)current & ~0x1fffUL);
> > +
> > + /* all wbufs */
> > + for (i=0; i<LOGFS_NO_AREAS; i++) {
> > + void *wbuf = super->s_area[i]->a_wbuf;
> > + u64 ofs = sb->s_blocksize + i*super->s_writesize;
> > + mtdwrite(sb, ofs, super->s_writesize, wbuf);
> > + }
>
> shouldn't this use the ->write() function instead of hardcoding mtdwrite.
It should and I've already fixed it since sending the patches.
> > +module_init(logfs_init);
> > +module_exit(logfs_exit);
>
> You are missing at least a MODULE_LICENSE and should probably
> add the MODULE_AUTHOR and MODULE_DESCRIPTION tags as well.
> Right now, it's impossible to even load the module, because
> it uses a few GPL-only symbols.
Indeed. Will do.
Jörn
--
A defeated army first battles and then seeks victory.
-- Sun Tzu
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2007-06-10 17:43 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-03 18:38 LogFS take four Jörn Engel
2007-06-03 18:40 ` [Patch 01/18] fs/Kconfig Jörn Engel
2007-06-03 18:40 ` [Patch 02/18] fs/Makefile Jörn Engel
2007-06-03 18:41 ` [Patch 03/18] fs/logfs/Makefile Jörn Engel
2007-06-03 18:42 ` [Patch 04/18] include/linux/logfs.h Jörn Engel
2007-06-03 21:42 ` Arnd Bergmann
2007-06-04 9:12 ` Jörn Engel
2007-06-04 13:38 ` David Woodhouse
2007-06-04 14:02 ` Jörn Engel
2007-06-05 15:49 ` Segher Boessenkool
2007-06-05 15:53 ` David Woodhouse
2007-06-05 18:49 ` Segher Boessenkool
2007-06-06 8:50 ` David Woodhouse
2007-06-06 8:59 ` Andreas Schwab
2007-06-06 12:42 ` Arnd Bergmann
2007-06-05 20:39 ` Bill Davidsen
2007-06-03 18:43 ` [Patch 05/18] fs/logfs/logfs.h Jörn Engel
2007-06-03 21:50 ` Arnd Bergmann
2007-06-04 8:17 ` Jan Engelhardt
2007-06-04 9:11 ` Jörn Engel
2007-06-06 11:29 ` Paulo Marques
2007-06-06 11:29 ` Jörn Engel
2007-06-03 18:43 ` [Patch 06/18] fs/logfs/compr.c Jörn Engel
2007-06-03 21:58 ` Arnd Bergmann
2007-06-04 8:54 ` Jörn Engel
2007-06-04 13:53 ` David Woodhouse
2007-06-03 18:44 ` [Patch 07/18] fs/logfs/dir.c Jörn Engel
2007-06-15 8:59 ` Evgeniy Polyakov
2007-06-15 11:57 ` Jörn Engel
2007-06-03 18:45 ` [Patch 08/18] fs/logfs/file.c Jörn Engel
2007-06-03 18:46 ` [Patch 09/18] fs/logfs/gc.c Jörn Engel
2007-06-03 22:07 ` Arnd Bergmann
2007-06-04 9:01 ` Jörn Engel
2007-06-15 9:03 ` Evgeniy Polyakov
2007-06-15 11:14 ` Jörn Engel
2007-06-15 13:03 ` Evgeniy Polyakov
2007-06-03 18:46 ` [Patch 10/18] fs/logfs/inode.c Jörn Engel
2007-06-10 17:24 ` Arnd Bergmann
2007-06-10 17:40 ` Jörn Engel
2007-06-11 23:28 ` Jörn Engel
2007-06-11 23:51 ` Arnd Bergmann
2007-06-11 23:57 ` Jörn Engel
2007-06-03 18:47 ` [Patch 11/18] fs/logfs/journal.c Jörn Engel
2007-06-03 18:47 ` [Patch 12/18] fs/logfs/memtree.c Jörn Engel
2007-06-03 18:48 ` [Patch 13/18] fs/logfs/readwrite.c Jörn Engel
2007-06-03 18:48 ` [Patch 14/18] fs/logfs/segment.c Jörn Engel
2007-06-03 22:21 ` Arnd Bergmann
2007-06-04 9:07 ` Jörn Engel
2007-06-03 18:49 ` [Patch 15/18] fs/logfs/super.c Jörn Engel
2007-06-10 16:27 ` Arnd Bergmann
2007-06-10 17:38 ` Jörn Engel [this message]
2007-06-10 18:33 ` Arnd Bergmann
2007-06-10 19:10 ` Jörn Engel
2007-06-10 19:20 ` Willy Tarreau
2007-06-03 18:50 ` [Patch 16/18] fs/logfs/progs/fsck.c Jörn Engel
2007-06-03 18:50 ` [Patch 17/18] fs/logfs/progs/mkfs.c Jörn Engel
2007-06-03 18:51 ` [Patch 18/18] fs/logfs/Locking Jörn Engel
2007-06-03 19:17 ` LogFS take four Jan-Benedict Glaw
2007-06-03 19:19 ` Jörn Engel
2007-06-03 22:18 ` Arnd Bergmann
2007-06-04 9:05 ` Jörn Engel
2007-06-15 8:37 ` Evgeniy Polyakov
2007-06-15 11:10 ` Jörn Engel
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=20070610173828.GA32619@lazybastard.org \
--to=joern@lazybastard.org \
--cc=acahalan@gmail.com \
--cc=akpm@osdl.org \
--cc=arnd@arndb.de \
--cc=cat@zip.com.au \
--cc=davidsen@tmr.com \
--cc=dedekind@infradead.org \
--cc=djshin90@gmail.com \
--cc=dwmw2@infradead.org \
--cc=jamie@shareable.org \
--cc=jengelh@linux01.gwdg.de \
--cc=john@stoffel.org \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mrmacman_g4@mac.com \
--cc=pavel@ucw.cz \
--cc=penberg@cs.helsinki.fi \
--cc=rdreier@cisco.com \
--cc=sam@ravnborg.org \
--cc=santiago@crfreenet.org \
--cc=tao@acc.umu.se \
--cc=tglx@linutronix.de \
--cc=ulissesf@gmail.com \
--cc=w@1wt.eu \
/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).