exofs: Override read-ahead to align on stripe_size
* Set all inode->i_mapping->backing_dev_info to point to the per super-block sb->s_bdi. * Calculating a read_ahead that is: - preferable 2 stripes long (Future patch will add a mount option to override this) - Minimum 128K aligned up to stripe-size - Caped to maximum-IO-sizes round down to stripe_size. (Max sizes are governed by max bio-size that fits in a page times number-of-devices) CC: Marc Dionne <marc.c.dionne@gmail.com> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
This commit is contained in:
parent
97178b7b6c
commit
66cd6cad49
@ -256,6 +256,8 @@ static inline int exofs_oi_read(struct exofs_i_info *oi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* inode.c */
|
/* inode.c */
|
||||||
|
unsigned exofs_max_io_pages(struct exofs_layout *layout,
|
||||||
|
unsigned expected_pages);
|
||||||
int exofs_setattr(struct dentry *, struct iattr *);
|
int exofs_setattr(struct dentry *, struct iattr *);
|
||||||
int exofs_write_begin(struct file *file, struct address_space *mapping,
|
int exofs_write_begin(struct file *file, struct address_space *mapping,
|
||||||
loff_t pos, unsigned len, unsigned flags,
|
loff_t pos, unsigned len, unsigned flags,
|
||||||
|
@ -43,6 +43,17 @@ enum { BIO_MAX_PAGES_KMALLOC =
|
|||||||
PAGE_SIZE / sizeof(struct page *),
|
PAGE_SIZE / sizeof(struct page *),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unsigned exofs_max_io_pages(struct exofs_layout *layout,
|
||||||
|
unsigned expected_pages)
|
||||||
|
{
|
||||||
|
unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC);
|
||||||
|
|
||||||
|
/* TODO: easily support bio chaining */
|
||||||
|
pages = min_t(unsigned, pages,
|
||||||
|
layout->group_width * BIO_MAX_PAGES_KMALLOC);
|
||||||
|
return pages;
|
||||||
|
}
|
||||||
|
|
||||||
struct page_collect {
|
struct page_collect {
|
||||||
struct exofs_sb_info *sbi;
|
struct exofs_sb_info *sbi;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
@ -97,8 +108,7 @@ static void _pcol_reset(struct page_collect *pcol)
|
|||||||
|
|
||||||
static int pcol_try_alloc(struct page_collect *pcol)
|
static int pcol_try_alloc(struct page_collect *pcol)
|
||||||
{
|
{
|
||||||
unsigned pages = min_t(unsigned, pcol->expected_pages,
|
unsigned pages;
|
||||||
MAX_PAGES_KMALLOC);
|
|
||||||
|
|
||||||
if (!pcol->ios) { /* First time allocate io_state */
|
if (!pcol->ios) { /* First time allocate io_state */
|
||||||
int ret = exofs_get_io_state(&pcol->sbi->layout, &pcol->ios);
|
int ret = exofs_get_io_state(&pcol->sbi->layout, &pcol->ios);
|
||||||
@ -108,8 +118,7 @@ static int pcol_try_alloc(struct page_collect *pcol)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: easily support bio chaining */
|
/* TODO: easily support bio chaining */
|
||||||
pages = min_t(unsigned, pages,
|
pages = exofs_max_io_pages(&pcol->sbi->layout, pcol->expected_pages);
|
||||||
pcol->sbi->layout.group_width * BIO_MAX_PAGES_KMALLOC);
|
|
||||||
|
|
||||||
for (; pages; pages >>= 1) {
|
for (; pages; pages >>= 1) {
|
||||||
pcol->pages = kmalloc(pages * sizeof(struct page *),
|
pcol->pages = kmalloc(pages * sizeof(struct page *),
|
||||||
@ -1049,6 +1058,7 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)
|
|||||||
memcpy(oi->i_data, fcb.i_data, sizeof(fcb.i_data));
|
memcpy(oi->i_data, fcb.i_data, sizeof(fcb.i_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inode->i_mapping->backing_dev_info = sb->s_bdi;
|
||||||
if (S_ISREG(inode->i_mode)) {
|
if (S_ISREG(inode->i_mode)) {
|
||||||
inode->i_op = &exofs_file_inode_operations;
|
inode->i_op = &exofs_file_inode_operations;
|
||||||
inode->i_fop = &exofs_file_operations;
|
inode->i_fop = &exofs_file_operations;
|
||||||
@ -1149,6 +1159,7 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
|
|||||||
|
|
||||||
sbi = sb->s_fs_info;
|
sbi = sb->s_fs_info;
|
||||||
|
|
||||||
|
inode->i_mapping->backing_dev_info = sb->s_bdi;
|
||||||
sb->s_dirt = 1;
|
sb->s_dirt = 1;
|
||||||
inode_init_owner(inode, dir, mode);
|
inode_init_owner(inode, dir, mode);
|
||||||
inode->i_ino = sbi->s_nextid++;
|
inode->i_ino = sbi->s_nextid++;
|
||||||
|
@ -390,6 +390,23 @@ static int _read_and_match_data_map(struct exofs_sb_info *sbi, unsigned numdevs,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned __ra_pages(struct exofs_layout *layout)
|
||||||
|
{
|
||||||
|
const unsigned _MIN_RA = 32; /* min 128K read-ahead */
|
||||||
|
unsigned ra_pages = layout->group_width * layout->stripe_unit /
|
||||||
|
PAGE_SIZE;
|
||||||
|
unsigned max_io_pages = exofs_max_io_pages(layout, ~0);
|
||||||
|
|
||||||
|
ra_pages *= 2; /* two stripes */
|
||||||
|
if (ra_pages < _MIN_RA)
|
||||||
|
ra_pages = roundup(_MIN_RA, ra_pages / 2);
|
||||||
|
|
||||||
|
if (ra_pages > max_io_pages)
|
||||||
|
ra_pages = max_io_pages;
|
||||||
|
|
||||||
|
return ra_pages;
|
||||||
|
}
|
||||||
|
|
||||||
/* @odi is valid only as long as @fscb_dev is valid */
|
/* @odi is valid only as long as @fscb_dev is valid */
|
||||||
static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,
|
static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,
|
||||||
struct osd_dev_info *odi)
|
struct osd_dev_info *odi)
|
||||||
@ -623,6 +640,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set up operation vectors */
|
/* set up operation vectors */
|
||||||
|
sbi->bdi.ra_pages = __ra_pages(&sbi->layout);
|
||||||
sb->s_bdi = &sbi->bdi;
|
sb->s_bdi = &sbi->bdi;
|
||||||
sb->s_fs_info = sbi;
|
sb->s_fs_info = sbi;
|
||||||
sb->s_op = &exofs_sops;
|
sb->s_op = &exofs_sops;
|
||||||
|
Loading…
Reference in New Issue
Block a user