aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-08-10 17:44:32 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 17:18:31 -0400
commitcd3758e37ddea66fccca7d93c4b601e8a2e51926 (patch)
tree07566d3ee457524a97b534a4f214b9178b1278c8 /fs/nfs
parentc03025d55540bd648f2546659090140ecc835572 (diff)
NFS: Replace file->private_data with calls to nfs_file_open_context()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/delegation.c2
-rw-r--r--fs/nfs/dir.c4
-rw-r--r--fs/nfs/direct.c4
-rw-r--r--fs/nfs/file.c8
-rw-r--r--fs/nfs/inode.c2
-rw-r--r--fs/nfs/nfs4proc.c8
-rw-r--r--fs/nfs/nfs4state.c2
-rw-r--r--fs/nfs/read.c6
-rw-r--r--fs/nfs/write.c4
9 files changed, 19 insertions, 21 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index c55a761c22bb..7a1b6e869f9c 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -52,7 +52,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_
52 for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) { 52 for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) {
53 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) 53 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
54 continue; 54 continue;
55 if ((struct nfs_open_context *)fl->fl_file->private_data != ctx) 55 if (nfs_file_open_context(fl->fl_file) != ctx)
56 continue; 56 continue;
57 status = nfs4_lock_delegation_recall(state, fl); 57 status = nfs4_lock_delegation_recall(state, fl);
58 if (status >= 0) 58 if (status >= 0)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index dde545925b4e..b332c527d95d 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -558,7 +558,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
558 memset(desc, 0, sizeof(*desc)); 558 memset(desc, 0, sizeof(*desc));
559 559
560 desc->file = filp; 560 desc->file = filp;
561 desc->dir_cookie = &((struct nfs_open_context *)filp->private_data)->dir_cookie; 561 desc->dir_cookie = &nfs_file_open_context(filp)->dir_cookie;
562 desc->decode = NFS_PROTO(inode)->decode_dirent; 562 desc->decode = NFS_PROTO(inode)->decode_dirent;
563 desc->plus = NFS_USE_READDIRPLUS(inode); 563 desc->plus = NFS_USE_READDIRPLUS(inode);
564 564
@@ -623,7 +623,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
623 } 623 }
624 if (offset != filp->f_pos) { 624 if (offset != filp->f_pos) {
625 filp->f_pos = offset; 625 filp->f_pos = offset;
626 ((struct nfs_open_context *)filp->private_data)->dir_cookie = 0; 626 nfs_file_open_context(filp)->dir_cookie = 0;
627 } 627 }
628out: 628out:
629 mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex); 629 mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index fcf4d384610e..28c8e1b65db0 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -368,7 +368,7 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size
368 return -ENOMEM; 368 return -ENOMEM;
369 369
370 dreq->inode = inode; 370 dreq->inode = inode;
371 dreq->ctx = get_nfs_open_context((struct nfs_open_context *)iocb->ki_filp->private_data); 371 dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp));
372 if (!is_sync_kiocb(iocb)) 372 if (!is_sync_kiocb(iocb))
373 dreq->iocb = iocb; 373 dreq->iocb = iocb;
374 374
@@ -718,7 +718,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
718 sync = FLUSH_STABLE; 718 sync = FLUSH_STABLE;
719 719
720 dreq->inode = inode; 720 dreq->inode = inode;
721 dreq->ctx = get_nfs_open_context((struct nfs_open_context *)iocb->ki_filp->private_data); 721 dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp));
722 if (!is_sync_kiocb(iocb)) 722 if (!is_sync_kiocb(iocb))
723 dreq->iocb = iocb; 723 dreq->iocb = iocb;
724 724
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 5595b32c0915..c664bb921425 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -208,7 +208,7 @@ static int nfs_do_fsync(struct nfs_open_context *ctx, struct inode *inode)
208static int 208static int
209nfs_file_flush(struct file *file, fl_owner_t id) 209nfs_file_flush(struct file *file, fl_owner_t id)
210{ 210{
211 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; 211 struct nfs_open_context *ctx = nfs_file_open_context(file);
212 struct inode *inode = file->f_path.dentry->d_inode; 212 struct inode *inode = file->f_path.dentry->d_inode;
213 int status; 213 int status;
214 214
@@ -296,7 +296,7 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
296static int 296static int
297nfs_fsync(struct file *file, struct dentry *dentry, int datasync) 297nfs_fsync(struct file *file, struct dentry *dentry, int datasync)
298{ 298{
299 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; 299 struct nfs_open_context *ctx = nfs_file_open_context(file);
300 struct inode *inode = dentry->d_inode; 300 struct inode *inode = dentry->d_inode;
301 301
302 dfprintk(VFS, "nfs: fsync(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino); 302 dfprintk(VFS, "nfs: fsync(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino);
@@ -395,7 +395,7 @@ static int nfs_need_sync_write(struct file *filp, struct inode *inode)
395 395
396 if (IS_SYNC(inode) || (filp->f_flags & O_SYNC)) 396 if (IS_SYNC(inode) || (filp->f_flags & O_SYNC))
397 return 1; 397 return 1;
398 ctx = filp->private_data; 398 ctx = nfs_file_open_context(filp);
399 if (test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags)) 399 if (test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags))
400 return 1; 400 return 1;
401 return 0; 401 return 0;
@@ -438,7 +438,7 @@ static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
438 result = generic_file_aio_write(iocb, iov, nr_segs, pos); 438 result = generic_file_aio_write(iocb, iov, nr_segs, pos);
439 /* Return error values for O_SYNC and IS_SYNC() */ 439 /* Return error values for O_SYNC and IS_SYNC() */
440 if (result >= 0 && nfs_need_sync_write(iocb->ki_filp, inode)) { 440 if (result >= 0 && nfs_need_sync_write(iocb->ki_filp, inode)) {
441 int err = nfs_do_fsync(iocb->ki_filp->private_data, inode); 441 int err = nfs_do_fsync(nfs_file_open_context(iocb->ki_filp), inode);
442 if (err < 0) 442 if (err < 0)
443 result = err; 443 result = err;
444 } 444 }
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 7c8ca175d87b..45633f9ad851 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -538,7 +538,7 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c
538static void nfs_file_clear_open_context(struct file *filp) 538static void nfs_file_clear_open_context(struct file *filp)
539{ 539{
540 struct inode *inode = filp->f_path.dentry->d_inode; 540 struct inode *inode = filp->f_path.dentry->d_inode;
541 struct nfs_open_context *ctx = (struct nfs_open_context *)filp->private_data; 541 struct nfs_open_context *ctx = nfs_file_open_context(filp);
542 542
543 if (ctx) { 543 if (ctx) {
544 filp->private_data = NULL; 544 filp->private_data = NULL;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d856e9f5913b..2919271a983a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1390,7 +1390,7 @@ static int nfs4_intent_set_file(struct nameidata *nd, struct path *path, struct
1390 filp = lookup_instantiate_filp(nd, path->dentry, NULL); 1390 filp = lookup_instantiate_filp(nd, path->dentry, NULL);
1391 if (!IS_ERR(filp)) { 1391 if (!IS_ERR(filp)) {
1392 struct nfs_open_context *ctx; 1392 struct nfs_open_context *ctx;
1393 ctx = (struct nfs_open_context *)filp->private_data; 1393 ctx = nfs_file_open_context(filp);
1394 ctx->state = state; 1394 ctx->state = state;
1395 return 0; 1395 return 0;
1396 } 1396 }
@@ -3303,7 +3303,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
3303 status = -ENOMEM; 3303 status = -ENOMEM;
3304 if (seqid == NULL) 3304 if (seqid == NULL)
3305 goto out; 3305 goto out;
3306 task = nfs4_do_unlck(request, request->fl_file->private_data, lsp, seqid); 3306 task = nfs4_do_unlck(request, nfs_file_open_context(request->fl_file), lsp, seqid);
3307 status = PTR_ERR(task); 3307 status = PTR_ERR(task);
3308 if (IS_ERR(task)) 3308 if (IS_ERR(task))
3309 goto out; 3309 goto out;
@@ -3447,7 +3447,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3447 int ret; 3447 int ret;
3448 3448
3449 dprintk("%s: begin!\n", __FUNCTION__); 3449 dprintk("%s: begin!\n", __FUNCTION__);
3450 data = nfs4_alloc_lockdata(fl, fl->fl_file->private_data, 3450 data = nfs4_alloc_lockdata(fl, nfs_file_open_context(fl->fl_file),
3451 fl->fl_u.nfs4_fl.owner); 3451 fl->fl_u.nfs4_fl.owner);
3452 if (data == NULL) 3452 if (data == NULL)
3453 return -ENOMEM; 3453 return -ENOMEM;
@@ -3573,7 +3573,7 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
3573 int status; 3573 int status;
3574 3574
3575 /* verify open state */ 3575 /* verify open state */
3576 ctx = (struct nfs_open_context *)filp->private_data; 3576 ctx = nfs_file_open_context(filp);
3577 state = ctx->state; 3577 state = ctx->state;
3578 3578
3579 if (request->fl_start < 0 || request->fl_end < 0) 3579 if (request->fl_start < 0 || request->fl_end < 0)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 3e4adf8c8312..bfb36261cecb 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -774,7 +774,7 @@ static int nfs4_reclaim_locks(struct nfs4_state_recovery_ops *ops, struct nfs4_s
774 for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) { 774 for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) {
775 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) 775 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
776 continue; 776 continue;
777 if (((struct nfs_open_context *)fl->fl_file->private_data)->state != state) 777 if (nfs_file_open_context(fl->fl_file)->state != state)
778 continue; 778 continue;
779 status = ops->recover_lock(state, fl); 779 status = ops->recover_lock(state, fl);
780 if (status >= 0) 780 if (status >= 0)
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 19e05633f4e3..d6e62d7afc72 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -497,8 +497,7 @@ int nfs_readpage(struct file *file, struct page *page)
497 if (ctx == NULL) 497 if (ctx == NULL)
498 goto out_unlock; 498 goto out_unlock;
499 } else 499 } else
500 ctx = get_nfs_open_context((struct nfs_open_context *) 500 ctx = get_nfs_open_context(nfs_file_open_context(file));
501 file->private_data);
502 501
503 error = nfs_readpage_async(ctx, inode, page); 502 error = nfs_readpage_async(ctx, inode, page);
504 503
@@ -576,8 +575,7 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
576 if (desc.ctx == NULL) 575 if (desc.ctx == NULL)
577 return -EBADF; 576 return -EBADF;
578 } else 577 } else
579 desc.ctx = get_nfs_open_context((struct nfs_open_context *) 578 desc.ctx = get_nfs_open_context(nfs_file_open_context(filp));
580 filp->private_data);
581 if (rsize < PAGE_CACHE_SIZE) 579 if (rsize < PAGE_CACHE_SIZE)
582 nfs_pageio_init(&pgio, inode, nfs_pagein_multi, rsize, 0); 580 nfs_pageio_init(&pgio, inode, nfs_pagein_multi, rsize, 0);
583 else 581 else
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index fb396ea5accf..3e9e268b887e 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -667,7 +667,7 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
667 667
668int nfs_flush_incompatible(struct file *file, struct page *page) 668int nfs_flush_incompatible(struct file *file, struct page *page)
669{ 669{
670 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; 670 struct nfs_open_context *ctx = nfs_file_open_context(file);
671 struct nfs_page *req; 671 struct nfs_page *req;
672 int do_flush, status; 672 int do_flush, status;
673 /* 673 /*
@@ -701,7 +701,7 @@ int nfs_flush_incompatible(struct file *file, struct page *page)
701int nfs_updatepage(struct file *file, struct page *page, 701int nfs_updatepage(struct file *file, struct page *page,
702 unsigned int offset, unsigned int count) 702 unsigned int offset, unsigned int count)
703{ 703{
704 struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; 704 struct nfs_open_context *ctx = nfs_file_open_context(file);
705 struct inode *inode = page->mapping->host; 705 struct inode *inode = page->mapping->host;
706 int status = 0; 706 int status = 0;
707 707