Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 322103
b: refs/heads/master
c: 7de6e28
h: refs/heads/master
i:
  322101: cc8c860
  322099: 4a0edfb
  322095: 53181c3
v: v3
  • Loading branch information
Boaz Harrosh authored and Trond Myklebust committed Aug 2, 2012
1 parent 53c58d6 commit 41948f1
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f6166384095b7ecf77752b5e9096e6d03d75f7ae
refs/heads/master: 7de6e28417c65919cf2c1621841a650c4a3afbbd
55 changes: 52 additions & 3 deletions trunk/fs/nfs/objlayout/objio_osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,17 +570,66 @@ static bool objio_pg_test(struct nfs_pageio_descriptor *pgio,
return false;

return pgio->pg_count + req->wb_bytes <=
OBJIO_LSEG(pgio->pg_lseg)->layout.max_io_length;
(unsigned long)pgio->pg_layout_private;
}

void objio_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
{
pnfs_generic_pg_init_read(pgio, req);
if (unlikely(pgio->pg_lseg == NULL))
return; /* Not pNFS */

pgio->pg_layout_private = (void *)
OBJIO_LSEG(pgio->pg_lseg)->layout.max_io_length;
}

static bool aligned_on_raid_stripe(u64 offset, struct ore_layout *layout,
unsigned long *stripe_end)
{
u32 stripe_off;
unsigned stripe_size;

if (layout->raid_algorithm == PNFS_OSD_RAID_0)
return true;

stripe_size = layout->stripe_unit *
(layout->group_width - layout->parity);

div_u64_rem(offset, stripe_size, &stripe_off);
if (!stripe_off)
return true;

*stripe_end = stripe_size - stripe_off;
return false;
}

void objio_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
{
unsigned long stripe_end = 0;

pnfs_generic_pg_init_write(pgio, req);
if (unlikely(pgio->pg_lseg == NULL))
return; /* Not pNFS */

if (req->wb_offset ||
!aligned_on_raid_stripe(req->wb_index * PAGE_SIZE,
&OBJIO_LSEG(pgio->pg_lseg)->layout,
&stripe_end)) {
pgio->pg_layout_private = (void *)stripe_end;
} else {
pgio->pg_layout_private = (void *)
OBJIO_LSEG(pgio->pg_lseg)->layout.max_io_length;
}
}

static const struct nfs_pageio_ops objio_pg_read_ops = {
.pg_init = pnfs_generic_pg_init_read,
.pg_init = objio_init_read,
.pg_test = objio_pg_test,
.pg_doio = pnfs_generic_pg_readpages,
};

static const struct nfs_pageio_ops objio_pg_write_ops = {
.pg_init = pnfs_generic_pg_init_write,
.pg_init = objio_init_write,
.pg_test = objio_pg_test,
.pg_doio = pnfs_generic_pg_writepages,
};
Expand Down

0 comments on commit 41948f1

Please sign in to comment.