]> git.hungrycats.org Git - linux/commitdiff
[PATCH] cleanup: simplify req_offset function in NFS client
authorChuck Lever <cel@citi.umich.edu>
Fri, 20 Dec 2002 14:27:42 +0000 (06:27 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Fri, 20 Dec 2002 14:27:42 +0000 (06:27 -0800)
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.

fs/nfs/nfs3proc.c
fs/nfs/nfs4proc.c
fs/nfs/proc.c
fs/nfs/read.c
fs/nfs/write.c
include/linux/nfs_fs.h

index 9ccadb74518e74fd432223a0c64d48800cca4dea..c7388075cc7985a588320478e105f54f779d8093 100644 (file)
@@ -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;
index 133ab997f684b01ee1d8847ebe6064d7cebad6c1..aff976bd19c537fd2f48e7df26777d7825f2f3c4 100644 (file)
@@ -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);
 
index 8869191cfb1fc01412554aa097dd7adfcc3399ac..9e8785e540b98403623b9582fbf9a0254d81de24 100644 (file)
@@ -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;
index 696cf9f8a797d66892bfc5126cbfd55b4cf11cc2..423f27748525ccbe7633680e8f81fb6e93bbdf6a 100644 (file)
@@ -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);
index 21d30b3a36e6234cc15e50a1fa66e18d867c0a09..9f03dee514204a4ed2dbe3046296461af90f84f4 100644 (file)
@@ -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;
index 2673e32cc4bae39dd8634fa73fc2628299392b48..bddf1207c3a84182cbb9988a59278700089dfc35 100644 (file)
@@ -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;
 }
 
 /*