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
Kirill Smelkov
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;
...
@@ -43,14 +43,12 @@ static mempool_t *nfs_rdata_mempool;
#define MIN_POOL_READ (32)
#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
;
struct
nfs_read_data
*
p
;
p
=
(
struct
nfs_read_data
*
)
mempool_alloc
(
nfs_rdata_mempool
,
SLAB_NOFS
);
p
=
(
struct
nfs_read_data
*
)
mempool_alloc
(
nfs_rdata_mempool
,
SLAB_NOFS
);
if
(
p
)
{
if
(
p
)
memset
(
p
,
0
,
sizeof
(
*
p
));
memset
(
p
,
0
,
sizeof
(
*
p
));
INIT_LIST_HEAD
(
&
p
->
pages
);
}
return
p
;
return
p
;
}
}
...
@@ -99,10 +97,17 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
...
@@ -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
rsize
=
NFS_SERVER
(
inode
)
->
rsize
;
unsigned
int
count
=
PAGE_CACHE_SIZE
;
unsigned
int
count
=
PAGE_CACHE_SIZE
;
int
result
;
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
),
.
flags
=
(
IS_SWAPFILE
(
inode
)
?
NFS_RPC_SWAPFLAGS
:
0
),
.
cred
=
NULL
,
.
cred
=
NULL
,
.
inode
=
inode
,
.
inode
=
inode
,
.
pages
=
LIST_HEAD_INIT
(
rdata
->
pages
),
.
args
=
{
.
args
=
{
.
fh
=
NFS_FH
(
inode
),
.
fh
=
NFS_FH
(
inode
),
.
lockowner
=
current
->
files
,
.
lockowner
=
current
->
files
,
...
@@ -111,7 +116,7 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
...
@@ -111,7 +116,7 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
.
count
=
rsize
,
.
count
=
rsize
,
},
},
.
res
=
{
.
res
=
{
.
fattr
=
&
rdata
.
fattr
,
.
fattr
=
&
rdata
->
fattr
,
}
}
};
};
...
@@ -123,19 +128,19 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
...
@@ -123,19 +128,19 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
*/
*/
do
{
do
{
if
(
count
<
rsize
)
if
(
count
<
rsize
)
rdata
.
args
.
count
=
count
;
rdata
->
args
.
count
=
count
;
rdata
.
res
.
count
=
rdata
.
args
.
count
;
rdata
->
res
.
count
=
rdata
->
args
.
count
;
rdata
.
args
.
offset
=
page_offset
(
page
)
+
rdata
.
args
.
pgbase
;
rdata
->
args
.
offset
=
page_offset
(
page
)
+
rdata
->
args
.
pgbase
;
dprintk
(
"NFS: nfs_proc_read(%s, (%s/%Ld), %Lu, %u)
\n
"
,
dprintk
(
"NFS: nfs_proc_read(%s, (%s/%Ld), %Lu, %u)
\n
"
,
NFS_SERVER
(
inode
)
->
hostname
,
NFS_SERVER
(
inode
)
->
hostname
,
inode
->
i_sb
->
s_id
,
inode
->
i_sb
->
s_id
,
(
long
long
)
NFS_FILEID
(
inode
),
(
long
long
)
NFS_FILEID
(
inode
),
(
unsigned
long
long
)
rdata
.
args
.
pgbase
,
(
unsigned
long
long
)
rdata
->
args
.
pgbase
,
rdata
.
args
.
count
);
rdata
->
args
.
count
);
lock_kernel
();
lock_kernel
();
result
=
NFS_PROTO
(
inode
)
->
read
(
&
rdata
,
file
);
result
=
NFS_PROTO
(
inode
)
->
read
(
rdata
,
file
);
unlock_kernel
();
unlock_kernel
();
/*
/*
...
@@ -148,17 +153,17 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
...
@@ -148,17 +153,17 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
goto
io_error
;
goto
io_error
;
}
}
count
-=
result
;
count
-=
result
;
rdata
.
args
.
pgbase
+=
result
;
rdata
->
args
.
pgbase
+=
result
;
/* Note: result == 0 should only happen if we're caching
/* Note: result == 0 should only happen if we're caching
* a write that extends the file and punches a hole.
* 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
;
break
;
}
while
(
count
);
}
while
(
count
);
NFS_FLAGS
(
inode
)
|=
NFS_INO_INVALID_ATIME
;
NFS_FLAGS
(
inode
)
|=
NFS_INO_INVALID_ATIME
;
if
(
count
)
if
(
count
)
memclear_highpage_flush
(
page
,
rdata
.
args
.
pgbase
,
count
);
memclear_highpage_flush
(
page
,
rdata
->
args
.
pgbase
,
count
);
SetPageUptodate
(
page
);
SetPageUptodate
(
page
);
if
(
PageError
(
page
))
if
(
PageError
(
page
))
ClearPageError
(
page
);
ClearPageError
(
page
);
...
@@ -166,6 +171,7 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
...
@@ -166,6 +171,7 @@ nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
io_error:
io_error:
unlock_page
(
page
);
unlock_page
(
page
);
nfs_readdata_free
(
rdata
);
return
result
;
return
result
;
}
}
...
@@ -305,6 +311,7 @@ static int nfs_pagein_multi(struct list_head *head, struct inode *inode)
...
@@ -305,6 +311,7 @@ static int nfs_pagein_multi(struct list_head *head, struct inode *inode)
data
=
nfs_readdata_alloc
();
data
=
nfs_readdata_alloc
();
if
(
!
data
)
if
(
!
data
)
goto
out_bad
;
goto
out_bad
;
INIT_LIST_HEAD
(
&
data
->
pages
);
list_add
(
&
data
->
pages
,
&
list
);
list_add
(
&
data
->
pages
,
&
list
);
requests
++
;
requests
++
;
if
(
nbytes
<=
rsize
)
if
(
nbytes
<=
rsize
)
...
@@ -361,6 +368,7 @@ static int nfs_pagein_one(struct list_head *head, struct inode *inode)
...
@@ -361,6 +368,7 @@ static int nfs_pagein_one(struct list_head *head, struct inode *inode)
if
(
!
data
)
if
(
!
data
)
goto
out_bad
;
goto
out_bad
;
INIT_LIST_HEAD
(
&
data
->
pages
);
pages
=
data
->
pagevec
;
pages
=
data
->
pagevec
;
count
=
0
;
count
=
0
;
while
(
!
list_empty
(
head
))
{
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