Commit 0607be17 authored by Chuck Lever's avatar Chuck Lever Committed by Linus Torvalds

[PATCH] cleanup: simplify req_offset function in NFS client

Description:
  everywhere the NFS client uses the req_offset() function today, it adds
  req->wb_offset to the result.  this patch simply makes "+req->wb_offset"
  a part of the req_offset() function.

Test status:
  Passes all Connectathon '02 tests with v2, v3, UDP and TCP.  Passes
  NFS torture tests on an x86 UP highmem system.
parent 756e3174
......@@ -708,7 +708,7 @@ nfs3_proc_read_setup(struct nfs_read_data *data, unsigned int count)
req = nfs_list_entry(data->pages.next);
data->u.v3.args.fh = NFS_FH(inode);
data->u.v3.args.offset = req_offset(req) + req->wb_offset;
data->u.v3.args.offset = req_offset(req);
data->u.v3.args.pgbase = req->wb_offset;
data->u.v3.args.pages = data->pagevec;
data->u.v3.args.count = count;
......@@ -764,7 +764,7 @@ nfs3_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
req = nfs_list_entry(data->pages.next);
data->u.v3.args.fh = NFS_FH(inode);
data->u.v3.args.offset = req_offset(req) + req->wb_offset;
data->u.v3.args.offset = req_offset(req);
data->u.v3.args.pgbase = req->wb_offset;
data->u.v3.args.count = count;
data->u.v3.args.stable = stable;
......
......@@ -1384,7 +1384,7 @@ nfs4_proc_read_setup(struct nfs_read_data *data, unsigned int count)
nfs4_setup_compound(cp, data->u.v4.ops, NFS_SERVER(inode), "read [async]");
nfs4_setup_putfh(cp, NFS_FH(inode));
nfs4_setup_read(cp, req_offset(req) + req->wb_offset,
nfs4_setup_read(cp, req_offset(req),
count, data->pagevec, req->wb_offset,
&data->u.v4.res_eof,
&data->u.v4.res_count);
......@@ -1437,7 +1437,7 @@ nfs4_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
nfs4_setup_compound(cp, data->u.v4.ops, NFS_SERVER(inode), "write [async]");
nfs4_setup_putfh(cp, NFS_FH(inode));
nfs4_setup_write(cp, req_offset(req) + req->wb_offset,
nfs4_setup_write(cp, req_offset(req),
count, stable, data->pagevec, req->wb_offset,
&data->u.v4.res_count, &data->verf);
......
......@@ -543,7 +543,7 @@ nfs_proc_read_setup(struct nfs_read_data *data, unsigned int count)
req = nfs_list_entry(data->pages.next);
data->u.v3.args.fh = NFS_FH(inode);
data->u.v3.args.offset = req_offset(req) + req->wb_offset;
data->u.v3.args.offset = req_offset(req);
data->u.v3.args.pgbase = req->wb_offset;
data->u.v3.args.pages = data->pagevec;
data->u.v3.args.count = count;
......@@ -589,7 +589,7 @@ nfs_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
req = nfs_list_entry(data->pages.next);
data->u.v3.args.fh = NFS_FH(inode);
data->u.v3.args.offset = req_offset(req) + req->wb_offset;
data->u.v3.args.offset = req_offset(req);
data->u.v3.args.pgbase = req->wb_offset;
data->u.v3.args.count = count;
data->u.v3.args.stable = NFS_FILE_SYNC;
......
......@@ -178,7 +178,7 @@ nfs_read_rpcsetup(struct list_head *head, struct nfs_read_data *data)
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
count,
(unsigned long long)req_offset(req) + req->wb_offset);
(unsigned long long)req_offset(req));
}
static void
......@@ -274,7 +274,7 @@ nfs_readpage_result(struct rpc_task *task, unsigned int count, int eof)
if (eof ||
((fattr->valid & NFS_ATTR_FATTR) &&
((req_offset(req) + req->wb_offset + count) >= fattr->size)))
((req_offset(req) + count) >= fattr->size)))
SetPageUptodate(page);
else
if (count < req->wb_bytes)
......@@ -292,7 +292,7 @@ nfs_readpage_result(struct rpc_task *task, unsigned int count, int eof)
req->wb_inode->i_sb->s_id,
(long long)NFS_FILEID(req->wb_inode),
req->wb_bytes,
(long long)(req_offset(req) + req->wb_offset));
(long long)req_offset(req));
nfs_clear_request(req);
nfs_release_request(req);
nfs_unlock_request(req);
......
......@@ -768,7 +768,7 @@ nfs_write_rpcsetup(struct list_head *head, struct nfs_write_data *data, int how)
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
count,
(unsigned long long)req_offset(req) + req->wb_offset);
(unsigned long long)req_offset(req));
}
/*
......@@ -902,7 +902,7 @@ nfs_writeback_done(struct rpc_task *task, int stable,
req->wb_inode->i_sb->s_id,
(long long)NFS_FILEID(req->wb_inode),
req->wb_bytes,
(long long)(req_offset(req) + req->wb_offset));
(long long)req_offset(req));
if (task->tk_status < 0) {
ClearPageUptodate(page);
......@@ -958,8 +958,8 @@ nfs_commit_rpcsetup(struct list_head *head, struct nfs_write_data *data, int how
* Determine the offset range of requests in the COMMIT call.
* We rely on the fact that data->pages is an ordered list...
*/
start = req_offset(first) + first->wb_offset;
end = req_offset(last) + (last->wb_offset + last->wb_bytes);
start = req_offset(first);
end = req_offset(last) + last->wb_bytes;
len = end - start;
/* If 'len' is not a 32-bit quantity, pass '0' in the COMMIT call */
if (end >= inode->i_size || len < 0 || len > (~((u32)0) >> 1))
......@@ -1031,7 +1031,7 @@ nfs_commit_done(struct rpc_task *task)
req->wb_inode->i_sb->s_id,
(long long)NFS_FILEID(req->wb_inode),
req->wb_bytes,
(long long)(req_offset(req) + req->wb_offset));
(long long)req_offset(req));
if (task->tk_status < 0) {
if (req->wb_file)
req->wb_file->f_error = task->tk_status;
......
......@@ -222,7 +222,7 @@ loff_t page_offset(struct page *page)
static inline
loff_t req_offset(struct nfs_page *req)
{
return ((loff_t)req->wb_index) << PAGE_CACHE_SHIFT;
return (((loff_t)req->wb_index) << PAGE_CACHE_SHIFT) + req->wb_offset;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment