Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
863a6d53
Commit
863a6d53
authored
May 20, 2004
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
From: Arjan van de Ven <arjanv@redhat.com> and akpm
nfs/read.c: dynamically allocate the big structs
parent
338be654
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
15 deletions
+23
-15
fs/nfs/read.c
fs/nfs/read.c
+23
-15
No files found.
fs/nfs/read.c
View file @
863a6d53
...
...
@@ -43,14 +43,12 @@ static mempool_t *nfs_rdata_mempool;
#define MIN_POOL_READ (32)
static
__inline__
struct
nfs_read_data
*
nfs_readdata_alloc
(
void
)
static
struct
nfs_read_data
*
nfs_readdata_alloc
(
void
)
{
struct
nfs_read_data
*
p
;
p
=
(
struct
nfs_read_data
*
)
mempool_alloc
(
nfs_rdata_mempool
,
SLAB_NOFS
);
if
(
p
)
{
if
(
p
)
memset
(
p
,
0
,
sizeof
(
*
p
));
INIT_LIST_HEAD
(
&
p
->
pages
);
}
return
p
;
}
...
...
@@ -99,10 +97,17 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
unsigned
int
rsize
=
NFS_SERVER
(
inode
)
->
rsize
;
unsigned
int
count
=
PAGE_CACHE_SIZE
;
int
result
;
struct
nfs_read_data
rdata
=
{
struct
nfs_read_data
*
rdata
;
rdata
=
nfs_readdata_alloc
();
if
(
!
rdata
)
return
-
ENOMEM
;
*
rdata
=
(
struct
nfs_read_data
)
{
.
flags
=
(
IS_SWAPFILE
(
inode
)
?
NFS_RPC_SWAPFLAGS
:
0
),
.
cred
=
NULL
,
.
inode
=
inode
,
.
pages
=
LIST_HEAD_INIT
(
rdata
->
pages
),
.
args
=
{
.
fh
=
NFS_FH
(
inode
),
.
lockowner
=
current
->
files
,
...
...
@@ -111,7 +116,7 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
.
count
=
rsize
,
},
.
res
=
{
.
fattr
=
&
rdata
.
fattr
,
.
fattr
=
&
rdata
->
fattr
,
}
};
...
...
@@ -123,19 +128,19 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
*/
do
{
if
(
count
<
rsize
)
rdata
.
args
.
count
=
count
;
rdata
.
res
.
count
=
rdata
.
args
.
count
;
rdata
.
args
.
offset
=
page_offset
(
page
)
+
rdata
.
args
.
pgbase
;
rdata
->
args
.
count
=
count
;
rdata
->
res
.
count
=
rdata
->
args
.
count
;
rdata
->
args
.
offset
=
page_offset
(
page
)
+
rdata
->
args
.
pgbase
;
dprintk
(
"NFS: nfs_proc_read(%s, (%s/%Ld), %Lu, %u)
\n
"
,
NFS_SERVER
(
inode
)
->
hostname
,
inode
->
i_sb
->
s_id
,
(
long
long
)
NFS_FILEID
(
inode
),
(
unsigned
long
long
)
rdata
.
args
.
pgbase
,
rdata
.
args
.
count
);
(
unsigned
long
long
)
rdata
->
args
.
pgbase
,
rdata
->
args
.
count
);
lock_kernel
();
result
=
NFS_PROTO
(
inode
)
->
read
(
&
rdata
,
file
);
result
=
NFS_PROTO
(
inode
)
->
read
(
rdata
,
file
);
unlock_kernel
();
/*
...
...
@@ -148,17 +153,17 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
goto
io_error
;
}
count
-=
result
;
rdata
.
args
.
pgbase
+=
result
;
rdata
->
args
.
pgbase
+=
result
;
/* Note: result == 0 should only happen if we're caching
* a write that extends the file and punches a hole.
*/
if
(
rdata
.
res
.
eof
!=
0
||
result
==
0
)
if
(
rdata
->
res
.
eof
!=
0
||
result
==
0
)
break
;
}
while
(
count
);
NFS_FLAGS
(
inode
)
|=
NFS_INO_INVALID_ATIME
;
if
(
count
)
memclear_highpage_flush
(
page
,
rdata
.
args
.
pgbase
,
count
);
memclear_highpage_flush
(
page
,
rdata
->
args
.
pgbase
,
count
);
SetPageUptodate
(
page
);
if
(
PageError
(
page
))
ClearPageError
(
page
);
...
...
@@ -166,6 +171,7 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
io_error:
unlock_page
(
page
);
nfs_readdata_free
(
rdata
);
return
result
;
}
...
...
@@ -305,6 +311,7 @@ static int nfs_pagein_multi(struct list_head *head, struct inode *inode)
data
=
nfs_readdata_alloc
();
if
(
!
data
)
goto
out_bad
;
INIT_LIST_HEAD
(
&
data
->
pages
);
list_add
(
&
data
->
pages
,
&
list
);
requests
++
;
if
(
nbytes
<=
rsize
)
...
...
@@ -361,6 +368,7 @@ static int nfs_pagein_one(struct list_head *head, struct inode *inode)
if
(
!
data
)
goto
out_bad
;
INIT_LIST_HEAD
(
&
data
->
pages
);
pages
=
data
->
pagevec
;
count
=
0
;
while
(
!
list_empty
(
head
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment