Message ID | 9f3fd310a7f4fe6282c7ad154b918e8c17b0849e.1309364964.git.sensille@gmx.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 06/29/2011 12:32 PM, Arne Jansen wrote: > Add a READAHEAD extent buffer flag. > Add a function to trigger a read with this flag set. > > Changes v2: > - use extent buffer flags instead of extent state flags > > Signed-off-by: Arne Jansen <sensille@gmx.net> > --- > fs/btrfs/disk-io.c | 32 ++++++++++++++++++++++++++++++++ > fs/btrfs/disk-io.h | 2 ++ > fs/btrfs/extent_io.h | 1 + > 3 files changed, 35 insertions(+), 0 deletions(-) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 0339cc0..0195172 100644 > --- a/fs/btrfs/disk-io.c > +++ b/fs/btrfs/disk-io.c > @@ -945,6 +945,38 @@ int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize, > return ret; > } > > +int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize, > + int mirror_num, struct extent_buffer **eb) > +{ > + struct extent_buffer *buf = NULL; > + struct inode *btree_inode = root->fs_info->btree_inode; > + struct extent_io_tree *io_tree = &BTRFS_I(btree_inode)->io_tree; > + int ret; > + > + buf = btrfs_find_create_tree_block(root, bytenr, blocksize); > + if (!buf) > + return 0; > + > + set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags); > + > + ret = read_extent_buffer_pages(io_tree, buf, 0, 0, 1, btree_get_extent, > + mirror_num); This patch doesn't compile for me, it says there are too many arguments here. [root@destiny btrfs-work]# make M=fs/btrfs CC [M] fs/btrfs/disk-io.o fs/btrfs/disk-io.c: In function ‘reada_tree_block_flagged’: fs/btrfs/disk-io.c:963:6: warning: passing argument 5 of ‘read_extent_buffer_pages’ makes pointer from integer without a cast [enabled by default] fs/btrfs/extent_io.h:244:5: note: expected ‘struct extent_map * (*)(struct inode *, struct page *, size_t, u64, u64, int)’ but argument is of type ‘int’ fs/btrfs/disk-io.c:963:6: warning: passing argument 6 of ‘read_extent_buffer_pages’ makes integer from pointer without a cast [enabled by default] fs/btrfs/extent_io.h:244:5: note: expected ‘int’ but argument is of type ‘struct extent_map * (*)(struct inode *, struct page *, size_t, u64, u64, int)’ fs/btrfs/disk-io.c:963:6: error: too many arguments to function ‘read_extent_buffer_pages’ fs/btrfs/extent_io.h:244:5: note: declared here make[1]: *** [fs/btrfs/disk-io.o] Error 1 make: *** [_module_fs/btrfs] Error 2 Thanks, Josef -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 29.06.2011 20:13, Josef Bacik wrote: > On 06/29/2011 12:32 PM, Arne Jansen wrote: >> Add a READAHEAD extent buffer flag. >> Add a function to trigger a read with this flag set. >> >> Changes v2: >> - use extent buffer flags instead of extent state flags >> >> Signed-off-by: Arne Jansen<sensille@gmx.net> >> --- >> fs/btrfs/disk-io.c | 32 ++++++++++++++++++++++++++++++++ >> fs/btrfs/disk-io.h | 2 ++ >> fs/btrfs/extent_io.h | 1 + >> 3 files changed, 35 insertions(+), 0 deletions(-) >> >> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c >> index 0339cc0..0195172 100644 >> --- a/fs/btrfs/disk-io.c >> +++ b/fs/btrfs/disk-io.c >> @@ -945,6 +945,38 @@ int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize, >> return ret; >> } >> >> +int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize, >> + int mirror_num, struct extent_buffer **eb) >> +{ >> + struct extent_buffer *buf = NULL; >> + struct inode *btree_inode = root->fs_info->btree_inode; >> + struct extent_io_tree *io_tree =&BTRFS_I(btree_inode)->io_tree; >> + int ret; >> + >> + buf = btrfs_find_create_tree_block(root, bytenr, blocksize); >> + if (!buf) >> + return 0; >> + >> + set_bit(EXTENT_BUFFER_READAHEAD,&buf->bflags); >> + >> + ret = read_extent_buffer_pages(io_tree, buf, 0, 0, 1, btree_get_extent, >> + mirror_num); > > This patch doesn't compile for me, it says there are too many arguments here. Ok, commit d1310b2e0cd98eb134 changed a lot here, I'll take a lot how to rebase this and send a v4. Thanks, Arne > > [root@destiny btrfs-work]# make M=fs/btrfs > CC [M] fs/btrfs/disk-io.o > fs/btrfs/disk-io.c: In function ‘reada_tree_block_flagged’: > fs/btrfs/disk-io.c:963:6: warning: passing argument 5 of ‘read_extent_buffer_pages’ makes pointer from integer without a cast [enabled by default] > fs/btrfs/extent_io.h:244:5: note: expected ‘struct extent_map * (*)(struct inode *, struct page *, size_t, u64, u64, int)’ but argument is of type ‘int’ > fs/btrfs/disk-io.c:963:6: warning: passing argument 6 of ‘read_extent_buffer_pages’ makes integer from pointer without a cast [enabled by default] > fs/btrfs/extent_io.h:244:5: note: expected ‘int’ but argument is of type ‘struct extent_map * (*)(struct inode *, struct page *, size_t, u64, u64, int)’ > fs/btrfs/disk-io.c:963:6: error: too many arguments to function ‘read_extent_buffer_pages’ > fs/btrfs/extent_io.h:244:5: note: declared here > make[1]: *** [fs/btrfs/disk-io.o] Error 1 > make: *** [_module_fs/btrfs] Error 2 > > Thanks, > > Josef -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 29.06.2011 20:24, Arne Jansen wrote: > On 29.06.2011 20:13, Josef Bacik wrote: >> On 06/29/2011 12:32 PM, Arne Jansen wrote: >>> Add a READAHEAD extent buffer flag. >>> Add a function to trigger a read with this flag set. >>> >>> Changes v2: >>> - use extent buffer flags instead of extent state flags >>> >>> Signed-off-by: Arne Jansen<sensille@gmx.net> >>> --- >>> fs/btrfs/disk-io.c | 32 ++++++++++++++++++++++++++++++++ >>> fs/btrfs/disk-io.h | 2 ++ >>> fs/btrfs/extent_io.h | 1 + >>> 3 files changed, 35 insertions(+), 0 deletions(-) >>> >>> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c >>> index 0339cc0..0195172 100644 >>> --- a/fs/btrfs/disk-io.c >>> +++ b/fs/btrfs/disk-io.c >>> @@ -945,6 +945,38 @@ int readahead_tree_block(struct btrfs_root >>> *root, u64 bytenr, u32 blocksize, >>> return ret; >>> } >>> >>> +int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, >>> u32 blocksize, >>> + int mirror_num, struct extent_buffer **eb) >>> +{ >>> + struct extent_buffer *buf = NULL; >>> + struct inode *btree_inode = root->fs_info->btree_inode; >>> + struct extent_io_tree *io_tree =&BTRFS_I(btree_inode)->io_tree; >>> + int ret; >>> + >>> + buf = btrfs_find_create_tree_block(root, bytenr, blocksize); >>> + if (!buf) >>> + return 0; >>> + >>> + set_bit(EXTENT_BUFFER_READAHEAD,&buf->bflags); >>> + >>> + ret = read_extent_buffer_pages(io_tree, buf, 0, 0, 1, >>> btree_get_extent, >>> + mirror_num); >> >> This patch doesn't compile for me, it says there are too many >> arguments here. > > Ok, commit d1310b2e0cd98eb134 changed a lot here, I'll take a lot how to > rebase this and send a v4. hm, no, that was bullshit, I just forgot to send the first patch in the series :-/ > > Thanks, > Arne > >> >> [root@destiny btrfs-work]# make M=fs/btrfs >> CC [M] fs/btrfs/disk-io.o >> fs/btrfs/disk-io.c: In function ‘reada_tree_block_flagged’: >> fs/btrfs/disk-io.c:963:6: warning: passing argument 5 of >> ‘read_extent_buffer_pages’ makes pointer from integer without a cast >> [enabled by default] >> fs/btrfs/extent_io.h:244:5: note: expected ‘struct extent_map * >> (*)(struct inode *, struct page *, size_t, u64, u64, int)’ but >> argument is of type ‘int’ >> fs/btrfs/disk-io.c:963:6: warning: passing argument 6 of >> ‘read_extent_buffer_pages’ makes integer from pointer without a cast >> [enabled by default] >> fs/btrfs/extent_io.h:244:5: note: expected ‘int’ but argument is of >> type ‘struct extent_map * (*)(struct inode *, struct page *, size_t, >> u64, u64, int)’ >> fs/btrfs/disk-io.c:963:6: error: too many arguments to function >> ‘read_extent_buffer_pages’ >> fs/btrfs/extent_io.h:244:5: note: declared here >> make[1]: *** [fs/btrfs/disk-io.o] Error 1 >> make: *** [_module_fs/btrfs] Error 2 >> >> Thanks, >> >> Josef > > -- > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 0339cc0..0195172 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -945,6 +945,38 @@ int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize, return ret; } +int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize, + int mirror_num, struct extent_buffer **eb) +{ + struct extent_buffer *buf = NULL; + struct inode *btree_inode = root->fs_info->btree_inode; + struct extent_io_tree *io_tree = &BTRFS_I(btree_inode)->io_tree; + int ret; + + buf = btrfs_find_create_tree_block(root, bytenr, blocksize); + if (!buf) + return 0; + + set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags); + + ret = read_extent_buffer_pages(io_tree, buf, 0, 0, 1, btree_get_extent, + mirror_num); + if (ret) { + free_extent_buffer(buf); + return ret; + } + + if (test_bit(EXTENT_BUFFER_CORRUPT, &buf->bflags)) { + *eb = buf; + return -EIO; + } else if (extent_buffer_uptodate(io_tree, buf, NULL)) { + *eb = buf; + } else { + free_extent_buffer(buf); + } + return 0; +} + struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize) { diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index a0b610a..fb35c4e 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h @@ -40,6 +40,8 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize, u64 parent_transid); int readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize, u64 parent_transid); +int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize, + int mirror_num, struct extent_buffer **eb); struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize); int clean_tree_block(struct btrfs_trans_handle *trans, diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 118c30b..e0a09e8 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -32,6 +32,7 @@ #define EXTENT_BUFFER_BLOCKING 1 #define EXTENT_BUFFER_DIRTY 2 #define EXTENT_BUFFER_CORRUPT 3 +#define EXTENT_BUFFER_READAHEAD 4 /* this got triggered by readahead */ /* these are flags for extent_clear_unlock_delalloc */ #define EXTENT_CLEAR_UNLOCK_PAGE 0x1
Add a READAHEAD extent buffer flag. Add a function to trigger a read with this flag set. Changes v2: - use extent buffer flags instead of extent state flags Signed-off-by: Arne Jansen <sensille@gmx.net> --- fs/btrfs/disk-io.c | 32 ++++++++++++++++++++++++++++++++ fs/btrfs/disk-io.h | 2 ++ fs/btrfs/extent_io.h | 1 + 3 files changed, 35 insertions(+), 0 deletions(-)