fsblock latest rollup
Subsystems (9)
RFC PATCH 1/1 fsblock latest rollup
Hi,
Here is my next iteration of fsblock. This has been sitting around for a while, but I just spent a bit of time last week to convert it to a private linear metadata inode, which worked out so well that I spent a bit more to write this and submit it.
I don't expect it to be reviewed thoroughly at this point. I need to submit broken up patches. Part of the problem is that I discover races or insufficiencies in other code as I'm going. Have to spend time breaking those bits out. Mainly just introducing the idea of merging this code at some point.
Since last time (ages ago):
- Added support code for creating a private inode for metadata rather than using blockdev buffercache. This means fsblock no longer uses a page flag or really touches any other code at all (OK, I actually do add a page flag just for debugging, and I do touch generic code to add a couple of hooks and close some races in the VM, and move some things out of buffer.c where they don't belong).
- Added an "intermediate" mode, which adds a lowmem ->data pointer to fsblocks and makes filesystem conversions more trivial (although they don't support big blocks or highmem buffercache). Also, makes the structure significantly bigger.
- Found 8 more bytes to make sizeof(struct fsblock) == 32, so now less than 1/3 the size of a bh. (intermediate mode makes metadata fsblocks 40 bytes).
- Closed all known races in fsblock refcounting, and synchronising of buffer and page state. This means no memory allocation on writeout path (provided the filesystem DTRT WRT delayed allocation and logging etc).
- Ported xfs over, although it's not included here because it was never 100% stable. But it required me to add necessary support code for delayed and unwritten allocation.
- Added an allocation extent cache helper library (fsb-extent) that can sit between fsblock and the filesystem. It caches the layout of block allocation in efficient extent based structures, which can be useful if the filesystem does not keep that information efficiently. Probably needs a shrinker callback.
- Ported ext2 to intermediate mode, and fsb-extent.
- There are one or two places that will go bug with smaller block size than page size, but that's because fsblock cares a lot more about consistency than does buffer.c.
- Higher order blocks haven't been tested for a while. They were never completely bug free, because there needs to be a little bit more work done to pagecache layer eg. in the pagecache->fs callbacks.
- Text is smaller than buffer.o when higher order block support compiled out:
text data bss dec hex filename
16929 224 0 17153 4301 fs/fsblock.o 20740 96 28 20864 5180 fs/buffer.o
- fsblock is faster and more scalable than buffer_head. There is less locking. There is no private_lock (unless modifying associated metadata list), and no tree_lock in the lookup paths, and so no need for per-cpu lookup LRUs like buffer.c. Each memory access to an fsblock will cost 1 cacheline. For multi block pages, several blocks can be touched per cacheline. There tend to be fewer atomic operations for a given operation.
dbench to ext2 on ramdisk (10 runs each)
procs tput (stddev) vanilla, fsblock
1 392.40 (2.15), 392.40 (2.98) 2 912.91 (7.10), 920.90 (6.27) 4 1703.26 (17.83), 1706.25 (16.66) 8 2854.87 (27.08), 2894.95 (20.46)
OK, dbench isn't the best measurement, it isn't too heavy on the buffer layer and is not too stable... but every one of the averages was faster with fsblock. At least we can say it is comparable -- not obviously slower.
Given that this is obviously better in every way than buffer-heads, is now unintrusive due to private metadata inode, and is now easy to convert over filesystems due to the intermediate mode, I'm planning to submit fsblock to be merged eventually after I have found enough time to get it into shape. Probably will merge it with the super-block page code stripped out, and then attempt to submit that at some stage. With the intermediate mode, it is now feasible to convert all filesystems that now use buffer heads to fsblock.
This would not prevent subsequent addition of some type of extent state library like Chris has, but fsblock is more of an evolutionary change to buffer heads.
---
include/linux/page-flags.h +21 -2
@@ -82,6 +82,7 @@ enum pageflags { PG_arch_1, PG_reserved, PG_private,/* If pagecache, has fs-private data */ + PG_blocks, PG_writeback,/* Page is under writeback */ #ifdef CONFIG_PAGEFLAGS_EXTENDED PG_head, /* A head page */
@@ -183,7 +184,8 @@ struct page; /* forward declaration */ TESTPAGEFLAG(Locked, locked) PAGEFLAG(Error, error) PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) -PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) +//TESTPAGEFLAG(Dirty, dirty) SETPAGEFLAG(Dirty, dirty) TESTSETFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) +TESTPAGEFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)TESTCLEARFLAG (Active, active)
@@ -194,6 +196,7 @@ PAGEFLAG(SavePinned, savepinned); /* X PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) __SETPAGEFLAG(Private, private) +PAGEFLAG(Blocks, blocks) PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)__PAGEFLAG (SlobPage, slob_page)
@@ -256,6 +259,22 @@ PAGEFLAG(Uncached, uncached) PAGEFLAG_FALSE(Uncached)#endif +#define ClearPageDirty (page) \ +do { \ + VM_BUG_ON(!PageLocked(page)); \ + clear_bit(PG_dirty, &(page)->flags); \ +} while (0) + +#define SetPageDirty (page) \ +do { \ + set_bit(PG_dirty, &(page)->flags); \ +} while (0) + +#define TestSetPageDirty (page) \ +({ \ + test_and_set_bit(PG_dirty, &(page)->flags); \ +}) +static inline int PageUptodate (struct page *page) {int ret =test_bit (PG_uptodate, &(page)->flags);
@@ -381,7 +400,7 @@ static inline void __ClearPageTail(struc (1 << PG_lru |1 << PG_private |1 << PG_locked | \1 << PG_buddy |1 << PG_writeback |1 << PG_reserved | \1 << PG_slab |1 << PG_swapcache |1 << PG_active | \ - __PG_UNEVICTABLE | __PG_MLOCKED) +1 << PG_blocks | __PG_UNEVICTABLE | __PG_MLOCKED)/* * Flags checked when a page is prepped for return by the page allocator.
fs/Makefile +3 -1
@@ -14,11 +14,13 @@ obj-y := open.o read_write.o file_table. stack.o ifeq ($(CONFIG_BLOCK),y) -obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o +obj-y += fsblock.o buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o else obj-y += no-block.o endif +#obj-$(CONFIG_EXTMAP) += fsb_extentmap.o +obj-y += fsb_extentmap.o obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o obj-y += notify/ obj-$(CONFIG_EPOLL) += eventpoll.o
fs/fsblock.c new file +3784 -0
2,933 lines not on this page · raw message
include/linux/fsblock.h new file +597 -0
597 lines not on this page · raw message
include/linux/fsblock_types.h new file +88 -0
88 lines not on this page · raw message
fs/buffer.c +20 -163
183 lines not on this page · raw message
mm/truncate.c +70 -61
131 lines not on this page · raw message
mm/page-writeback.c +38 -17
55 lines not on this page · raw message
fs/block_dev.c +167 -13
180 lines not on this page · raw message
fs/ext2/balloc.c +93 -80
173 lines not on this page · raw message
fs/ext2/ialloc.c +44 -37
81 lines not on this page · raw message
fs/ext2/inode.c +188 -160
348 lines not on this page · raw message
fs/ext2/super.c +45 -118
163 lines not on this page · raw message
fs/ext2/xattr.c +72 -72
144 lines not on this page · raw message
include/linux/fsb_extentmap.h new file +46 -0
46 lines not on this page · raw message
fs/fsb_extentmap.c new file +439 -0
439 lines not on this page · raw message
mm/memory.c +26 -23
49 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Part of the diff is not shown here. View the raw message.