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
04806257
Commit
04806257
authored
Apr 22, 2004
by
Christoph Hellwig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFS] use kmem_alloc for noaddr buffers
SGI Modid: xfs-linux:xfs-kern:167609a
parent
347f6162
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
43 deletions
+47
-43
fs/xfs/linux/xfs_buf.c
fs/xfs/linux/xfs_buf.c
+47
-43
No files found.
fs/xfs/linux/xfs_buf.c
View file @
04806257
...
@@ -334,10 +334,14 @@ pagebuf_free(
...
@@ -334,10 +334,14 @@ pagebuf_free(
if
(
pb
->
pb_flags
&
_PBF_MEM_ALLOCATED
)
{
if
(
pb
->
pb_flags
&
_PBF_MEM_ALLOCATED
)
{
if
(
pb
->
pb_pages
)
{
if
(
pb
->
pb_pages
)
{
/* release the pages in the address list */
if
(
pb
->
pb_flags
&
_PBF_MEM_SLAB
)
{
if
((
pb
->
pb_pages
[
0
])
&&
/*
(
pb
->
pb_flags
&
_PBF_MEM_SLAB
))
{
* XXX: bp->pb_count_desired might be incorrect
kfree
(
pb
->
pb_addr
);
* (see pagebuf_associate_memory for details),
* but fortunately the Linux version of
* kmem_free ignores the len argument..
*/
kmem_free
(
pb
->
pb_addr
,
pb
->
pb_count_desired
);
}
else
{
}
else
{
_pagebuf_freepages
(
pb
);
_pagebuf_freepages
(
pb
);
}
}
...
@@ -843,54 +847,54 @@ pagebuf_associate_memory(
...
@@ -843,54 +847,54 @@ pagebuf_associate_memory(
return
0
;
return
0
;
}
}
page
_buf_t
*
xfs
_buf_t
*
pagebuf_get_no_daddr
(
pagebuf_get_no_daddr
(
size_t
len
,
size_t
len
,
pb_target
_t
*
target
)
xfs_buftarg
_t
*
target
)
{
{
int
rval
;
size_t
malloc_len
=
len
;
void
*
rmem
=
NULL
;
xfs_buf_t
*
bp
;
page_buf_flags_t
flags
=
PBF_FORCEIO
;
void
*
data
;
page_buf_t
*
pb
;
int
error
;
size_t
tlen
=
0
;
if
(
unlikely
(
len
>
0x20000
))
if
(
unlikely
(
len
>
0x20000
))
return
NULL
;
goto
fail
;
pb
=
pagebuf_allocate
(
flags
);
bp
=
pagebuf_allocate
(
0
);
if
(
!
pb
)
if
(
unlikely
(
bp
==
NULL
))
return
NULL
;
goto
fail
;
_pagebuf_initialize
(
bp
,
target
,
0
,
len
,
PBF_FORCEIO
);
_pagebuf_initialize
(
pb
,
target
,
0
,
len
,
flags
);
try_again:
do
{
data
=
kmem_alloc
(
malloc_len
,
KM_SLEEP
);
if
(
tlen
==
0
)
{
if
(
unlikely
(
data
==
NULL
))
tlen
=
len
;
/* first time */
goto
fail_free_buf
;
}
else
{
kfree
(
rmem
);
/* free the mem from the previous try */
/* check whether alignment matches.. */
tlen
<<=
1
;
/* double the size and try again */
if
((
__psunsigned_t
)
data
!=
}
((
__psunsigned_t
)
data
&
~
target
->
pbr_smask
))
{
if
((
rmem
=
kmalloc
(
tlen
,
GFP_KERNEL
))
==
0
)
{
/* .. else double the size and try again */
pagebuf_free
(
pb
);
kmem_free
(
data
,
malloc_len
);
return
NULL
;
malloc_len
<<=
1
;
}
goto
try_again
;
}
while
((
size_t
)
rmem
!=
((
size_t
)
rmem
&
~
target
->
pbr_smask
));
if
((
rval
=
pagebuf_associate_memory
(
pb
,
rmem
,
len
))
!=
0
)
{
kfree
(
rmem
);
pagebuf_free
(
pb
);
return
NULL
;
}
}
/* otherwise pagebuf_free just ignores it */
pb
->
pb_flags
|=
(
_PBF_MEM_ALLOCATED
|
_PBF_MEM_SLAB
);
PB_CLEAR_OWNER
(
pb
);
up
(
&
pb
->
pb_sema
);
/* Return unlocked pagebuf */
PB_TRACE
(
pb
,
"no_daddr"
,
rmem
);
error
=
pagebuf_associate_memory
(
bp
,
data
,
len
);
if
(
error
)
goto
fail_free_mem
;
bp
->
pb_flags
|=
(
_PBF_MEM_ALLOCATED
|
_PBF_MEM_SLAB
);
return
pb
;
pagebuf_unlock
(
bp
);
}
PB_TRACE
(
bp
,
"no_daddr"
,
data
);
return
bp
;
fail_free_mem:
kmem_free
(
data
,
malloc_len
);
fail_free_buf:
pagebuf_free
(
bp
);
fail:
return
NULL
;
}
/*
/*
* pagebuf_hold
* pagebuf_hold
...
...
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