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
4758c319
Commit
4758c319
authored
Mar 17, 2002
by
Brian Gerst
Committed by
Linus Torvalds
Mar 17, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] struct super_block cleanup - shmem
Seperates shmem_sb_info from struct super_block.
parent
5326862d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
11 deletions
+39
-11
include/linux/fs.h
include/linux/fs.h
+0
-2
ipc/shm.c
ipc/shm.c
+1
-0
mm/shmem.c
mm/shmem.c
+38
-9
No files found.
include/linux/fs.h
View file @
4758c319
...
@@ -471,7 +471,6 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
...
@@ -471,7 +471,6 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
return
&
list_entry
(
socket
,
struct
socket_alloc
,
socket
)
->
vfs_inode
;
return
&
list_entry
(
socket
,
struct
socket_alloc
,
socket
)
->
vfs_inode
;
}
}
#include <linux/shmem_fs.h>
/* will die */
/* will die */
#include <linux/coda_fs_i.h>
#include <linux/coda_fs_i.h>
#include <linux/ext3_fs_i.h>
#include <linux/ext3_fs_i.h>
...
@@ -697,7 +696,6 @@ struct super_block {
...
@@ -697,7 +696,6 @@ struct super_block {
struct
sysv_sb_info
sysv_sb
;
struct
sysv_sb_info
sysv_sb
;
struct
affs_sb_info
affs_sb
;
struct
affs_sb_info
affs_sb
;
struct
ufs_sb_info
ufs_sb
;
struct
ufs_sb_info
ufs_sb
;
struct
shmem_sb_info
shmem_sb
;
struct
romfs_sb_info
romfs_sb
;
struct
romfs_sb_info
romfs_sb
;
struct
hfs_sb_info
hfs_sb
;
struct
hfs_sb_info
hfs_sb
;
struct
adfs_sb_info
adfs_sb
;
struct
adfs_sb_info
adfs_sb
;
...
...
ipc/shm.c
View file @
4758c319
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include <linux/file.h>
#include <linux/file.h>
#include <linux/mman.h>
#include <linux/mman.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/shmem_fs.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include "util.h"
#include "util.h"
...
...
mm/shmem.c
View file @
4758c319
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <linux/locks.h>
#include <linux/locks.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/smp_lock.h>
#include <linux/shmem_fs.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
...
@@ -36,7 +37,10 @@
...
@@ -36,7 +37,10 @@
#define ENTRIES_PER_PAGE (PAGE_CACHE_SIZE/sizeof(unsigned long))
#define ENTRIES_PER_PAGE (PAGE_CACHE_SIZE/sizeof(unsigned long))
#define SHMEM_SB(sb) (&sb->u.shmem_sb)
static
inline
struct
shmem_sb_info
*
SHMEM_SB
(
struct
super_block
*
sb
)
{
return
sb
->
u
.
generic_sbp
;
}
static
struct
super_operations
shmem_ops
;
static
struct
super_operations
shmem_ops
;
static
struct
address_space_operations
shmem_aops
;
static
struct
address_space_operations
shmem_aops
;
...
@@ -1261,7 +1265,7 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid,
...
@@ -1261,7 +1265,7 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid,
static
int
shmem_remount_fs
(
struct
super_block
*
sb
,
int
*
flags
,
char
*
data
)
static
int
shmem_remount_fs
(
struct
super_block
*
sb
,
int
*
flags
,
char
*
data
)
{
{
struct
shmem_sb_info
*
sbinfo
=
&
sb
->
u
.
shmem_sb
;
struct
shmem_sb_info
*
sbinfo
=
SHMEM_SB
(
sb
)
;
unsigned
long
max_blocks
=
sbinfo
->
max_blocks
;
unsigned
long
max_blocks
=
sbinfo
->
max_blocks
;
unsigned
long
max_inodes
=
sbinfo
->
max_inodes
;
unsigned
long
max_inodes
=
sbinfo
->
max_inodes
;
...
@@ -1284,8 +1288,15 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
...
@@ -1284,8 +1288,15 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
int
mode
=
S_IRWXUGO
|
S_ISVTX
;
int
mode
=
S_IRWXUGO
|
S_ISVTX
;
uid_t
uid
=
current
->
fsuid
;
uid_t
uid
=
current
->
fsuid
;
gid_t
gid
=
current
->
fsgid
;
gid_t
gid
=
current
->
fsgid
;
struct
shmem_sb_info
*
sbinfo
=
SHMEM_SB
(
sb
)
;
struct
shmem_sb_info
*
sbinfo
;
struct
sysinfo
si
;
struct
sysinfo
si
;
int
err
;
sbinfo
=
kmalloc
(
sizeof
(
struct
shmem_sb_info
),
GFP_KERNEL
);
if
(
!
sbinfo
)
return
-
ENOMEM
;
sb
->
u
.
generic_sbp
=
sbinfo
;
memset
(
sbinfo
,
0
,
sizeof
(
struct
shmem_sb_info
));
/*
/*
* Per default we only allow half of the physical ram per
* Per default we only allow half of the physical ram per
...
@@ -1295,8 +1306,10 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
...
@@ -1295,8 +1306,10 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
blocks
=
inodes
=
si
.
totalram
/
2
;
blocks
=
inodes
=
si
.
totalram
/
2
;
#ifdef CONFIG_TMPFS
#ifdef CONFIG_TMPFS
if
(
shmem_parse_options
(
data
,
&
mode
,
&
uid
,
&
gid
,
&
blocks
,
&
inodes
))
if
(
shmem_parse_options
(
data
,
&
mode
,
&
uid
,
&
gid
,
&
blocks
,
&
inodes
))
{
return
-
EINVAL
;
err
=
-
EINVAL
;
goto
failed
;
}
#endif
#endif
spin_lock_init
(
&
sbinfo
->
stat_lock
);
spin_lock_init
(
&
sbinfo
->
stat_lock
);
...
@@ -1310,18 +1323,33 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
...
@@ -1310,18 +1323,33 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
sb
->
s_magic
=
TMPFS_MAGIC
;
sb
->
s_magic
=
TMPFS_MAGIC
;
sb
->
s_op
=
&
shmem_ops
;
sb
->
s_op
=
&
shmem_ops
;
inode
=
shmem_get_inode
(
sb
,
S_IFDIR
|
mode
,
0
);
inode
=
shmem_get_inode
(
sb
,
S_IFDIR
|
mode
,
0
);
if
(
!
inode
)
if
(
!
inode
)
{
return
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
failed
;
}
inode
->
i_uid
=
uid
;
inode
->
i_uid
=
uid
;
inode
->
i_gid
=
gid
;
inode
->
i_gid
=
gid
;
root
=
d_alloc_root
(
inode
);
root
=
d_alloc_root
(
inode
);
if
(
!
root
)
{
if
(
!
root
)
{
iput
(
inode
)
;
err
=
-
ENOMEM
;
return
-
ENOMEM
;
goto
failed_iput
;
}
}
sb
->
s_root
=
root
;
sb
->
s_root
=
root
;
return
0
;
return
0
;
failed_iput:
iput
(
inode
);
failed:
kfree
(
sbinfo
);
sb
->
u
.
generic_sbp
=
NULL
;
return
err
;
}
static
void
shmem_put_super
(
struct
super_block
*
sb
)
{
kfree
(
sb
->
u
.
generic_sbp
);
sb
->
u
.
generic_sbp
=
NULL
;
}
}
static
kmem_cache_t
*
shmem_inode_cachep
;
static
kmem_cache_t
*
shmem_inode_cachep
;
...
@@ -1407,6 +1435,7 @@ static struct super_operations shmem_ops = {
...
@@ -1407,6 +1435,7 @@ static struct super_operations shmem_ops = {
#endif
#endif
delete_inode:
shmem_delete_inode
,
delete_inode:
shmem_delete_inode
,
put_inode:
force_delete
,
put_inode:
force_delete
,
put_super:
shmem_put_super
,
};
};
static
struct
vm_operations_struct
shmem_vm_ops
=
{
static
struct
vm_operations_struct
shmem_vm_ops
=
{
...
...
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