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
957fb7ef
Commit
957fb7ef
authored
Jan 10, 2004
by
Nathan Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFS] Fix a small pagebuf memory leak and keep track of slab pages ourselves.
SGI Modid: 2.5.x-xfs:slinx:163124a
parent
52f83275
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
20 deletions
+16
-20
fs/xfs/pagebuf/page_buf.c
fs/xfs/pagebuf/page_buf.c
+10
-15
fs/xfs/pagebuf/page_buf.h
fs/xfs/pagebuf/page_buf.h
+6
-5
No files found.
fs/xfs/pagebuf/page_buf.c
View file @
957fb7ef
...
...
@@ -372,9 +372,6 @@ _pagebuf_freepages(
page_cache_release
(
page
);
}
}
if
(
pb
->
pb_pages
!=
pb
->
pb_page_array
)
kfree
(
pb
->
pb_pages
);
}
/*
...
...
@@ -413,20 +410,17 @@ _pagebuf_free_object(
if
(
pb
->
pb_flags
&
_PBF_MEM_ALLOCATED
)
{
if
(
pb
->
pb_pages
)
{
/* release the pages in the address list */
if
(
pb
->
pb_pages
[
0
]
&&
PageSlab
(
pb
->
pb_pages
[
0
]))
{
/*
* This came from the slab
* allocator free it as such
*/
if
((
pb
->
pb_pages
[
0
])
&&
(
pb
->
pb_flags
&
_PBF_MEM_SLAB
))
{
kfree
(
pb
->
pb_addr
);
}
else
{
_pagebuf_freepages
(
pb
);
}
if
(
pb
->
pb_pages
!=
pb
->
pb_page_array
)
kfree
(
pb
->
pb_pages
);
pb
->
pb_pages
=
NULL
;
}
pb
->
pb_flags
&=
~
_PBF_MEM_ALLOCATED
;
pb
->
pb_flags
&=
~
(
_PBF_MEM_ALLOCATED
|
_PBF_MEM_SLAB
)
;
}
}
...
...
@@ -718,7 +712,8 @@ _pagebuf_find( /* find buffer for block */
_PBF_LOCKABLE
|
\
_PBF_ALL_PAGES_MAPPED
|
\
_PBF_ADDR_ALLOCATED
|
\
_PBF_MEM_ALLOCATED
;
_PBF_MEM_ALLOCATED
|
\
_PBF_MEM_SLAB
;
PB_TRACE
(
pb
,
"got_lock"
,
0
);
PB_STATS_INC
(
pb_get_locked
);
return
(
pb
);
...
...
@@ -947,8 +942,8 @@ pagebuf_get_no_daddr(
page_buf_t
*
pb
;
size_t
tlen
=
0
;
if
(
len
>
0x20000
)
return
(
NULL
)
;
if
(
unlikely
(
len
>
0x20000
)
)
return
NULL
;
pb
=
pagebuf_allocate
(
flags
);
if
(
!
pb
)
...
...
@@ -975,7 +970,7 @@ pagebuf_get_no_daddr(
return
NULL
;
}
/* otherwise pagebuf_free just ignores it */
pb
->
pb_flags
|=
_PBF_MEM_ALLOCATED
;
pb
->
pb_flags
|=
(
_PBF_MEM_ALLOCATED
|
_PBF_MEM_SLAB
)
;
PB_CLEAR_OWNER
(
pb
);
up
(
&
pb
->
pb_sema
);
/* Return unlocked pagebuf */
...
...
fs/xfs/pagebuf/page_buf.h
View file @
957fb7ef
...
...
@@ -93,12 +93,13 @@ typedef enum page_buf_flags_e { /* pb_flags values */
_PBF_PRIVATE_BH
=
(
1
<<
17
),
/* do not use public buffer heads */
_PBF_ALL_PAGES_MAPPED
=
(
1
<<
18
),
/* all pages in range mapped */
_PBF_ADDR_ALLOCATED
=
(
1
<<
19
),
/* pb_addr space was allocated */
_PBF_MEM_ALLOCATED
=
(
1
<<
20
),
/* pb_mem+underlying pages alloc'd */
_PBF_MEM_ALLOCATED
=
(
1
<<
20
),
/* underlying pages are allocated */
_PBF_MEM_SLAB
=
(
1
<<
21
),
/* underlying pages are slab allocated */
PBF_FORCEIO
=
(
1
<<
2
1
),
PBF_FLUSH
=
(
1
<<
2
2
),
/* flush disk write cache */
PBF_READ_AHEAD
=
(
1
<<
2
3
),
PBF_RUN_QUEUES
=
(
1
<<
2
4
),
/* run block device task queue */
PBF_FORCEIO
=
(
1
<<
2
2
),
/* ignore any cache state */
PBF_FLUSH
=
(
1
<<
2
3
),
/* flush disk write cache */
PBF_READ_AHEAD
=
(
1
<<
2
4
),
/* asynchronous read-ahead */
PBF_RUN_QUEUES
=
(
1
<<
2
5
),
/* run block device task queue */
}
page_buf_flags_t
;
...
...
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