Skip to content

Commit a7d42dd

Browse files
westonandrosadamsonTom Haynes
authored andcommitted
nfs: add mirroring support to pgio layer
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 <[email protected]>
1 parent b57ff13 commit a7d42dd

File tree

9 files changed

+311
-67
lines changed

9 files changed

+311
-67
lines changed

fs/nfs/direct.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,14 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
360360
spin_lock(&dreq->lock);
361361
if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && (hdr->good_bytes == 0))
362362
dreq->error = hdr->error;
363-
else
364-
dreq->count += hdr->good_bytes;
363+
else {
364+
/*
365+
* FIXME: right now this only accounts for bytes written
366+
* to the first mirror
367+
*/
368+
if (hdr->pgio_mirror_idx == 0)
369+
dreq->count += hdr->good_bytes;
370+
}
365371
spin_unlock(&dreq->lock);
366372

367373
while (!list_empty(&hdr->pages)) {
@@ -724,7 +730,12 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
724730
dreq->error = hdr->error;
725731
}
726732
if (dreq->error == 0) {
727-
dreq->count += hdr->good_bytes;
733+
/*
734+
* FIXME: right now this only accounts for bytes written
735+
* to the first mirror
736+
*/
737+
if (hdr->pgio_mirror_idx == 0)
738+
dreq->count += hdr->good_bytes;
728739
if (nfs_write_need_commit(hdr)) {
729740
if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES)
730741
request_commit = true;

fs/nfs/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ void nfs_init_cinfo(struct nfs_commit_info *cinfo,
469469
struct nfs_direct_req *dreq);
470470
int nfs_key_timeout_notify(struct file *filp, struct inode *inode);
471471
bool nfs_ctx_key_to_expire(struct nfs_open_context *ctx);
472+
void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio);
472473

473474
#ifdef CONFIG_MIGRATION
474475
extern int nfs_migrate_page(struct address_space *,

fs/nfs/objlayout/objio_osd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,12 @@ int objio_write_pagelist(struct nfs_pgio_header *hdr, int how)
537537
static size_t objio_pg_test(struct nfs_pageio_descriptor *pgio,
538538
struct nfs_page *prev, struct nfs_page *req)
539539
{
540+
struct nfs_pgio_mirror *mirror = &pgio->pg_mirrors[pgio->pg_mirror_idx];
540541
unsigned int size;
541542

542543
size = pnfs_generic_pg_test(pgio, prev, req);
543544

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

0 commit comments

Comments
 (0)