Skip to content

Commit

Permalink
nfs: add mirroring support to pgio layer
Browse files Browse the repository at this point in the history
This patch adds mirrored write support to the pgio layer. The default
is to use one mirror, but pgio callers may define callbacks to change
this to any value up to the (arbitrarily selected) limit of 16.

The basic idea is to break out members of nfs_pageio_descriptor that cannot
be shared between mirrored DSes and put them in a new structure.

Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
  • Loading branch information
westonandrosadamson authored and Tom Haynes committed Feb 3, 2015
1 parent b57ff13 commit a7d42dd
Show file tree
Hide file tree
Showing 9 changed files with 311 additions and 67 deletions.
17 changes: 14 additions & 3 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,14 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
spin_lock(&dreq->lock);
if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && (hdr->good_bytes == 0))
dreq->error = hdr->error;
else
dreq->count += hdr->good_bytes;
else {
/*
* FIXME: right now this only accounts for bytes written
* to the first mirror
*/
if (hdr->pgio_mirror_idx == 0)
dreq->count += hdr->good_bytes;
}
spin_unlock(&dreq->lock);

while (!list_empty(&hdr->pages)) {
Expand Down Expand Up @@ -724,7 +730,12 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
dreq->error = hdr->error;
}
if (dreq->error == 0) {
dreq->count += hdr->good_bytes;
/*
* FIXME: right now this only accounts for bytes written
* to the first mirror
*/
if (hdr->pgio_mirror_idx == 0)
dreq->count += hdr->good_bytes;
if (nfs_write_need_commit(hdr)) {
if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES)
request_commit = true;
Expand Down
1 change: 1 addition & 0 deletions fs/nfs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ void nfs_init_cinfo(struct nfs_commit_info *cinfo,
struct nfs_direct_req *dreq);
int nfs_key_timeout_notify(struct file *filp, struct inode *inode);
bool nfs_ctx_key_to_expire(struct nfs_open_context *ctx);
void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio);

#ifdef CONFIG_MIGRATION
extern int nfs_migrate_page(struct address_space *,
Expand Down
3 changes: 2 additions & 1 deletion fs/nfs/objlayout/objio_osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,12 @@ int objio_write_pagelist(struct nfs_pgio_header *hdr, int how)
static size_t objio_pg_test(struct nfs_pageio_descriptor *pgio,
struct nfs_page *prev, struct nfs_page *req)
{
struct nfs_pgio_mirror *mirror = &pgio->pg_mirrors[pgio->pg_mirror_idx];
unsigned int size;

size = pnfs_generic_pg_test(pgio, prev, req);

if (!size || pgio->pg_count + req->wb_bytes >
if (!size || mirror->pg_count + req->wb_bytes >
(unsigned long)pgio->pg_layout_private)
return 0;

Expand Down
Loading

0 comments on commit a7d42dd

Please sign in to comment.