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
85909403
Commit
85909403
authored
Apr 02, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Apr 02, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] romfs inode allocation
Obvious romfs fix.
parent
365f5347
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
1 deletion
+56
-1
fs/romfs/inode.c
fs/romfs/inode.c
+56
-1
No files found.
fs/romfs/inode.c
View file @
85909403
...
...
@@ -536,7 +536,51 @@ romfs_read_inode(struct inode *i)
}
}
static
kmem_cache_t
*
romfs_inode_cachep
;
static
struct
inode
*
romfs_alloc_inode
(
struct
super_block
*
sb
)
{
struct
romfs_inode_info
*
ei
;
ei
=
(
struct
romfs_inode_info
*
)
kmem_cache_alloc
(
romfs_inode_cachep
,
SLAB_KERNEL
);
if
(
!
ei
)
return
NULL
;
return
&
ei
->
vfs_inode
;
}
static
void
romfs_destroy_inode
(
struct
inode
*
inode
)
{
kmem_cache_free
(
romfs_inode_cachep
,
ROMFS_I
(
inode
));
}
static
void
init_once
(
void
*
foo
,
kmem_cache_t
*
cachep
,
unsigned
long
flags
)
{
struct
romfs_inode_info
*
ei
=
(
struct
romfs_inode_info
*
)
foo
;
if
((
flags
&
(
SLAB_CTOR_VERIFY
|
SLAB_CTOR_CONSTRUCTOR
))
==
SLAB_CTOR_CONSTRUCTOR
)
inode_init_once
(
&
ei
->
vfs_inode
);
}
static
int
init_inodecache
(
void
)
{
romfs_inode_cachep
=
kmem_cache_create
(
"romfs_inode_cache"
,
sizeof
(
struct
romfs_inode_info
),
0
,
SLAB_HWCACHE_ALIGN
,
init_once
,
NULL
);
if
(
romfs_inode_cachep
==
NULL
)
return
-
ENOMEM
;
return
0
;
}
static
void
destroy_inodecache
(
void
)
{
if
(
kmem_cache_destroy
(
romfs_inode_cachep
))
printk
(
KERN_INFO
"romfs_inode_cache: not all structures were freed
\n
"
);
}
static
struct
super_operations
romfs_ops
=
{
alloc_inode:
romfs_alloc_inode
,
destroy_inode:
romfs_destroy_inode
,
read_inode:
romfs_read_inode
,
statfs:
romfs_statfs
,
};
...
...
@@ -557,12 +601,23 @@ static struct file_system_type romfs_fs_type = {
static
int
__init
init_romfs_fs
(
void
)
{
return
register_filesystem
(
&
romfs_fs_type
);
int
err
=
init_inodecache
();
if
(
err
)
goto
out1
;
err
=
register_filesystem
(
&
romfs_fs_type
);
if
(
err
)
goto
out
;
return
0
;
out:
destroy_inodecache
();
out1:
return
err
;
}
static
void
__exit
exit_romfs_fs
(
void
)
{
unregister_filesystem
(
&
romfs_fs_type
);
destroy_inodecache
();
}
/* Yes, works even as a module... :) */
...
...
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