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
136b6223
Commit
136b6223
authored
Aug 19, 2002
by
Dave Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] UFS superblock cleanup.
This one from Brian Gerst seperates UFS from the struct superblock union.
parent
6424ea03
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
203 additions
and
174 deletions
+203
-174
fs/ufs/balloc.c
fs/ufs/balloc.c
+24
-24
fs/ufs/cylinder.c
fs/ufs/cylinder.c
+38
-35
fs/ufs/dir.c
fs/ufs/dir.c
+4
-4
fs/ufs/ialloc.c
fs/ufs/ialloc.c
+11
-9
fs/ufs/inode.c
fs/ufs/inode.c
+9
-9
fs/ufs/namei.c
fs/ufs/namei.c
+1
-1
fs/ufs/super.c
fs/ufs/super.c
+78
-60
fs/ufs/swab.h
fs/ufs/swab.h
+12
-12
fs/ufs/truncate.c
fs/ufs/truncate.c
+5
-5
fs/ufs/util.h
fs/ufs/util.h
+13
-13
include/linux/ufs_fs.h
include/linux/ufs_fs.h
+8
-2
No files found.
fs/ufs/balloc.c
View file @
136b6223
...
@@ -47,7 +47,7 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
...
@@ -47,7 +47,7 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
unsigned
cgno
,
bit
,
end_bit
,
bbase
,
blkmap
,
i
,
blkno
,
cylno
;
unsigned
cgno
,
bit
,
end_bit
,
bbase
,
blkmap
,
i
,
blkno
,
cylno
;
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
UFSD
((
"ENTER, fragment %u, count %u
\n
"
,
fragment
,
count
))
UFSD
((
"ENTER, fragment %u, count %u
\n
"
,
fragment
,
count
))
...
@@ -89,7 +89,7 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
...
@@ -89,7 +89,7 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
count
);
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
count
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
count
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
count
);
fs32_add
(
sb
,
&
sb
->
fs_cs
(
cgno
).
cs_nffree
,
count
);
fs32_add
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cgno
).
cs_nffree
,
count
);
blkmap
=
ubh_blkmap
(
UCPI_UBH
,
ucpi
->
c_freeoff
,
bbase
);
blkmap
=
ubh_blkmap
(
UCPI_UBH
,
ucpi
->
c_freeoff
,
bbase
);
ufs_fragacct
(
sb
,
blkmap
,
ucg
->
cg_frsum
,
1
);
ufs_fragacct
(
sb
,
blkmap
,
ucg
->
cg_frsum
,
1
);
...
@@ -100,12 +100,12 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
...
@@ -100,12 +100,12 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
if
(
ubh_isblockset
(
UCPI_UBH
,
ucpi
->
c_freeoff
,
blkno
))
{
if
(
ubh_isblockset
(
UCPI_UBH
,
ucpi
->
c_freeoff
,
blkno
))
{
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
uspi
->
s_fpb
);
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
uspi
->
s_fpb
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
uspi
->
s_fpb
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
uspi
->
s_fpb
);
fs32_sub
(
sb
,
&
sb
->
fs_cs
(
cgno
).
cs_nffree
,
uspi
->
s_fpb
);
fs32_sub
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cgno
).
cs_nffree
,
uspi
->
s_fpb
);
if
((
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_CG_MASK
)
==
UFS_CG_44BSD
)
if
((
UFS_SB
(
sb
)
->
s_flags
&
UFS_CG_MASK
)
==
UFS_CG_44BSD
)
ufs_clusteracct
(
sb
,
ucpi
,
blkno
,
1
);
ufs_clusteracct
(
sb
,
ucpi
,
blkno
,
1
);
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
sb
->
fs_cs
(
cgno
).
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cgno
).
cs_nbfree
,
1
);
cylno
=
ufs_cbtocylno
(
bbase
);
cylno
=
ufs_cbtocylno
(
bbase
);
fs16_add
(
sb
,
&
ubh_cg_blks
(
ucpi
,
cylno
,
ufs_cbtorpos
(
bbase
)),
1
);
fs16_add
(
sb
,
&
ubh_cg_blks
(
ucpi
,
cylno
,
ufs_cbtorpos
(
bbase
)),
1
);
fs32_add
(
sb
,
&
ubh_cg_blktot
(
ucpi
,
cylno
),
1
);
fs32_add
(
sb
,
&
ubh_cg_blktot
(
ucpi
,
cylno
),
1
);
...
@@ -141,7 +141,7 @@ void ufs_free_blocks (struct inode * inode, unsigned fragment, unsigned count) {
...
@@ -141,7 +141,7 @@ void ufs_free_blocks (struct inode * inode, unsigned fragment, unsigned count) {
unsigned
overflow
,
cgno
,
bit
,
end_bit
,
blkno
,
i
,
cylno
;
unsigned
overflow
,
cgno
,
bit
,
end_bit
,
blkno
,
i
,
cylno
;
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
UFSD
((
"ENTER, fragment %u, count %u
\n
"
,
fragment
,
count
))
UFSD
((
"ENTER, fragment %u, count %u
\n
"
,
fragment
,
count
))
...
@@ -184,13 +184,13 @@ void ufs_free_blocks (struct inode * inode, unsigned fragment, unsigned count) {
...
@@ -184,13 +184,13 @@ void ufs_free_blocks (struct inode * inode, unsigned fragment, unsigned count) {
ufs_error
(
sb
,
"ufs_free_blocks"
,
"freeing free fragment"
);
ufs_error
(
sb
,
"ufs_free_blocks"
,
"freeing free fragment"
);
}
}
ubh_setblock
(
UCPI_UBH
,
ucpi
->
c_freeoff
,
blkno
);
ubh_setblock
(
UCPI_UBH
,
ucpi
->
c_freeoff
,
blkno
);
if
((
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_CG_MASK
)
==
UFS_CG_44BSD
)
if
((
UFS_SB
(
sb
)
->
s_flags
&
UFS_CG_MASK
)
==
UFS_CG_44BSD
)
ufs_clusteracct
(
sb
,
ucpi
,
blkno
,
1
);
ufs_clusteracct
(
sb
,
ucpi
,
blkno
,
1
);
DQUOT_FREE_BLOCK
(
inode
,
uspi
->
s_fpb
);
DQUOT_FREE_BLOCK
(
inode
,
uspi
->
s_fpb
);
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
sb
->
fs_cs
(
cgno
).
cs_nbfree
,
1
);
fs32_add
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cgno
).
cs_nbfree
,
1
);
cylno
=
ufs_cbtocylno
(
i
);
cylno
=
ufs_cbtocylno
(
i
);
fs16_add
(
sb
,
&
ubh_cg_blks
(
ucpi
,
cylno
,
ufs_cbtorpos
(
i
)),
1
);
fs16_add
(
sb
,
&
ubh_cg_blks
(
ucpi
,
cylno
,
ufs_cbtorpos
(
i
)),
1
);
fs32_add
(
sb
,
&
ubh_cg_blktot
(
ucpi
,
cylno
),
1
);
fs32_add
(
sb
,
&
ubh_cg_blktot
(
ucpi
,
cylno
),
1
);
...
@@ -247,7 +247,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment,
...
@@ -247,7 +247,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment,
UFSD
((
"ENTER, ino %lu, fragment %u, goal %u, count %u
\n
"
,
inode
->
i_ino
,
fragment
,
goal
,
count
))
UFSD
((
"ENTER, ino %lu, fragment %u, goal %u, count %u
\n
"
,
inode
->
i_ino
,
fragment
,
goal
,
count
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
*
err
=
-
ENOSPC
;
*
err
=
-
ENOSPC
;
...
@@ -407,12 +407,12 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment,
...
@@ -407,12 +407,12 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment,
UFSD
((
"ENTER, fragment %u, oldcount %u, newcount %u
\n
"
,
fragment
,
oldcount
,
newcount
))
UFSD
((
"ENTER, fragment %u, oldcount %u, newcount %u
\n
"
,
fragment
,
oldcount
,
newcount
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
count
=
newcount
-
oldcount
;
count
=
newcount
-
oldcount
;
cgno
=
ufs_dtog
(
fragment
);
cgno
=
ufs_dtog
(
fragment
);
if
(
sb
->
fs_cs
(
cgno
).
cs_nffree
<
count
)
if
(
UFS_SB
(
sb
)
->
fs_cs
(
cgno
).
cs_nffree
<
count
)
return
0
;
return
0
;
if
((
ufs_fragnum
(
fragment
)
+
newcount
)
>
uspi
->
s_fpb
)
if
((
ufs_fragnum
(
fragment
)
+
newcount
)
>
uspi
->
s_fpb
)
return
0
;
return
0
;
...
@@ -453,7 +453,7 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment,
...
@@ -453,7 +453,7 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment,
}
}
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
sb
->
fs_cs
(
cgno
).
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cgno
).
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
count
);
ubh_mark_buffer_dirty
(
USPI_UBH
);
ubh_mark_buffer_dirty
(
USPI_UBH
);
...
@@ -470,7 +470,7 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment,
...
@@ -470,7 +470,7 @@ unsigned ufs_add_fragments (struct inode * inode, unsigned fragment,
}
}
#define UFS_TEST_FREE_SPACE_CG \
#define UFS_TEST_FREE_SPACE_CG \
ucg = (struct ufs_cylinder_group *)
sb->u.ufs_sb.
s_ucg[cgno]->b_data; \
ucg = (struct ufs_cylinder_group *)
UFS_SB(sb)->
s_ucg[cgno]->b_data; \
if (fs32_to_cpu(sb, ucg->cg_cs.cs_nbfree)) \
if (fs32_to_cpu(sb, ucg->cg_cs.cs_nbfree)) \
goto cg_found; \
goto cg_found; \
for (k = count; k < uspi->s_fpb; k++) \
for (k = count; k < uspi->s_fpb; k++) \
...
@@ -490,7 +490,7 @@ unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
...
@@ -490,7 +490,7 @@ unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
UFSD
((
"ENTER, ino %lu, cgno %u, goal %u, count %u
\n
"
,
inode
->
i_ino
,
cgno
,
goal
,
count
))
UFSD
((
"ENTER, ino %lu, cgno %u, goal %u, count %u
\n
"
,
inode
->
i_ino
,
cgno
,
goal
,
count
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
oldcg
=
cgno
;
oldcg
=
cgno
;
...
@@ -557,7 +557,7 @@ unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
...
@@ -557,7 +557,7 @@ unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
i
);
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
i
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
i
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
i
);
fs32_add
(
sb
,
&
sb
->
fs_cs
(
cgno
).
cs_nffree
,
i
);
fs32_add
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cgno
).
cs_nffree
,
i
);
fs32_add
(
sb
,
&
ucg
->
cg_frsum
[
i
],
1
);
fs32_add
(
sb
,
&
ucg
->
cg_frsum
[
i
],
1
);
goto
succed
;
goto
succed
;
}
}
...
@@ -574,7 +574,7 @@ unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
...
@@ -574,7 +574,7 @@ unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
sb
->
fs_cs
(
cgno
).
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cgno
).
cs_nffree
,
count
);
fs32_sub
(
sb
,
&
ucg
->
cg_frsum
[
allocsize
],
1
);
fs32_sub
(
sb
,
&
ucg
->
cg_frsum
[
allocsize
],
1
);
if
(
count
!=
allocsize
)
if
(
count
!=
allocsize
)
...
@@ -606,7 +606,7 @@ unsigned ufs_alloccg_block (struct inode * inode,
...
@@ -606,7 +606,7 @@ unsigned ufs_alloccg_block (struct inode * inode,
UFSD
((
"ENTER, goal %u
\n
"
,
goal
))
UFSD
((
"ENTER, goal %u
\n
"
,
goal
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
ucg
=
ubh_get_ucg
(
UCPI_UBH
);
ucg
=
ubh_get_ucg
(
UCPI_UBH
);
...
@@ -633,7 +633,7 @@ unsigned ufs_alloccg_block (struct inode * inode,
...
@@ -633,7 +633,7 @@ unsigned ufs_alloccg_block (struct inode * inode,
gotit:
gotit:
blkno
=
ufs_fragstoblks
(
result
);
blkno
=
ufs_fragstoblks
(
result
);
ubh_clrblock
(
UCPI_UBH
,
ucpi
->
c_freeoff
,
blkno
);
ubh_clrblock
(
UCPI_UBH
,
ucpi
->
c_freeoff
,
blkno
);
if
((
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_CG_MASK
)
==
UFS_CG_44BSD
)
if
((
UFS_SB
(
sb
)
->
s_flags
&
UFS_CG_MASK
)
==
UFS_CG_44BSD
)
ufs_clusteracct
(
sb
,
ucpi
,
blkno
,
-
1
);
ufs_clusteracct
(
sb
,
ucpi
,
blkno
,
-
1
);
if
(
DQUOT_ALLOC_BLOCK
(
inode
,
uspi
->
s_fpb
))
{
if
(
DQUOT_ALLOC_BLOCK
(
inode
,
uspi
->
s_fpb
))
{
*
err
=
-
EDQUOT
;
*
err
=
-
EDQUOT
;
...
@@ -642,7 +642,7 @@ unsigned ufs_alloccg_block (struct inode * inode,
...
@@ -642,7 +642,7 @@ unsigned ufs_alloccg_block (struct inode * inode,
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nbfree
,
1
);
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nbfree
,
1
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nbfree
,
1
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nbfree
,
1
);
fs32_sub
(
sb
,
&
sb
->
fs_cs
(
ucpi
->
c_cgx
).
cs_nbfree
,
1
);
fs32_sub
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
ucpi
->
c_cgx
).
cs_nbfree
,
1
);
cylno
=
ufs_cbtocylno
(
result
);
cylno
=
ufs_cbtocylno
(
result
);
fs16_sub
(
sb
,
&
ubh_cg_blks
(
ucpi
,
cylno
,
ufs_cbtorpos
(
result
)),
1
);
fs16_sub
(
sb
,
&
ubh_cg_blks
(
ucpi
,
cylno
,
ufs_cbtorpos
(
result
)),
1
);
fs32_sub
(
sb
,
&
ubh_cg_blktot
(
ucpi
,
cylno
),
1
);
fs32_sub
(
sb
,
&
ubh_cg_blktot
(
ucpi
,
cylno
),
1
);
...
@@ -663,7 +663,7 @@ unsigned ufs_bitmap_search (struct super_block * sb,
...
@@ -663,7 +663,7 @@ unsigned ufs_bitmap_search (struct super_block * sb,
UFSD
((
"ENTER, cg %u, goal %u, count %u
\n
"
,
ucpi
->
c_cgx
,
goal
,
count
))
UFSD
((
"ENTER, cg %u, goal %u, count %u
\n
"
,
ucpi
->
c_cgx
,
goal
,
count
))
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
ucg
=
ubh_get_ucg
(
UCPI_UBH
);
ucg
=
ubh_get_ucg
(
UCPI_UBH
);
...
@@ -729,7 +729,7 @@ void ufs_clusteracct(struct super_block * sb,
...
@@ -729,7 +729,7 @@ void ufs_clusteracct(struct super_block * sb,
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
int
i
,
start
,
end
,
forw
,
back
;
int
i
,
start
,
end
,
forw
,
back
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
if
(
uspi
->
s_contigsumsize
<=
0
)
if
(
uspi
->
s_contigsumsize
<=
0
)
return
;
return
;
...
...
fs/ufs/cylinder.c
View file @
136b6223
...
@@ -36,26 +36,27 @@
...
@@ -36,26 +36,27 @@
static
void
ufs_read_cylinder
(
struct
super_block
*
sb
,
static
void
ufs_read_cylinder
(
struct
super_block
*
sb
,
unsigned
cgno
,
unsigned
bitmap_nr
)
unsigned
cgno
,
unsigned
bitmap_nr
)
{
{
struct
ufs_sb_info
*
sbi
=
UFS_SB
(
sb
);
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_cg_private_info
*
ucpi
;
struct
ufs_cg_private_info
*
ucpi
;
struct
ufs_cylinder_group
*
ucg
;
struct
ufs_cylinder_group
*
ucg
;
unsigned
i
,
j
;
unsigned
i
,
j
;
UFSD
((
"ENTER, cgno %u, bitmap_nr %u
\n
"
,
cgno
,
bitmap_nr
))
UFSD
((
"ENTER, cgno %u, bitmap_nr %u
\n
"
,
cgno
,
bitmap_nr
))
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
sb
i
->
s_uspi
;
ucpi
=
sb
->
u
.
ufs_sb
.
s_ucpi
[
bitmap_nr
];
ucpi
=
sb
i
->
s_ucpi
[
bitmap_nr
];
ucg
=
(
struct
ufs_cylinder_group
*
)
sb
->
u
.
ufs_sb
.
s_ucg
[
cgno
]
->
b_data
;
ucg
=
(
struct
ufs_cylinder_group
*
)
sb
i
->
s_ucg
[
cgno
]
->
b_data
;
UCPI_UBH
->
fragment
=
ufs_cgcmin
(
cgno
);
UCPI_UBH
->
fragment
=
ufs_cgcmin
(
cgno
);
UCPI_UBH
->
count
=
uspi
->
s_cgsize
>>
sb
->
s_blocksize_bits
;
UCPI_UBH
->
count
=
uspi
->
s_cgsize
>>
sb
->
s_blocksize_bits
;
/*
/*
* We have already the first fragment of cylinder group block in buffer
* We have already the first fragment of cylinder group block in buffer
*/
*/
UCPI_UBH
->
bh
[
0
]
=
sb
->
u
.
ufs_sb
.
s_ucg
[
cgno
];
UCPI_UBH
->
bh
[
0
]
=
sb
i
->
s_ucg
[
cgno
];
for
(
i
=
1
;
i
<
UCPI_UBH
->
count
;
i
++
)
for
(
i
=
1
;
i
<
UCPI_UBH
->
count
;
i
++
)
if
(
!
(
UCPI_UBH
->
bh
[
i
]
=
sb_bread
(
sb
,
UCPI_UBH
->
fragment
+
i
)))
if
(
!
(
UCPI_UBH
->
bh
[
i
]
=
sb_bread
(
sb
,
UCPI_UBH
->
fragment
+
i
)))
goto
failed
;
goto
failed
;
sb
->
u
.
ufs_sb
.
s_cgno
[
bitmap_nr
]
=
cgno
;
sb
i
->
s_cgno
[
bitmap_nr
]
=
cgno
;
ucpi
->
c_cgx
=
fs32_to_cpu
(
sb
,
ucg
->
cg_cgx
);
ucpi
->
c_cgx
=
fs32_to_cpu
(
sb
,
ucg
->
cg_cgx
);
ucpi
->
c_ncyl
=
fs16_to_cpu
(
sb
,
ucg
->
cg_ncyl
);
ucpi
->
c_ncyl
=
fs16_to_cpu
(
sb
,
ucg
->
cg_ncyl
);
...
@@ -77,8 +78,8 @@ static void ufs_read_cylinder (struct super_block * sb,
...
@@ -77,8 +78,8 @@ static void ufs_read_cylinder (struct super_block * sb,
failed:
failed:
for
(
j
=
1
;
j
<
i
;
j
++
)
for
(
j
=
1
;
j
<
i
;
j
++
)
brelse
(
sb
->
u
.
ufs_sb
.
s_ucg
[
j
]);
brelse
(
sb
i
->
s_ucg
[
j
]);
sb
->
u
.
ufs_sb
.
s_cgno
[
bitmap_nr
]
=
UFS_CGNO_EMPTY
;
sb
i
->
s_cgno
[
bitmap_nr
]
=
UFS_CGNO_EMPTY
;
ufs_error
(
sb
,
"ufs_read_cylinder"
,
"can't read cylinder group block %u"
,
cgno
);
ufs_error
(
sb
,
"ufs_read_cylinder"
,
"can't read cylinder group block %u"
,
cgno
);
}
}
...
@@ -88,6 +89,7 @@ static void ufs_read_cylinder (struct super_block * sb,
...
@@ -88,6 +89,7 @@ static void ufs_read_cylinder (struct super_block * sb,
*/
*/
void
ufs_put_cylinder
(
struct
super_block
*
sb
,
unsigned
bitmap_nr
)
void
ufs_put_cylinder
(
struct
super_block
*
sb
,
unsigned
bitmap_nr
)
{
{
struct
ufs_sb_info
*
sbi
=
UFS_SB
(
sb
);
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_cg_private_info
*
ucpi
;
struct
ufs_cg_private_info
*
ucpi
;
struct
ufs_cylinder_group
*
ucg
;
struct
ufs_cylinder_group
*
ucg
;
...
@@ -95,15 +97,15 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
...
@@ -95,15 +97,15 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
UFSD
((
"ENTER, bitmap_nr %u
\n
"
,
bitmap_nr
))
UFSD
((
"ENTER, bitmap_nr %u
\n
"
,
bitmap_nr
))
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
sb
i
->
s_uspi
;
if
(
sb
->
u
.
ufs_sb
.
s_cgno
[
bitmap_nr
]
==
UFS_CGNO_EMPTY
)
{
if
(
sb
i
->
s_cgno
[
bitmap_nr
]
==
UFS_CGNO_EMPTY
)
{
UFSD
((
"EXIT
\n
"
))
UFSD
((
"EXIT
\n
"
))
return
;
return
;
}
}
ucpi
=
sb
->
u
.
ufs_sb
.
s_ucpi
[
bitmap_nr
];
ucpi
=
sb
i
->
s_ucpi
[
bitmap_nr
];
ucg
=
ubh_get_ucg
(
UCPI_UBH
);
ucg
=
ubh_get_ucg
(
UCPI_UBH
);
if
(
uspi
->
s_ncg
>
UFS_MAX_GROUP_LOADED
&&
bitmap_nr
>=
sb
->
u
.
ufs_sb
.
s_cg_loaded
)
{
if
(
uspi
->
s_ncg
>
UFS_MAX_GROUP_LOADED
&&
bitmap_nr
>=
sb
i
->
s_cg_loaded
)
{
ufs_panic
(
sb
,
"ufs_put_cylinder"
,
"internal error"
);
ufs_panic
(
sb
,
"ufs_put_cylinder"
,
"internal error"
);
return
;
return
;
}
}
...
@@ -119,7 +121,7 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
...
@@ -119,7 +121,7 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
brelse
(
UCPI_UBH
->
bh
[
i
]);
brelse
(
UCPI_UBH
->
bh
[
i
]);
}
}
sb
->
u
.
ufs_sb
.
s_cgno
[
bitmap_nr
]
=
UFS_CGNO_EMPTY
;
sb
i
->
s_cgno
[
bitmap_nr
]
=
UFS_CGNO_EMPTY
;
UFSD
((
"EXIT
\n
"
))
UFSD
((
"EXIT
\n
"
))
}
}
...
@@ -132,13 +134,14 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
...
@@ -132,13 +134,14 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
struct
ufs_cg_private_info
*
ufs_load_cylinder
(
struct
ufs_cg_private_info
*
ufs_load_cylinder
(
struct
super_block
*
sb
,
unsigned
cgno
)
struct
super_block
*
sb
,
unsigned
cgno
)
{
{
struct
ufs_sb_info
*
sbi
=
UFS_SB
(
sb
);
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_cg_private_info
*
ucpi
;
struct
ufs_cg_private_info
*
ucpi
;
unsigned
cg
,
i
,
j
;
unsigned
cg
,
i
,
j
;
UFSD
((
"ENTER, cgno %u
\n
"
,
cgno
))
UFSD
((
"ENTER, cgno %u
\n
"
,
cgno
))
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
sb
i
->
s_uspi
;
if
(
cgno
>=
uspi
->
s_ncg
)
{
if
(
cgno
>=
uspi
->
s_ncg
)
{
ufs_panic
(
sb
,
"ufs_load_cylinder"
,
"internal error, high number of cg"
);
ufs_panic
(
sb
,
"ufs_load_cylinder"
,
"internal error, high number of cg"
);
return
NULL
;
return
NULL
;
...
@@ -146,61 +149,61 @@ struct ufs_cg_private_info * ufs_load_cylinder (
...
@@ -146,61 +149,61 @@ struct ufs_cg_private_info * ufs_load_cylinder (
/*
/*
* Cylinder group number cg it in cache and it was last used
* Cylinder group number cg it in cache and it was last used
*/
*/
if
(
sb
->
u
.
ufs_sb
.
s_cgno
[
0
]
==
cgno
)
{
if
(
sb
i
->
s_cgno
[
0
]
==
cgno
)
{
UFSD
((
"EXIT
\n
"
))
UFSD
((
"EXIT
\n
"
))
return
sb
->
u
.
ufs_sb
.
s_ucpi
[
0
];
return
sb
i
->
s_ucpi
[
0
];
}
}
/*
/*
* Number of cylinder groups is not higher than UFS_MAX_GROUP_LOADED
* Number of cylinder groups is not higher than UFS_MAX_GROUP_LOADED
*/
*/
if
(
uspi
->
s_ncg
<=
UFS_MAX_GROUP_LOADED
)
{
if
(
uspi
->
s_ncg
<=
UFS_MAX_GROUP_LOADED
)
{
if
(
sb
->
u
.
ufs_sb
.
s_cgno
[
cgno
]
!=
UFS_CGNO_EMPTY
)
{
if
(
sb
i
->
s_cgno
[
cgno
]
!=
UFS_CGNO_EMPTY
)
{
if
(
sb
->
u
.
ufs_sb
.
s_cgno
[
cgno
]
!=
cgno
)
{
if
(
sb
i
->
s_cgno
[
cgno
]
!=
cgno
)
{
ufs_panic
(
sb
,
"ufs_load_cylinder"
,
"internal error, wrong number of cg in cache"
);
ufs_panic
(
sb
,
"ufs_load_cylinder"
,
"internal error, wrong number of cg in cache"
);
UFSD
((
"EXIT (FAILED)
\n
"
))
UFSD
((
"EXIT (FAILED)
\n
"
))
return
NULL
;
return
NULL
;
}
}
else
{
else
{
UFSD
((
"EXIT
\n
"
))
UFSD
((
"EXIT
\n
"
))
return
sb
->
u
.
ufs_sb
.
s_ucpi
[
cgno
];
return
sb
i
->
s_ucpi
[
cgno
];
}
}
}
else
{
}
else
{
ufs_read_cylinder
(
sb
,
cgno
,
cgno
);
ufs_read_cylinder
(
sb
,
cgno
,
cgno
);
UFSD
((
"EXIT
\n
"
))
UFSD
((
"EXIT
\n
"
))
return
sb
->
u
.
ufs_sb
.
s_ucpi
[
cgno
];
return
sb
i
->
s_ucpi
[
cgno
];
}
}
}
}
/*
/*
* Cylinder group number cg is in cache but it was not last used,
* Cylinder group number cg is in cache but it was not last used,
* we will move to the first position
* we will move to the first position
*/
*/
for
(
i
=
0
;
i
<
sb
->
u
.
ufs_sb
.
s_cg_loaded
&&
sb
->
u
.
ufs_sb
.
s_cgno
[
i
]
!=
cgno
;
i
++
);
for
(
i
=
0
;
i
<
sb
i
->
s_cg_loaded
&&
sbi
->
s_cgno
[
i
]
!=
cgno
;
i
++
);
if
(
i
<
sb
->
u
.
ufs_sb
.
s_cg_loaded
&&
sb
->
u
.
ufs_sb
.
s_cgno
[
i
]
==
cgno
)
{
if
(
i
<
sb
i
->
s_cg_loaded
&&
sbi
->
s_cgno
[
i
]
==
cgno
)
{
cg
=
sb
->
u
.
ufs_sb
.
s_cgno
[
i
];
cg
=
sb
i
->
s_cgno
[
i
];
ucpi
=
sb
->
u
.
ufs_sb
.
s_ucpi
[
i
];
ucpi
=
sb
i
->
s_ucpi
[
i
];
for
(
j
=
i
;
j
>
0
;
j
--
)
{
for
(
j
=
i
;
j
>
0
;
j
--
)
{
sb
->
u
.
ufs_sb
.
s_cgno
[
j
]
=
sb
->
u
.
ufs_sb
.
s_cgno
[
j
-
1
];
sb
i
->
s_cgno
[
j
]
=
sbi
->
s_cgno
[
j
-
1
];
sb
->
u
.
ufs_sb
.
s_ucpi
[
j
]
=
sb
->
u
.
ufs_sb
.
s_ucpi
[
j
-
1
];
sb
i
->
s_ucpi
[
j
]
=
sbi
->
s_ucpi
[
j
-
1
];
}
}
sb
->
u
.
ufs_sb
.
s_cgno
[
0
]
=
cg
;
sb
i
->
s_cgno
[
0
]
=
cg
;
sb
->
u
.
ufs_sb
.
s_ucpi
[
0
]
=
ucpi
;
sb
i
->
s_ucpi
[
0
]
=
ucpi
;
/*
/*
* Cylinder group number cg is not in cache, we will read it from disk
* Cylinder group number cg is not in cache, we will read it from disk
* and put it to the first position
* and put it to the first position
*/
*/
}
else
{
}
else
{
if
(
sb
->
u
.
ufs_sb
.
s_cg_loaded
<
UFS_MAX_GROUP_LOADED
)
if
(
sb
i
->
s_cg_loaded
<
UFS_MAX_GROUP_LOADED
)
sb
->
u
.
ufs_sb
.
s_cg_loaded
++
;
sb
i
->
s_cg_loaded
++
;
else
else
ufs_put_cylinder
(
sb
,
UFS_MAX_GROUP_LOADED
-
1
);
ufs_put_cylinder
(
sb
,
UFS_MAX_GROUP_LOADED
-
1
);
ucpi
=
sb
->
u
.
ufs_sb
.
s_ucpi
[
sb
->
u
.
ufs_sb
.
s_cg_loaded
-
1
];
ucpi
=
sb
i
->
s_ucpi
[
sbi
->
s_cg_loaded
-
1
];
for
(
j
=
sb
->
u
.
ufs_sb
.
s_cg_loaded
-
1
;
j
>
0
;
j
--
)
{
for
(
j
=
sb
i
->
s_cg_loaded
-
1
;
j
>
0
;
j
--
)
{
sb
->
u
.
ufs_sb
.
s_cgno
[
j
]
=
sb
->
u
.
ufs_sb
.
s_cgno
[
j
-
1
];
sb
i
->
s_cgno
[
j
]
=
sbi
->
s_cgno
[
j
-
1
];
sb
->
u
.
ufs_sb
.
s_ucpi
[
j
]
=
sb
->
u
.
ufs_sb
.
s_ucpi
[
j
-
1
];
sb
i
->
s_ucpi
[
j
]
=
sbi
->
s_ucpi
[
j
-
1
];
}
}
sb
->
u
.
ufs_sb
.
s_ucpi
[
0
]
=
ucpi
;
sb
i
->
s_ucpi
[
0
]
=
ucpi
;
ufs_read_cylinder
(
sb
,
cgno
,
0
);
ufs_read_cylinder
(
sb
,
cgno
,
0
);
}
}
UFSD
((
"EXIT
\n
"
))
UFSD
((
"EXIT
\n
"
))
return
sb
->
u
.
ufs_sb
.
s_ucpi
[
0
];
return
sb
i
->
s_ucpi
[
0
];
}
}
fs/ufs/dir.c
View file @
136b6223
...
@@ -67,7 +67,7 @@ ufs_readdir (struct file * filp, void * dirent, filldir_t filldir)
...
@@ -67,7 +67,7 @@ ufs_readdir (struct file * filp, void * dirent, filldir_t filldir)
lock_kernel
();
lock_kernel
();
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
flags
=
sb
->
u
.
ufs_sb
.
s_flags
;
flags
=
UFS_SB
(
sb
)
->
s_flags
;
UFSD
((
"ENTER, ino %lu f_pos %lu
\n
"
,
inode
->
i_ino
,
(
unsigned
long
)
filp
->
f_pos
))
UFSD
((
"ENTER, ino %lu f_pos %lu
\n
"
,
inode
->
i_ino
,
(
unsigned
long
)
filp
->
f_pos
))
...
@@ -308,8 +308,8 @@ int ufs_check_dir_entry (const char * function, struct inode * dir,
...
@@ -308,8 +308,8 @@ int ufs_check_dir_entry (const char * function, struct inode * dir,
error_msg
=
"reclen is too small for namlen"
;
error_msg
=
"reclen is too small for namlen"
;
else
if
(((
char
*
)
de
-
bh
->
b_data
)
+
rlen
>
dir
->
i_sb
->
s_blocksize
)
else
if
(((
char
*
)
de
-
bh
->
b_data
)
+
rlen
>
dir
->
i_sb
->
s_blocksize
)
error_msg
=
"directory entry across blocks"
;
error_msg
=
"directory entry across blocks"
;
else
if
(
fs32_to_cpu
(
sb
,
de
->
d_ino
)
>
(
sb
->
u
.
ufs_sb
.
s_uspi
->
s_ipg
*
else
if
(
fs32_to_cpu
(
sb
,
de
->
d_ino
)
>
(
UFS_SB
(
sb
)
->
s_uspi
->
s_ipg
*
sb
->
u
.
ufs_sb
.
s_uspi
->
s_ncg
))
UFS_SB
(
sb
)
->
s_uspi
->
s_ncg
))
error_msg
=
"inode out of bounds"
;
error_msg
=
"inode out of bounds"
;
if
(
error_msg
!=
NULL
)
if
(
error_msg
!=
NULL
)
...
@@ -386,7 +386,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)
...
@@ -386,7 +386,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)
UFSD
((
"ENTER, name %s, namelen %u
\n
"
,
name
,
namelen
))
UFSD
((
"ENTER, name %s, namelen %u
\n
"
,
name
,
namelen
))
sb
=
dir
->
i_sb
;
sb
=
dir
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
if
(
!
namelen
)
if
(
!
namelen
)
return
-
EINVAL
;
return
-
EINVAL
;
...
...
fs/ufs/ialloc.c
View file @
136b6223
...
@@ -71,7 +71,7 @@ void ufs_free_inode (struct inode * inode)
...
@@ -71,7 +71,7 @@ void ufs_free_inode (struct inode * inode)
UFSD
((
"ENTER, ino %lu
\n
"
,
inode
->
i_ino
))
UFSD
((
"ENTER, ino %lu
\n
"
,
inode
->
i_ino
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
ino
=
inode
->
i_ino
;
ino
=
inode
->
i_ino
;
...
@@ -112,12 +112,12 @@ void ufs_free_inode (struct inode * inode)
...
@@ -112,12 +112,12 @@ void ufs_free_inode (struct inode * inode)
ucpi
->
c_irotor
=
ino
;
ucpi
->
c_irotor
=
ino
;
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nifree
,
1
);
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_nifree
,
1
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nifree
,
1
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nifree
,
1
);
fs32_add
(
sb
,
&
sb
->
fs_cs
(
cg
).
cs_nifree
,
1
);
fs32_add
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cg
).
cs_nifree
,
1
);
if
(
is_directory
)
{
if
(
is_directory
)
{
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_ndir
,
1
);
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_ndir
,
1
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_ndir
,
1
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_ndir
,
1
);
fs32_sub
(
sb
,
&
sb
->
fs_cs
(
cg
).
cs_ndir
,
1
);
fs32_sub
(
sb
,
&
UFS_SB
(
sb
)
->
fs_cs
(
cg
).
cs_ndir
,
1
);
}
}
}
}
...
@@ -146,6 +146,7 @@ void ufs_free_inode (struct inode * inode)
...
@@ -146,6 +146,7 @@ void ufs_free_inode (struct inode * inode)
struct
inode
*
ufs_new_inode
(
struct
inode
*
dir
,
int
mode
)
struct
inode
*
ufs_new_inode
(
struct
inode
*
dir
,
int
mode
)
{
{
struct
super_block
*
sb
;
struct
super_block
*
sb
;
struct
ufs_sb_info
*
sbi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_super_block_first
*
usb1
;
struct
ufs_super_block_first
*
usb1
;
struct
ufs_cg_private_info
*
ucpi
;
struct
ufs_cg_private_info
*
ucpi
;
...
@@ -164,7 +165,8 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
...
@@ -164,7 +165,8 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
if
(
!
inode
)
if
(
!
inode
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
ufsi
=
UFS_I
(
inode
);
ufsi
=
UFS_I
(
inode
);
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
sbi
=
UFS_SB
(
sb
);
uspi
=
sbi
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
lock_super
(
sb
);
lock_super
(
sb
);
...
@@ -173,7 +175,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
...
@@ -173,7 +175,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
* Try to place the inode in its parent directory
* Try to place the inode in its parent directory
*/
*/
i
=
ufs_inotocg
(
dir
->
i_ino
);
i
=
ufs_inotocg
(
dir
->
i_ino
);
if
(
sb
->
fs_cs
(
i
).
cs_nifree
)
{
if
(
sb
i
->
fs_cs
(
i
).
cs_nifree
)
{
cg
=
i
;
cg
=
i
;
goto
cg_found
;
goto
cg_found
;
}
}
...
@@ -185,7 +187,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
...
@@ -185,7 +187,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
i
+=
j
;
i
+=
j
;
if
(
i
>=
uspi
->
s_ncg
)
if
(
i
>=
uspi
->
s_ncg
)
i
-=
uspi
->
s_ncg
;
i
-=
uspi
->
s_ncg
;
if
(
sb
->
fs_cs
(
i
).
cs_nifree
)
{
if
(
sb
i
->
fs_cs
(
i
).
cs_nifree
)
{
cg
=
i
;
cg
=
i
;
goto
cg_found
;
goto
cg_found
;
}
}
...
@@ -199,7 +201,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
...
@@ -199,7 +201,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
i
++
;
i
++
;
if
(
i
>=
uspi
->
s_ncg
)
if
(
i
>=
uspi
->
s_ncg
)
i
=
0
;
i
=
0
;
if
(
sb
->
fs_cs
(
i
).
cs_nifree
)
{
if
(
sb
i
->
fs_cs
(
i
).
cs_nifree
)
{
cg
=
i
;
cg
=
i
;
goto
cg_found
;
goto
cg_found
;
}
}
...
@@ -235,12 +237,12 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
...
@@ -235,12 +237,12 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nifree
,
1
);
fs32_sub
(
sb
,
&
ucg
->
cg_cs
.
cs_nifree
,
1
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nifree
,
1
);
fs32_sub
(
sb
,
&
usb1
->
fs_cstotal
.
cs_nifree
,
1
);
fs32_sub
(
sb
,
&
sb
->
fs_cs
(
cg
).
cs_nifree
,
1
);
fs32_sub
(
sb
,
&
sb
i
->
fs_cs
(
cg
).
cs_nifree
,
1
);
if
(
S_ISDIR
(
mode
))
{
if
(
S_ISDIR
(
mode
))
{
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_ndir
,
1
);
fs32_add
(
sb
,
&
ucg
->
cg_cs
.
cs_ndir
,
1
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_ndir
,
1
);
fs32_add
(
sb
,
&
usb1
->
fs_cstotal
.
cs_ndir
,
1
);
fs32_add
(
sb
,
&
sb
->
fs_cs
(
cg
).
cs_ndir
,
1
);
fs32_add
(
sb
,
&
sb
i
->
fs_cs
(
cg
).
cs_ndir
,
1
);
}
}
ubh_mark_buffer_dirty
(
USPI_UBH
);
ubh_mark_buffer_dirty
(
USPI_UBH
);
...
...
fs/ufs/inode.c
View file @
136b6223
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
static
int
ufs_block_to_path
(
struct
inode
*
inode
,
long
i_block
,
int
offsets
[
4
])
static
int
ufs_block_to_path
(
struct
inode
*
inode
,
long
i_block
,
int
offsets
[
4
])
{
{
struct
ufs_sb_private_info
*
uspi
=
inode
->
i_sb
->
u
.
ufs_sb
.
s_uspi
;
struct
ufs_sb_private_info
*
uspi
=
UFS_SB
(
inode
->
i_sb
)
->
s_uspi
;
int
ptrs
=
uspi
->
s_apb
;
int
ptrs
=
uspi
->
s_apb
;
int
ptrs_bits
=
uspi
->
s_apbshift
;
int
ptrs_bits
=
uspi
->
s_apbshift
;
const
long
direct_blocks
=
UFS_NDADDR
,
const
long
direct_blocks
=
UFS_NDADDR
,
...
@@ -86,7 +86,7 @@ int ufs_frag_map(struct inode *inode, int frag)
...
@@ -86,7 +86,7 @@ int ufs_frag_map(struct inode *inode, int frag)
{
{
struct
ufs_inode_info
*
ufsi
=
UFS_I
(
inode
);
struct
ufs_inode_info
*
ufsi
=
UFS_I
(
inode
);
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
ufs_sb_private_info
*
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
struct
ufs_sb_private_info
*
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
int
mask
=
uspi
->
s_apbmask
>>
uspi
->
s_fpbshift
;
int
mask
=
uspi
->
s_apbmask
>>
uspi
->
s_fpbshift
;
int
shift
=
uspi
->
s_apbshift
-
uspi
->
s_fpbshift
;
int
shift
=
uspi
->
s_apbshift
-
uspi
->
s_fpbshift
;
int
offsets
[
4
],
*
p
;
int
offsets
[
4
],
*
p
;
...
@@ -137,7 +137,7 @@ static struct buffer_head * ufs_inode_getfrag (struct inode *inode,
...
@@ -137,7 +137,7 @@ static struct buffer_head * ufs_inode_getfrag (struct inode *inode,
inode
->
i_ino
,
fragment
,
new_fragment
,
required
))
inode
->
i_ino
,
fragment
,
new_fragment
,
required
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
block
=
ufs_fragstoblks
(
fragment
);
block
=
ufs_fragstoblks
(
fragment
);
blockoff
=
ufs_fragnum
(
fragment
);
blockoff
=
ufs_fragnum
(
fragment
);
p
=
ufsi
->
i_u1
.
i_data
+
block
;
p
=
ufsi
->
i_u1
.
i_data
+
block
;
...
@@ -243,7 +243,7 @@ static struct buffer_head * ufs_block_getfrag (struct inode *inode,
...
@@ -243,7 +243,7 @@ static struct buffer_head * ufs_block_getfrag (struct inode *inode,
u32
*
p
;
u32
*
p
;
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
block
=
ufs_fragstoblks
(
fragment
);
block
=
ufs_fragstoblks
(
fragment
);
blockoff
=
ufs_fragnum
(
fragment
);
blockoff
=
ufs_fragnum
(
fragment
);
...
@@ -313,7 +313,7 @@ static struct buffer_head * ufs_block_getfrag (struct inode *inode,
...
@@ -313,7 +313,7 @@ static struct buffer_head * ufs_block_getfrag (struct inode *inode,
static
int
ufs_getfrag_block
(
struct
inode
*
inode
,
sector_t
fragment
,
struct
buffer_head
*
bh_result
,
int
create
)
static
int
ufs_getfrag_block
(
struct
inode
*
inode
,
sector_t
fragment
,
struct
buffer_head
*
bh_result
,
int
create
)
{
{
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
ufs_sb_private_info
*
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
struct
ufs_sb_private_info
*
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
struct
buffer_head
*
bh
;
struct
buffer_head
*
bh
;
int
ret
,
err
,
new
;
int
ret
,
err
,
new
;
unsigned
long
ptr
,
phys
;
unsigned
long
ptr
,
phys
;
...
@@ -483,8 +483,8 @@ void ufs_read_inode (struct inode * inode)
...
@@ -483,8 +483,8 @@ void ufs_read_inode (struct inode * inode)
UFSD
((
"ENTER, ino %lu
\n
"
,
inode
->
i_ino
))
UFSD
((
"ENTER, ino %lu
\n
"
,
inode
->
i_ino
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
flags
=
sb
->
u
.
ufs_sb
.
s_flags
;
flags
=
UFS_SB
(
sb
)
->
s_flags
;
if
(
inode
->
i_ino
<
UFS_ROOTINO
||
if
(
inode
->
i_ino
<
UFS_ROOTINO
||
inode
->
i_ino
>
(
uspi
->
s_ncg
*
uspi
->
s_ipg
))
{
inode
->
i_ino
>
(
uspi
->
s_ncg
*
uspi
->
s_ipg
))
{
...
@@ -579,8 +579,8 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
...
@@ -579,8 +579,8 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
UFSD
((
"ENTER, ino %lu
\n
"
,
inode
->
i_ino
))
UFSD
((
"ENTER, ino %lu
\n
"
,
inode
->
i_ino
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
flags
=
sb
->
u
.
ufs_sb
.
s_flags
;
flags
=
UFS_SB
(
sb
)
->
s_flags
;
if
(
inode
->
i_ino
<
UFS_ROOTINO
||
if
(
inode
->
i_ino
<
UFS_ROOTINO
||
inode
->
i_ino
>
(
uspi
->
s_ncg
*
uspi
->
s_ipg
))
{
inode
->
i_ino
>
(
uspi
->
s_ncg
*
uspi
->
s_ipg
))
{
...
...
fs/ufs/namei.c
View file @
136b6223
...
@@ -139,7 +139,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
...
@@ -139,7 +139,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
if
(
IS_ERR
(
inode
))
if
(
IS_ERR
(
inode
))
goto
out
;
goto
out
;
if
(
l
>
sb
->
u
.
ufs_sb
.
s_uspi
->
s_maxsymlinklen
)
{
if
(
l
>
UFS_SB
(
sb
)
->
s_uspi
->
s_maxsymlinklen
)
{
/* slow symlink */
/* slow symlink */
inode
->
i_op
=
&
page_symlink_inode_operations
;
inode
->
i_op
=
&
page_symlink_inode_operations
;
inode
->
i_mapping
->
a_ops
=
&
ufs_aops
;
inode
->
i_mapping
->
a_ops
=
&
ufs_aops
;
...
...
fs/ufs/super.c
View file @
136b6223
...
@@ -189,7 +189,7 @@ void ufs_error (struct super_block * sb, const char * function,
...
@@ -189,7 +189,7 @@ void ufs_error (struct super_block * sb, const char * function,
struct
ufs_super_block_first
*
usb1
;
struct
ufs_super_block_first
*
usb1
;
va_list
args
;
va_list
args
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
))
{
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
))
{
...
@@ -201,7 +201,7 @@ void ufs_error (struct super_block * sb, const char * function,
...
@@ -201,7 +201,7 @@ void ufs_error (struct super_block * sb, const char * function,
va_start
(
args
,
fmt
);
va_start
(
args
,
fmt
);
vsprintf
(
error_buf
,
fmt
,
args
);
vsprintf
(
error_buf
,
fmt
,
args
);
va_end
(
args
);
va_end
(
args
);
switch
(
sb
->
u
.
ufs_sb
.
s_mount_opt
&
UFS_MOUNT_ONERROR
)
{
switch
(
UFS_SB
(
sb
)
->
s_mount_opt
&
UFS_MOUNT_ONERROR
)
{
case
UFS_MOUNT_ONERROR_PANIC
:
case
UFS_MOUNT_ONERROR_PANIC
:
panic
(
"UFS-fs panic (device %s): %s: %s
\n
"
,
panic
(
"UFS-fs panic (device %s): %s: %s
\n
"
,
sb
->
s_id
,
function
,
error_buf
);
sb
->
s_id
,
function
,
error_buf
);
...
@@ -221,7 +221,7 @@ void ufs_panic (struct super_block * sb, const char * function,
...
@@ -221,7 +221,7 @@ void ufs_panic (struct super_block * sb, const char * function,
struct
ufs_super_block_first
*
usb1
;
struct
ufs_super_block_first
*
usb1
;
va_list
args
;
va_list
args
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
))
{
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
))
{
...
@@ -317,6 +317,7 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
...
@@ -317,6 +317,7 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
* Read on-disk structures associated with cylinder groups
* Read on-disk structures associated with cylinder groups
*/
*/
int
ufs_read_cylinder_structures
(
struct
super_block
*
sb
)
{
int
ufs_read_cylinder_structures
(
struct
super_block
*
sb
)
{
struct
ufs_sb_info
*
sbi
=
UFS_SB
(
sb
);
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_buffer_head
*
ubh
;
struct
ufs_buffer_head
*
ubh
;
unsigned
char
*
base
,
*
space
;
unsigned
char
*
base
,
*
space
;
...
@@ -324,7 +325,7 @@ int ufs_read_cylinder_structures (struct super_block * sb) {
...
@@ -324,7 +325,7 @@ int ufs_read_cylinder_structures (struct super_block * sb) {
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
sb
i
->
s_uspi
;
/*
/*
* Read cs structures from (usually) first data block
* Read cs structures from (usually) first data block
...
@@ -343,7 +344,7 @@ int ufs_read_cylinder_structures (struct super_block * sb) {
...
@@ -343,7 +344,7 @@ int ufs_read_cylinder_structures (struct super_block * sb) {
if
(
!
ubh
)
if
(
!
ubh
)
goto
failed
;
goto
failed
;
ubh_ubhcpymem
(
space
,
ubh
,
size
);
ubh_ubhcpymem
(
space
,
ubh
,
size
);
sb
->
u
.
ufs_sb
.
s_csp
[
ufs_fragstoblks
(
i
)]
=
(
struct
ufs_csum
*
)
space
;
sb
i
->
s_csp
[
ufs_fragstoblks
(
i
)]
=
(
struct
ufs_csum
*
)
space
;
space
+=
size
;
space
+=
size
;
ubh_brelse
(
ubh
);
ubh_brelse
(
ubh
);
ubh
=
NULL
;
ubh
=
NULL
;
...
@@ -353,41 +354,41 @@ int ufs_read_cylinder_structures (struct super_block * sb) {
...
@@ -353,41 +354,41 @@ int ufs_read_cylinder_structures (struct super_block * sb) {
* Read cylinder group (we read only first fragment from block
* Read cylinder group (we read only first fragment from block
* at this time) and prepare internal data structures for cg caching.
* at this time) and prepare internal data structures for cg caching.
*/
*/
if
(
!
(
sb
->
u
.
ufs_sb
.
s_ucg
=
kmalloc
(
sizeof
(
struct
buffer_head
*
)
*
uspi
->
s_ncg
,
GFP_KERNEL
)))
if
(
!
(
sb
i
->
s_ucg
=
kmalloc
(
sizeof
(
struct
buffer_head
*
)
*
uspi
->
s_ncg
,
GFP_KERNEL
)))
goto
failed
;
goto
failed
;
for
(
i
=
0
;
i
<
uspi
->
s_ncg
;
i
++
)
for
(
i
=
0
;
i
<
uspi
->
s_ncg
;
i
++
)
sb
->
u
.
ufs_sb
.
s_ucg
[
i
]
=
NULL
;
sb
i
->
s_ucg
[
i
]
=
NULL
;
for
(
i
=
0
;
i
<
UFS_MAX_GROUP_LOADED
;
i
++
)
{
for
(
i
=
0
;
i
<
UFS_MAX_GROUP_LOADED
;
i
++
)
{
sb
->
u
.
ufs_sb
.
s_ucpi
[
i
]
=
NULL
;
sb
i
->
s_ucpi
[
i
]
=
NULL
;
sb
->
u
.
ufs_sb
.
s_cgno
[
i
]
=
UFS_CGNO_EMPTY
;
sb
i
->
s_cgno
[
i
]
=
UFS_CGNO_EMPTY
;
}
}
for
(
i
=
0
;
i
<
uspi
->
s_ncg
;
i
++
)
{
for
(
i
=
0
;
i
<
uspi
->
s_ncg
;
i
++
)
{
UFSD
((
"read cg %u
\n
"
,
i
))
UFSD
((
"read cg %u
\n
"
,
i
))
if
(
!
(
sb
->
u
.
ufs_sb
.
s_ucg
[
i
]
=
sb_bread
(
sb
,
ufs_cgcmin
(
i
))))
if
(
!
(
sb
i
->
s_ucg
[
i
]
=
sb_bread
(
sb
,
ufs_cgcmin
(
i
))))
goto
failed
;
goto
failed
;
if
(
!
ufs_cg_chkmagic
(
sb
,
(
struct
ufs_cylinder_group
*
)
sb
->
u
.
ufs_sb
.
s_ucg
[
i
]
->
b_data
))
if
(
!
ufs_cg_chkmagic
(
sb
,
(
struct
ufs_cylinder_group
*
)
sb
i
->
s_ucg
[
i
]
->
b_data
))
goto
failed
;
goto
failed
;
#ifdef UFS_SUPER_DEBUG_MORE
#ifdef UFS_SUPER_DEBUG_MORE
ufs_print_cylinder_stuff
(
sb
,
(
struct
ufs_cylinder_group
*
)
sb
->
u
.
ufs_sb
.
s_ucg
[
i
]
->
b_data
);
ufs_print_cylinder_stuff
(
sb
,
(
struct
ufs_cylinder_group
*
)
sb
i
->
s_ucg
[
i
]
->
b_data
);
#endif
#endif
}
}
for
(
i
=
0
;
i
<
UFS_MAX_GROUP_LOADED
;
i
++
)
{
for
(
i
=
0
;
i
<
UFS_MAX_GROUP_LOADED
;
i
++
)
{
if
(
!
(
sb
->
u
.
ufs_sb
.
s_ucpi
[
i
]
=
kmalloc
(
sizeof
(
struct
ufs_cg_private_info
),
GFP_KERNEL
)))
if
(
!
(
sb
i
->
s_ucpi
[
i
]
=
kmalloc
(
sizeof
(
struct
ufs_cg_private_info
),
GFP_KERNEL
)))
goto
failed
;
goto
failed
;
sb
->
u
.
ufs_sb
.
s_cgno
[
i
]
=
UFS_CGNO_EMPTY
;
sb
i
->
s_cgno
[
i
]
=
UFS_CGNO_EMPTY
;
}
}
sb
->
u
.
ufs_sb
.
s_cg_loaded
=
0
;
sb
i
->
s_cg_loaded
=
0
;
UFSD
((
"EXIT
\n
"
))
UFSD
((
"EXIT
\n
"
))
return
1
;
return
1
;
failed:
failed:
if
(
base
)
kfree
(
base
);
if
(
base
)
kfree
(
base
);
if
(
sb
->
u
.
ufs_sb
.
s_ucg
)
{
if
(
sb
i
->
s_ucg
)
{
for
(
i
=
0
;
i
<
uspi
->
s_ncg
;
i
++
)
for
(
i
=
0
;
i
<
uspi
->
s_ncg
;
i
++
)
if
(
sb
->
u
.
ufs_sb
.
s_ucg
[
i
])
brelse
(
sb
->
u
.
ufs_sb
.
s_ucg
[
i
]);
if
(
sb
i
->
s_ucg
[
i
])
brelse
(
sbi
->
s_ucg
[
i
]);
kfree
(
sb
->
u
.
ufs_sb
.
s_ucg
);
kfree
(
sb
i
->
s_ucg
);
for
(
i
=
0
;
i
<
UFS_MAX_GROUP_LOADED
;
i
++
)
for
(
i
=
0
;
i
<
UFS_MAX_GROUP_LOADED
;
i
++
)
if
(
sb
->
u
.
ufs_sb
.
s_ucpi
[
i
])
kfree
(
sb
->
u
.
ufs_sb
.
s_ucpi
[
i
]);
if
(
sb
i
->
s_ucpi
[
i
])
kfree
(
sbi
->
s_ucpi
[
i
]);
}
}
UFSD
((
"EXIT (FAILED)
\n
"
))
UFSD
((
"EXIT (FAILED)
\n
"
))
return
0
;
return
0
;
...
@@ -398,6 +399,7 @@ int ufs_read_cylinder_structures (struct super_block * sb) {
...
@@ -398,6 +399,7 @@ int ufs_read_cylinder_structures (struct super_block * sb) {
* write them back to disk
* write them back to disk
*/
*/
void
ufs_put_cylinder_structures
(
struct
super_block
*
sb
)
{
void
ufs_put_cylinder_structures
(
struct
super_block
*
sb
)
{
struct
ufs_sb_info
*
sbi
=
UFS_SB
(
sb
);
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_buffer_head
*
ubh
;
struct
ufs_buffer_head
*
ubh
;
unsigned
char
*
base
,
*
space
;
unsigned
char
*
base
,
*
space
;
...
@@ -405,11 +407,11 @@ void ufs_put_cylinder_structures (struct super_block * sb) {
...
@@ -405,11 +407,11 @@ void ufs_put_cylinder_structures (struct super_block * sb) {
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
sb
i
->
s_uspi
;
size
=
uspi
->
s_cssize
;
size
=
uspi
->
s_cssize
;
blks
=
(
size
+
uspi
->
s_fsize
-
1
)
>>
uspi
->
s_fshift
;
blks
=
(
size
+
uspi
->
s_fsize
-
1
)
>>
uspi
->
s_fshift
;
base
=
space
=
(
char
*
)
sb
->
u
.
ufs_sb
.
s_csp
[
0
];
base
=
space
=
(
char
*
)
sb
i
->
s_csp
[
0
];
for
(
i
=
0
;
i
<
blks
;
i
+=
uspi
->
s_fpb
)
{
for
(
i
=
0
;
i
<
blks
;
i
+=
uspi
->
s_fpb
)
{
size
=
uspi
->
s_bsize
;
size
=
uspi
->
s_bsize
;
if
(
i
+
uspi
->
s_fpb
>
blks
)
if
(
i
+
uspi
->
s_fpb
>
blks
)
...
@@ -421,21 +423,22 @@ void ufs_put_cylinder_structures (struct super_block * sb) {
...
@@ -421,21 +423,22 @@ void ufs_put_cylinder_structures (struct super_block * sb) {
ubh_mark_buffer_dirty
(
ubh
);
ubh_mark_buffer_dirty
(
ubh
);
ubh_brelse
(
ubh
);
ubh_brelse
(
ubh
);
}
}
for
(
i
=
0
;
i
<
sb
->
u
.
ufs_sb
.
s_cg_loaded
;
i
++
)
{
for
(
i
=
0
;
i
<
sb
i
->
s_cg_loaded
;
i
++
)
{
ufs_put_cylinder
(
sb
,
i
);
ufs_put_cylinder
(
sb
,
i
);
kfree
(
sb
->
u
.
ufs_sb
.
s_ucpi
[
i
]);
kfree
(
sb
i
->
s_ucpi
[
i
]);
}
}
for
(;
i
<
UFS_MAX_GROUP_LOADED
;
i
++
)
for
(;
i
<
UFS_MAX_GROUP_LOADED
;
i
++
)
kfree
(
sb
->
u
.
ufs_sb
.
s_ucpi
[
i
]);
kfree
(
sb
i
->
s_ucpi
[
i
]);
for
(
i
=
0
;
i
<
uspi
->
s_ncg
;
i
++
)
for
(
i
=
0
;
i
<
uspi
->
s_ncg
;
i
++
)
brelse
(
sb
->
u
.
ufs_sb
.
s_ucg
[
i
]);
brelse
(
sb
i
->
s_ucg
[
i
]);
kfree
(
sb
->
u
.
ufs_sb
.
s_ucg
);
kfree
(
sb
i
->
s_ucg
);
kfree
(
base
);
kfree
(
base
);
UFSD
((
"EXIT
\n
"
))
UFSD
((
"EXIT
\n
"
))
}
}
static
int
ufs_fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
silent
)
static
int
ufs_fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
silent
)
{
{
struct
ufs_sb_info
*
sbi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_super_block_first
*
usb1
;
struct
ufs_super_block_first
*
usb1
;
struct
ufs_super_block_second
*
usb2
;
struct
ufs_super_block_second
*
usb2
;
...
@@ -451,6 +454,12 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -451,6 +454,12 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
sbi
=
kmalloc
(
sizeof
(
struct
ufs_sb_info
),
GFP_KERNEL
);
if
(
!
sbi
)
goto
failed_nomem
;
sb
->
u
.
generic_sbp
=
sbi
;
memset
(
sbi
,
0
,
sizeof
(
struct
ufs_sb_info
));
UFSD
((
"flag %u
\n
"
,
(
int
)(
sb
->
s_flags
&
MS_RDONLY
)))
UFSD
((
"flag %u
\n
"
,
(
int
)(
sb
->
s_flags
&
MS_RDONLY
)))
#ifndef CONFIG_UFS_FS_WRITE
#ifndef CONFIG_UFS_FS_WRITE
...
@@ -464,22 +473,22 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -464,22 +473,22 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
* Set default mount options
* Set default mount options
* Parse mount options
* Parse mount options
*/
*/
sb
->
u
.
ufs_sb
.
s_mount_opt
=
0
;
sb
i
->
s_mount_opt
=
0
;
ufs_set_opt
(
sb
->
u
.
ufs_sb
.
s_mount_opt
,
ONERROR_LOCK
);
ufs_set_opt
(
sb
i
->
s_mount_opt
,
ONERROR_LOCK
);
if
(
!
ufs_parse_options
((
char
*
)
data
,
&
sb
->
u
.
ufs_sb
.
s_mount_opt
))
{
if
(
!
ufs_parse_options
((
char
*
)
data
,
&
sb
i
->
s_mount_opt
))
{
printk
(
"wrong mount options
\n
"
);
printk
(
"wrong mount options
\n
"
);
goto
failed
;
goto
failed
;
}
}
if
(
!
(
sb
->
u
.
ufs_sb
.
s_mount_opt
&
UFS_MOUNT_UFSTYPE
))
{
if
(
!
(
sb
i
->
s_mount_opt
&
UFS_MOUNT_UFSTYPE
))
{
printk
(
"You didn't specify the type of your ufs filesystem
\n\n
"
printk
(
"You didn't specify the type of your ufs filesystem
\n\n
"
"mount -t ufs -o ufstype="
"mount -t ufs -o ufstype="
"sun|sunx86|44bsd|old|hp|nextstep|netxstep-cd|openstep ...
\n\n
"
"sun|sunx86|44bsd|old|hp|nextstep|netxstep-cd|openstep ...
\n\n
"
">>>WARNING<<< Wrong ufstype may corrupt your filesystem, "
">>>WARNING<<< Wrong ufstype may corrupt your filesystem, "
"default is ufstype=old
\n
"
);
"default is ufstype=old
\n
"
);
ufs_set_opt
(
sb
->
u
.
ufs_sb
.
s_mount_opt
,
UFSTYPE_OLD
);
ufs_set_opt
(
sb
i
->
s_mount_opt
,
UFSTYPE_OLD
);
}
}
sb
->
u
.
ufs_sb
.
s_uspi
=
uspi
=
sb
i
->
s_uspi
=
uspi
=
kmalloc
(
sizeof
(
struct
ufs_sb_private_info
),
GFP_KERNEL
);
kmalloc
(
sizeof
(
struct
ufs_sb_private_info
),
GFP_KERNEL
);
if
(
!
uspi
)
if
(
!
uspi
)
goto
failed
;
goto
failed
;
...
@@ -488,7 +497,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -488,7 +497,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
this but as I don't know which I'll let those in the know loosen
this but as I don't know which I'll let those in the know loosen
the rules */
the rules */
switch
(
sb
->
u
.
ufs_sb
.
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
{
switch
(
sb
i
->
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
{
case
UFS_MOUNT_UFSTYPE_44BSD
:
case
UFS_MOUNT_UFSTYPE_44BSD
:
UFSD
((
"ufstype=44bsd
\n
"
))
UFSD
((
"ufstype=44bsd
\n
"
))
uspi
->
s_fsize
=
block_size
=
512
;
uspi
->
s_fsize
=
block_size
=
512
;
...
@@ -596,7 +605,10 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -596,7 +605,10 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
}
}
again:
again:
sb_set_blocksize
(
sb
,
block_size
);
if
(
sb_set_blocksize
(
sb
,
block_size
))
{
printk
(
KERN_ERR
"UFS: failed to set blocksize
\n
"
);
goto
failed
;
}
/*
/*
* read ufs super block from device
* read ufs super block from device
...
@@ -617,7 +629,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -617,7 +629,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
case
UFS_MAGIC_LFN
:
case
UFS_MAGIC_LFN
:
case
UFS_MAGIC_FEA
:
case
UFS_MAGIC_FEA
:
case
UFS_MAGIC_4GB
:
case
UFS_MAGIC_4GB
:
sb
->
u
.
ufs_sb
.
s_bytesex
=
BYTESEX_LE
;
sb
i
->
s_bytesex
=
BYTESEX_LE
;
goto
magic_found
;
goto
magic_found
;
}
}
switch
(
__constant_be32_to_cpu
(
usb3
->
fs_magic
))
{
switch
(
__constant_be32_to_cpu
(
usb3
->
fs_magic
))
{
...
@@ -625,13 +637,13 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -625,13 +637,13 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
case
UFS_MAGIC_LFN
:
case
UFS_MAGIC_LFN
:
case
UFS_MAGIC_FEA
:
case
UFS_MAGIC_FEA
:
case
UFS_MAGIC_4GB
:
case
UFS_MAGIC_4GB
:
sb
->
u
.
ufs_sb
.
s_bytesex
=
BYTESEX_BE
;
sb
i
->
s_bytesex
=
BYTESEX_BE
;
goto
magic_found
;
goto
magic_found
;
}
}
if
((((
sb
->
u
.
ufs_sb
.
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
==
UFS_MOUNT_UFSTYPE_NEXTSTEP
)
if
((((
sb
i
->
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
==
UFS_MOUNT_UFSTYPE_NEXTSTEP
)
||
((
sb
->
u
.
ufs_sb
.
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
==
UFS_MOUNT_UFSTYPE_NEXTSTEP_CD
)
||
((
sb
i
->
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
==
UFS_MOUNT_UFSTYPE_NEXTSTEP_CD
)
||
((
sb
->
u
.
ufs_sb
.
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
==
UFS_MOUNT_UFSTYPE_OPENSTEP
))
||
((
sb
i
->
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
==
UFS_MOUNT_UFSTYPE_OPENSTEP
))
&&
uspi
->
s_sbbase
<
256
)
{
&&
uspi
->
s_sbbase
<
256
)
{
ubh_brelse_uspi
(
uspi
);
ubh_brelse_uspi
(
uspi
);
ubh
=
NULL
;
ubh
=
NULL
;
...
@@ -652,32 +664,32 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -652,32 +664,32 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
uspi
->
s_fshift
=
fs32_to_cpu
(
sb
,
usb1
->
fs_fshift
);
uspi
->
s_fshift
=
fs32_to_cpu
(
sb
,
usb1
->
fs_fshift
);
if
(
uspi
->
s_fsize
&
(
uspi
->
s_fsize
-
1
))
{
if
(
uspi
->
s_fsize
&
(
uspi
->
s_fsize
-
1
))
{
printk
(
"ufs_read_super: fragment size %u is not a power of 2
\n
"
,
printk
(
KERN_ERR
"ufs_read_super: fragment size %u is not a power of 2
\n
"
,
uspi
->
s_fsize
);
uspi
->
s_fsize
);
goto
failed
;
goto
failed
;
}
}
if
(
uspi
->
s_fsize
<
512
)
{
if
(
uspi
->
s_fsize
<
512
)
{
printk
(
"ufs_read_super: fragment size %u is too small
\n
"
,
printk
(
KERN_ERR
"ufs_read_super: fragment size %u is too small
\n
"
,
uspi
->
s_fsize
);
uspi
->
s_fsize
);
goto
failed
;
goto
failed
;
}
}
if
(
uspi
->
s_fsize
>
4096
)
{
if
(
uspi
->
s_fsize
>
4096
)
{
printk
(
"ufs_read_super: fragment size %u is too large
\n
"
,
printk
(
KERN_ERR
"ufs_read_super: fragment size %u is too large
\n
"
,
uspi
->
s_fsize
);
uspi
->
s_fsize
);
goto
failed
;
goto
failed
;
}
}
if
(
uspi
->
s_bsize
&
(
uspi
->
s_bsize
-
1
))
{
if
(
uspi
->
s_bsize
&
(
uspi
->
s_bsize
-
1
))
{
printk
(
"ufs_read_super: block size %u is not a power of 2
\n
"
,
printk
(
KERN_ERR
"ufs_read_super: block size %u is not a power of 2
\n
"
,
uspi
->
s_bsize
);
uspi
->
s_bsize
);
goto
failed
;
goto
failed
;
}
}
if
(
uspi
->
s_bsize
<
4096
)
{
if
(
uspi
->
s_bsize
<
4096
)
{
printk
(
"ufs_read_super: block size %u is too small
\n
"
,
printk
(
KERN_ERR
"ufs_read_super: block size %u is too small
\n
"
,
uspi
->
s_bsize
);
uspi
->
s_bsize
);
goto
failed
;
goto
failed
;
}
}
if
(
uspi
->
s_bsize
/
uspi
->
s_fsize
>
8
)
{
if
(
uspi
->
s_bsize
/
uspi
->
s_fsize
>
8
)
{
printk
(
"ufs_read_super: too many fragments per block (%u)
\n
"
,
printk
(
KERN_ERR
"ufs_read_super: too many fragments per block (%u)
\n
"
,
uspi
->
s_bsize
/
uspi
->
s_fsize
);
uspi
->
s_bsize
/
uspi
->
s_fsize
);
goto
failed
;
goto
failed
;
}
}
...
@@ -801,12 +813,12 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -801,12 +813,12 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
uspi
->
s_bpf
=
uspi
->
s_fsize
<<
3
;
uspi
->
s_bpf
=
uspi
->
s_fsize
<<
3
;
uspi
->
s_bpfshift
=
uspi
->
s_fshift
+
3
;
uspi
->
s_bpfshift
=
uspi
->
s_fshift
+
3
;
uspi
->
s_bpfmask
=
uspi
->
s_bpf
-
1
;
uspi
->
s_bpfmask
=
uspi
->
s_bpf
-
1
;
if
((
sb
->
u
.
ufs_sb
.
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
==
if
((
sb
i
->
s_mount_opt
&
UFS_MOUNT_UFSTYPE
)
==
UFS_MOUNT_UFSTYPE_44BSD
)
UFS_MOUNT_UFSTYPE_44BSD
)
uspi
->
s_maxsymlinklen
=
uspi
->
s_maxsymlinklen
=
fs32_to_cpu
(
sb
,
usb3
->
fs_u2
.
fs_44
.
fs_maxsymlinklen
);
fs32_to_cpu
(
sb
,
usb3
->
fs_u2
.
fs_44
.
fs_maxsymlinklen
);
sb
->
u
.
ufs_sb
.
s_flags
=
flags
;
sb
i
->
s_flags
=
flags
;
inode
=
iget
(
sb
,
UFS_ROOTINO
);
inode
=
iget
(
sb
,
UFS_ROOTINO
);
if
(
!
inode
||
is_bad_inode
(
inode
))
if
(
!
inode
||
is_bad_inode
(
inode
))
...
@@ -831,8 +843,14 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -831,8 +843,14 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
failed:
failed:
if
(
ubh
)
ubh_brelse_uspi
(
uspi
);
if
(
ubh
)
ubh_brelse_uspi
(
uspi
);
if
(
uspi
)
kfree
(
uspi
);
if
(
uspi
)
kfree
(
uspi
);
if
(
sbi
)
kfree
(
sbi
);
sb
->
u
.
generic_sbp
=
NULL
;
UFSD
((
"EXIT (FAILED)
\n
"
))
UFSD
((
"EXIT (FAILED)
\n
"
))
return
-
EINVAL
;
return
-
EINVAL
;
failed_nomem:
UFSD
((
"EXIT (NOMEM)
\n
"
))
return
-
ENOMEM
;
}
}
void
ufs_write_super
(
struct
super_block
*
sb
)
{
void
ufs_write_super
(
struct
super_block
*
sb
)
{
...
@@ -844,8 +862,8 @@ void ufs_write_super (struct super_block * sb) {
...
@@ -844,8 +862,8 @@ void ufs_write_super (struct super_block * sb) {
lock_kernel
();
lock_kernel
();
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
flags
=
sb
->
u
.
ufs_sb
.
s_flags
;
flags
=
UFS_SB
(
sb
)
->
s_flags
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb3
=
ubh_get_usb_third
(
USPI_UBH
);
usb3
=
ubh_get_usb_third
(
USPI_UBH
);
...
@@ -864,17 +882,17 @@ void ufs_write_super (struct super_block * sb) {
...
@@ -864,17 +882,17 @@ void ufs_write_super (struct super_block * sb) {
void
ufs_put_super
(
struct
super_block
*
sb
)
void
ufs_put_super
(
struct
super_block
*
sb
)
{
{
struct
ufs_sb_
private_info
*
uspi
;
struct
ufs_sb_
info
*
sbi
=
UFS_SB
(
sb
)
;
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
))
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
))
ufs_put_cylinder_structures
(
sb
);
ufs_put_cylinder_structures
(
sb
);
ubh_brelse_uspi
(
uspi
);
ubh_brelse_uspi
(
sbi
->
s_uspi
);
kfree
(
sb
->
u
.
ufs_sb
.
s_uspi
);
kfree
(
sbi
->
s_uspi
);
kfree
(
sbi
);
sb
->
u
.
generic_sbp
=
NULL
;
return
;
return
;
}
}
...
@@ -887,8 +905,8 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data)
...
@@ -887,8 +905,8 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data)
unsigned
new_mount_opt
,
ufstype
;
unsigned
new_mount_opt
,
ufstype
;
unsigned
flags
;
unsigned
flags
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
flags
=
sb
->
u
.
ufs_sb
.
s_flags
;
flags
=
UFS_SB
(
sb
)
->
s_flags
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb3
=
ubh_get_usb_third
(
USPI_UBH
);
usb3
=
ubh_get_usb_third
(
USPI_UBH
);
...
@@ -896,7 +914,7 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data)
...
@@ -896,7 +914,7 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data)
* Allow the "check" option to be passed as a remount option.
* Allow the "check" option to be passed as a remount option.
* It is not possible to change ufstype option during remount
* It is not possible to change ufstype option during remount
*/
*/
ufstype
=
sb
->
u
.
ufs_sb
.
s_mount_opt
&
UFS_MOUNT_UFSTYPE
;
ufstype
=
UFS_SB
(
sb
)
->
s_mount_opt
&
UFS_MOUNT_UFSTYPE
;
new_mount_opt
=
0
;
new_mount_opt
=
0
;
ufs_set_opt
(
new_mount_opt
,
ONERROR_LOCK
);
ufs_set_opt
(
new_mount_opt
,
ONERROR_LOCK
);
if
(
!
ufs_parse_options
(
data
,
&
new_mount_opt
))
if
(
!
ufs_parse_options
(
data
,
&
new_mount_opt
))
...
@@ -910,7 +928,7 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data)
...
@@ -910,7 +928,7 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data)
}
}
if
((
*
mount_flags
&
MS_RDONLY
)
==
(
sb
->
s_flags
&
MS_RDONLY
))
{
if
((
*
mount_flags
&
MS_RDONLY
)
==
(
sb
->
s_flags
&
MS_RDONLY
))
{
sb
->
u
.
ufs_sb
.
s_mount_opt
=
new_mount_opt
;
UFS_SB
(
sb
)
->
s_mount_opt
=
new_mount_opt
;
return
0
;
return
0
;
}
}
...
@@ -950,7 +968,7 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data)
...
@@ -950,7 +968,7 @@ int ufs_remount (struct super_block * sb, int * mount_flags, char * data)
sb
->
s_flags
&=
~
MS_RDONLY
;
sb
->
s_flags
&=
~
MS_RDONLY
;
#endif
#endif
}
}
sb
->
u
.
ufs_sb
.
s_mount_opt
=
new_mount_opt
;
UFS_SB
(
sb
)
->
s_mount_opt
=
new_mount_opt
;
return
0
;
return
0
;
}
}
...
@@ -961,7 +979,7 @@ int ufs_statfs (struct super_block * sb, struct statfs * buf)
...
@@ -961,7 +979,7 @@ int ufs_statfs (struct super_block * sb, struct statfs * buf)
lock_kernel
();
lock_kernel
();
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
usb1
=
ubh_get_usb_first
(
USPI_UBH
);
buf
->
f_type
=
UFS_MAGIC
;
buf
->
f_type
=
UFS_MAGIC
;
...
...
fs/ufs/swab.h
View file @
136b6223
...
@@ -25,7 +25,7 @@ enum {
...
@@ -25,7 +25,7 @@ enum {
static
__inline
u64
static
__inline
u64
fs64_to_cpu
(
struct
super_block
*
sbp
,
u64
n
)
fs64_to_cpu
(
struct
super_block
*
sbp
,
u64
n
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
le64_to_cpu
(
n
);
return
le64_to_cpu
(
n
);
else
else
return
be64_to_cpu
(
n
);
return
be64_to_cpu
(
n
);
...
@@ -34,7 +34,7 @@ fs64_to_cpu(struct super_block *sbp, u64 n)
...
@@ -34,7 +34,7 @@ fs64_to_cpu(struct super_block *sbp, u64 n)
static
__inline
u64
static
__inline
u64
cpu_to_fs64
(
struct
super_block
*
sbp
,
u64
n
)
cpu_to_fs64
(
struct
super_block
*
sbp
,
u64
n
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
cpu_to_le64
(
n
);
return
cpu_to_le64
(
n
);
else
else
return
cpu_to_be64
(
n
);
return
cpu_to_be64
(
n
);
...
@@ -43,7 +43,7 @@ cpu_to_fs64(struct super_block *sbp, u64 n)
...
@@ -43,7 +43,7 @@ cpu_to_fs64(struct super_block *sbp, u64 n)
static
__inline
u32
static
__inline
u32
fs64_add
(
struct
super_block
*
sbp
,
u32
*
n
,
int
d
)
fs64_add
(
struct
super_block
*
sbp
,
u32
*
n
,
int
d
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
*
n
=
cpu_to_le64
(
le64_to_cpu
(
*
n
)
+
d
);
return
*
n
=
cpu_to_le64
(
le64_to_cpu
(
*
n
)
+
d
);
else
else
return
*
n
=
cpu_to_be64
(
be64_to_cpu
(
*
n
)
+
d
);
return
*
n
=
cpu_to_be64
(
be64_to_cpu
(
*
n
)
+
d
);
...
@@ -52,7 +52,7 @@ fs64_add(struct super_block *sbp, u32 *n, int d)
...
@@ -52,7 +52,7 @@ fs64_add(struct super_block *sbp, u32 *n, int d)
static
__inline
u32
static
__inline
u32
fs64_sub
(
struct
super_block
*
sbp
,
u32
*
n
,
int
d
)
fs64_sub
(
struct
super_block
*
sbp
,
u32
*
n
,
int
d
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
*
n
=
cpu_to_le64
(
le64_to_cpu
(
*
n
)
-
d
);
return
*
n
=
cpu_to_le64
(
le64_to_cpu
(
*
n
)
-
d
);
else
else
return
*
n
=
cpu_to_be64
(
be64_to_cpu
(
*
n
)
-
d
);
return
*
n
=
cpu_to_be64
(
be64_to_cpu
(
*
n
)
-
d
);
...
@@ -61,7 +61,7 @@ fs64_sub(struct super_block *sbp, u32 *n, int d)
...
@@ -61,7 +61,7 @@ fs64_sub(struct super_block *sbp, u32 *n, int d)
static
__inline
u32
static
__inline
u32
fs32_to_cpu
(
struct
super_block
*
sbp
,
u32
n
)
fs32_to_cpu
(
struct
super_block
*
sbp
,
u32
n
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
le32_to_cpu
(
n
);
return
le32_to_cpu
(
n
);
else
else
return
be32_to_cpu
(
n
);
return
be32_to_cpu
(
n
);
...
@@ -70,7 +70,7 @@ fs32_to_cpu(struct super_block *sbp, u32 n)
...
@@ -70,7 +70,7 @@ fs32_to_cpu(struct super_block *sbp, u32 n)
static
__inline
u32
static
__inline
u32
cpu_to_fs32
(
struct
super_block
*
sbp
,
u32
n
)
cpu_to_fs32
(
struct
super_block
*
sbp
,
u32
n
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
cpu_to_le32
(
n
);
return
cpu_to_le32
(
n
);
else
else
return
cpu_to_be32
(
n
);
return
cpu_to_be32
(
n
);
...
@@ -79,7 +79,7 @@ cpu_to_fs32(struct super_block *sbp, u32 n)
...
@@ -79,7 +79,7 @@ cpu_to_fs32(struct super_block *sbp, u32 n)
static
__inline
u32
static
__inline
u32
fs32_add
(
struct
super_block
*
sbp
,
u32
*
n
,
int
d
)
fs32_add
(
struct
super_block
*
sbp
,
u32
*
n
,
int
d
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
*
n
=
cpu_to_le32
(
le32_to_cpu
(
*
n
)
+
d
);
return
*
n
=
cpu_to_le32
(
le32_to_cpu
(
*
n
)
+
d
);
else
else
return
*
n
=
cpu_to_be32
(
be32_to_cpu
(
*
n
)
+
d
);
return
*
n
=
cpu_to_be32
(
be32_to_cpu
(
*
n
)
+
d
);
...
@@ -88,7 +88,7 @@ fs32_add(struct super_block *sbp, u32 *n, int d)
...
@@ -88,7 +88,7 @@ fs32_add(struct super_block *sbp, u32 *n, int d)
static
__inline
u32
static
__inline
u32
fs32_sub
(
struct
super_block
*
sbp
,
u32
*
n
,
int
d
)
fs32_sub
(
struct
super_block
*
sbp
,
u32
*
n
,
int
d
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
*
n
=
cpu_to_le32
(
le32_to_cpu
(
*
n
)
-
d
);
return
*
n
=
cpu_to_le32
(
le32_to_cpu
(
*
n
)
-
d
);
else
else
return
*
n
=
cpu_to_be32
(
be32_to_cpu
(
*
n
)
-
d
);
return
*
n
=
cpu_to_be32
(
be32_to_cpu
(
*
n
)
-
d
);
...
@@ -97,7 +97,7 @@ fs32_sub(struct super_block *sbp, u32 *n, int d)
...
@@ -97,7 +97,7 @@ fs32_sub(struct super_block *sbp, u32 *n, int d)
static
__inline
u16
static
__inline
u16
fs16_to_cpu
(
struct
super_block
*
sbp
,
u16
n
)
fs16_to_cpu
(
struct
super_block
*
sbp
,
u16
n
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
le16_to_cpu
(
n
);
return
le16_to_cpu
(
n
);
else
else
return
be16_to_cpu
(
n
);
return
be16_to_cpu
(
n
);
...
@@ -106,7 +106,7 @@ fs16_to_cpu(struct super_block *sbp, u16 n)
...
@@ -106,7 +106,7 @@ fs16_to_cpu(struct super_block *sbp, u16 n)
static
__inline
u16
static
__inline
u16
cpu_to_fs16
(
struct
super_block
*
sbp
,
u16
n
)
cpu_to_fs16
(
struct
super_block
*
sbp
,
u16
n
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
cpu_to_le16
(
n
);
return
cpu_to_le16
(
n
);
else
else
return
cpu_to_be16
(
n
);
return
cpu_to_be16
(
n
);
...
@@ -115,7 +115,7 @@ cpu_to_fs16(struct super_block *sbp, u16 n)
...
@@ -115,7 +115,7 @@ cpu_to_fs16(struct super_block *sbp, u16 n)
static
__inline
u16
static
__inline
u16
fs16_add
(
struct
super_block
*
sbp
,
u16
*
n
,
int
d
)
fs16_add
(
struct
super_block
*
sbp
,
u16
*
n
,
int
d
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
*
n
=
cpu_to_le16
(
le16_to_cpu
(
*
n
)
+
d
);
return
*
n
=
cpu_to_le16
(
le16_to_cpu
(
*
n
)
+
d
);
else
else
return
*
n
=
cpu_to_be16
(
be16_to_cpu
(
*
n
)
+
d
);
return
*
n
=
cpu_to_be16
(
be16_to_cpu
(
*
n
)
+
d
);
...
@@ -124,7 +124,7 @@ fs16_add(struct super_block *sbp, u16 *n, int d)
...
@@ -124,7 +124,7 @@ fs16_add(struct super_block *sbp, u16 *n, int d)
static
__inline
u16
static
__inline
u16
fs16_sub
(
struct
super_block
*
sbp
,
u16
*
n
,
int
d
)
fs16_sub
(
struct
super_block
*
sbp
,
u16
*
n
,
int
d
)
{
{
if
(
sbp
->
u
.
ufs_sb
.
s_bytesex
==
BYTESEX_LE
)
if
(
UFS_SB
(
sbp
)
->
s_bytesex
==
BYTESEX_LE
)
return
*
n
=
cpu_to_le16
(
le16_to_cpu
(
*
n
)
-
d
);
return
*
n
=
cpu_to_le16
(
le16_to_cpu
(
*
n
)
-
d
);
else
else
return
*
n
=
cpu_to_be16
(
be16_to_cpu
(
*
n
)
-
d
);
return
*
n
=
cpu_to_be16
(
be16_to_cpu
(
*
n
)
-
d
);
...
...
fs/ufs/truncate.c
View file @
136b6223
...
@@ -82,7 +82,7 @@ static int ufs_trunc_direct (struct inode * inode)
...
@@ -82,7 +82,7 @@ static int ufs_trunc_direct (struct inode * inode)
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
frag_to_free
=
0
;
frag_to_free
=
0
;
free_count
=
0
;
free_count
=
0
;
...
@@ -212,7 +212,7 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, u32 * p)
...
@@ -212,7 +212,7 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, u32 * p)
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
frag_to_free
=
0
;
frag_to_free
=
0
;
free_count
=
0
;
free_count
=
0
;
...
@@ -306,7 +306,7 @@ static int ufs_trunc_dindirect (struct inode * inode, unsigned offset, u32 * p)
...
@@ -306,7 +306,7 @@ static int ufs_trunc_dindirect (struct inode * inode, unsigned offset, u32 * p)
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
dindirect_block
=
(
DIRECT_BLOCK
>
offset
)
dindirect_block
=
(
DIRECT_BLOCK
>
offset
)
?
((
DIRECT_BLOCK
-
offset
)
>>
uspi
->
s_apbshift
)
:
0
;
?
((
DIRECT_BLOCK
-
offset
)
>>
uspi
->
s_apbshift
)
:
0
;
...
@@ -374,7 +374,7 @@ static int ufs_trunc_tindirect (struct inode * inode)
...
@@ -374,7 +374,7 @@ static int ufs_trunc_tindirect (struct inode * inode)
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
retry
=
0
;
retry
=
0
;
tindirect_block
=
(
DIRECT_BLOCK
>
(
UFS_NDADDR
+
uspi
->
s_apb
+
uspi
->
s_2apb
))
tindirect_block
=
(
DIRECT_BLOCK
>
(
UFS_NDADDR
+
uspi
->
s_apb
+
uspi
->
s_2apb
))
...
@@ -435,7 +435,7 @@ void ufs_truncate (struct inode * inode)
...
@@ -435,7 +435,7 @@ void ufs_truncate (struct inode * inode)
UFSD
((
"ENTER
\n
"
))
UFSD
((
"ENTER
\n
"
))
sb
=
inode
->
i_sb
;
sb
=
inode
->
i_sb
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
if
(
!
(
S_ISREG
(
inode
->
i_mode
)
||
S_ISDIR
(
inode
->
i_mode
)
||
S_ISLNK
(
inode
->
i_mode
)))
if
(
!
(
S_ISREG
(
inode
->
i_mode
)
||
S_ISDIR
(
inode
->
i_mode
)
||
S_ISLNK
(
inode
->
i_mode
)))
return
;
return
;
...
...
fs/ufs/util.h
View file @
136b6223
...
@@ -31,7 +31,7 @@ static inline s32
...
@@ -31,7 +31,7 @@ static inline s32
ufs_get_fs_state
(
struct
super_block
*
sb
,
struct
ufs_super_block_first
*
usb1
,
ufs_get_fs_state
(
struct
super_block
*
sb
,
struct
ufs_super_block_first
*
usb1
,
struct
ufs_super_block_third
*
usb3
)
struct
ufs_super_block_third
*
usb3
)
{
{
switch
(
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_ST_MASK
)
{
switch
(
UFS_SB
(
sb
)
->
s_flags
&
UFS_ST_MASK
)
{
case
UFS_ST_SUN
:
case
UFS_ST_SUN
:
return
fs32_to_cpu
(
sb
,
usb3
->
fs_u2
.
fs_sun
.
fs_state
);
return
fs32_to_cpu
(
sb
,
usb3
->
fs_u2
.
fs_sun
.
fs_state
);
case
UFS_ST_SUNx86
:
case
UFS_ST_SUNx86
:
...
@@ -46,7 +46,7 @@ static inline void
...
@@ -46,7 +46,7 @@ static inline void
ufs_set_fs_state
(
struct
super_block
*
sb
,
struct
ufs_super_block_first
*
usb1
,
ufs_set_fs_state
(
struct
super_block
*
sb
,
struct
ufs_super_block_first
*
usb1
,
struct
ufs_super_block_third
*
usb3
,
s32
value
)
struct
ufs_super_block_third
*
usb3
,
s32
value
)
{
{
switch
(
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_ST_MASK
)
{
switch
(
UFS_SB
(
sb
)
->
s_flags
&
UFS_ST_MASK
)
{
case
UFS_ST_SUN
:
case
UFS_ST_SUN
:
usb3
->
fs_u2
.
fs_sun
.
fs_state
=
cpu_to_fs32
(
sb
,
value
);
usb3
->
fs_u2
.
fs_sun
.
fs_state
=
cpu_to_fs32
(
sb
,
value
);
break
;
break
;
...
@@ -63,7 +63,7 @@ static inline u32
...
@@ -63,7 +63,7 @@ static inline u32
ufs_get_fs_npsect
(
struct
super_block
*
sb
,
struct
ufs_super_block_first
*
usb1
,
ufs_get_fs_npsect
(
struct
super_block
*
sb
,
struct
ufs_super_block_first
*
usb1
,
struct
ufs_super_block_third
*
usb3
)
struct
ufs_super_block_third
*
usb3
)
{
{
if
((
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_ST_MASK
)
==
UFS_ST_SUNx86
)
if
((
UFS_SB
(
sb
)
->
s_flags
&
UFS_ST_MASK
)
==
UFS_ST_SUNx86
)
return
fs32_to_cpu
(
sb
,
usb3
->
fs_u2
.
fs_sunx86
.
fs_npsect
);
return
fs32_to_cpu
(
sb
,
usb3
->
fs_u2
.
fs_sunx86
.
fs_npsect
);
else
else
return
fs32_to_cpu
(
sb
,
usb1
->
fs_u1
.
fs_sun
.
fs_npsect
);
return
fs32_to_cpu
(
sb
,
usb1
->
fs_u1
.
fs_sun
.
fs_npsect
);
...
@@ -74,7 +74,7 @@ ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3)
...
@@ -74,7 +74,7 @@ ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3)
{
{
u64
tmp
;
u64
tmp
;
switch
(
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_ST_MASK
)
{
switch
(
UFS_SB
(
sb
)
->
s_flags
&
UFS_ST_MASK
)
{
case
UFS_ST_SUN
:
case
UFS_ST_SUN
:
((
u32
*
)
&
tmp
)[
0
]
=
usb3
->
fs_u2
.
fs_sun
.
fs_qbmask
[
0
];
((
u32
*
)
&
tmp
)[
0
]
=
usb3
->
fs_u2
.
fs_sun
.
fs_qbmask
[
0
];
((
u32
*
)
&
tmp
)[
1
]
=
usb3
->
fs_u2
.
fs_sun
.
fs_qbmask
[
1
];
((
u32
*
)
&
tmp
)[
1
]
=
usb3
->
fs_u2
.
fs_sun
.
fs_qbmask
[
1
];
...
@@ -97,7 +97,7 @@ ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
...
@@ -97,7 +97,7 @@ ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
{
{
u64
tmp
;
u64
tmp
;
switch
(
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_ST_MASK
)
{
switch
(
UFS_SB
(
sb
)
->
s_flags
&
UFS_ST_MASK
)
{
case
UFS_ST_SUN
:
case
UFS_ST_SUN
:
((
u32
*
)
&
tmp
)[
0
]
=
usb3
->
fs_u2
.
fs_sun
.
fs_qfmask
[
0
];
((
u32
*
)
&
tmp
)[
0
]
=
usb3
->
fs_u2
.
fs_sun
.
fs_qfmask
[
0
];
((
u32
*
)
&
tmp
)[
1
]
=
usb3
->
fs_u2
.
fs_sun
.
fs_qfmask
[
1
];
((
u32
*
)
&
tmp
)[
1
]
=
usb3
->
fs_u2
.
fs_sun
.
fs_qfmask
[
1
];
...
@@ -118,7 +118,7 @@ ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
...
@@ -118,7 +118,7 @@ ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
static
inline
u16
static
inline
u16
ufs_get_de_namlen
(
struct
super_block
*
sb
,
struct
ufs_dir_entry
*
de
)
ufs_get_de_namlen
(
struct
super_block
*
sb
,
struct
ufs_dir_entry
*
de
)
{
{
if
((
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_DE_MASK
)
==
UFS_DE_OLD
)
if
((
UFS_SB
(
sb
)
->
s_flags
&
UFS_DE_MASK
)
==
UFS_DE_OLD
)
return
fs16_to_cpu
(
sb
,
de
->
d_u
.
d_namlen
);
return
fs16_to_cpu
(
sb
,
de
->
d_u
.
d_namlen
);
else
else
return
de
->
d_u
.
d_44
.
d_namlen
;
/* XXX this seems wrong */
return
de
->
d_u
.
d_44
.
d_namlen
;
/* XXX this seems wrong */
...
@@ -127,7 +127,7 @@ ufs_get_de_namlen(struct super_block *sb, struct ufs_dir_entry *de)
...
@@ -127,7 +127,7 @@ ufs_get_de_namlen(struct super_block *sb, struct ufs_dir_entry *de)
static
inline
void
static
inline
void
ufs_set_de_namlen
(
struct
super_block
*
sb
,
struct
ufs_dir_entry
*
de
,
u16
value
)
ufs_set_de_namlen
(
struct
super_block
*
sb
,
struct
ufs_dir_entry
*
de
,
u16
value
)
{
{
if
((
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_DE_MASK
)
==
UFS_DE_OLD
)
if
((
UFS_SB
(
sb
)
->
s_flags
&
UFS_DE_MASK
)
==
UFS_DE_OLD
)
de
->
d_u
.
d_namlen
=
cpu_to_fs16
(
sb
,
value
);
de
->
d_u
.
d_namlen
=
cpu_to_fs16
(
sb
,
value
);
else
else
de
->
d_u
.
d_44
.
d_namlen
=
value
;
/* XXX this seems wrong */
de
->
d_u
.
d_44
.
d_namlen
=
value
;
/* XXX this seems wrong */
...
@@ -136,7 +136,7 @@ ufs_set_de_namlen(struct super_block *sb, struct ufs_dir_entry *de, u16 value)
...
@@ -136,7 +136,7 @@ ufs_set_de_namlen(struct super_block *sb, struct ufs_dir_entry *de, u16 value)
static
inline
void
static
inline
void
ufs_set_de_type
(
struct
super_block
*
sb
,
struct
ufs_dir_entry
*
de
,
int
mode
)
ufs_set_de_type
(
struct
super_block
*
sb
,
struct
ufs_dir_entry
*
de
,
int
mode
)
{
{
if
((
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_DE_MASK
)
!=
UFS_DE_44BSD
)
if
((
UFS_SB
(
sb
)
->
s_flags
&
UFS_DE_MASK
)
!=
UFS_DE_44BSD
)
return
;
return
;
/*
/*
...
@@ -172,7 +172,7 @@ ufs_set_de_type(struct super_block *sb, struct ufs_dir_entry *de, int mode)
...
@@ -172,7 +172,7 @@ ufs_set_de_type(struct super_block *sb, struct ufs_dir_entry *de, int mode)
static
inline
u32
static
inline
u32
ufs_get_inode_uid
(
struct
super_block
*
sb
,
struct
ufs_inode
*
inode
)
ufs_get_inode_uid
(
struct
super_block
*
sb
,
struct
ufs_inode
*
inode
)
{
{
switch
(
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_UID_MASK
)
{
switch
(
UFS_SB
(
sb
)
->
s_flags
&
UFS_UID_MASK
)
{
case
UFS_UID_EFT
:
case
UFS_UID_EFT
:
return
fs32_to_cpu
(
sb
,
inode
->
ui_u3
.
ui_sun
.
ui_uid
);
return
fs32_to_cpu
(
sb
,
inode
->
ui_u3
.
ui_sun
.
ui_uid
);
case
UFS_UID_44BSD
:
case
UFS_UID_44BSD
:
...
@@ -185,7 +185,7 @@ ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
...
@@ -185,7 +185,7 @@ ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
static
inline
void
static
inline
void
ufs_set_inode_uid
(
struct
super_block
*
sb
,
struct
ufs_inode
*
inode
,
u32
value
)
ufs_set_inode_uid
(
struct
super_block
*
sb
,
struct
ufs_inode
*
inode
,
u32
value
)
{
{
switch
(
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_UID_MASK
)
{
switch
(
UFS_SB
(
sb
)
->
s_flags
&
UFS_UID_MASK
)
{
case
UFS_UID_EFT
:
case
UFS_UID_EFT
:
inode
->
ui_u3
.
ui_sun
.
ui_uid
=
cpu_to_fs32
(
sb
,
value
);
inode
->
ui_u3
.
ui_sun
.
ui_uid
=
cpu_to_fs32
(
sb
,
value
);
break
;
break
;
...
@@ -199,7 +199,7 @@ ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value)
...
@@ -199,7 +199,7 @@ ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value)
static
inline
u32
static
inline
u32
ufs_get_inode_gid
(
struct
super_block
*
sb
,
struct
ufs_inode
*
inode
)
ufs_get_inode_gid
(
struct
super_block
*
sb
,
struct
ufs_inode
*
inode
)
{
{
switch
(
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_UID_MASK
)
{
switch
(
UFS_SB
(
sb
)
->
s_flags
&
UFS_UID_MASK
)
{
case
UFS_UID_EFT
:
case
UFS_UID_EFT
:
return
fs32_to_cpu
(
sb
,
inode
->
ui_u3
.
ui_sun
.
ui_gid
);
return
fs32_to_cpu
(
sb
,
inode
->
ui_u3
.
ui_sun
.
ui_gid
);
case
UFS_UID_44BSD
:
case
UFS_UID_44BSD
:
...
@@ -212,7 +212,7 @@ ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
...
@@ -212,7 +212,7 @@ ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
static
inline
void
static
inline
void
ufs_set_inode_gid
(
struct
super_block
*
sb
,
struct
ufs_inode
*
inode
,
u32
value
)
ufs_set_inode_gid
(
struct
super_block
*
sb
,
struct
ufs_inode
*
inode
,
u32
value
)
{
{
switch
(
sb
->
u
.
ufs_sb
.
s_flags
&
UFS_UID_MASK
)
{
switch
(
UFS_SB
(
sb
)
->
s_flags
&
UFS_UID_MASK
)
{
case
UFS_UID_EFT
:
case
UFS_UID_EFT
:
inode
->
ui_u3
.
ui_sun
.
ui_gid
=
cpu_to_fs32
(
sb
,
value
);
inode
->
ui_u3
.
ui_sun
.
ui_gid
=
cpu_to_fs32
(
sb
,
value
);
break
;
break
;
...
@@ -481,7 +481,7 @@ static inline void ufs_fragacct (struct super_block * sb, unsigned blockmap,
...
@@ -481,7 +481,7 @@ static inline void ufs_fragacct (struct super_block * sb, unsigned blockmap,
struct
ufs_sb_private_info
*
uspi
;
struct
ufs_sb_private_info
*
uspi
;
unsigned
fragsize
,
pos
;
unsigned
fragsize
,
pos
;
uspi
=
sb
->
u
.
ufs_sb
.
s_uspi
;
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
fragsize
=
0
;
fragsize
=
0
;
for
(
pos
=
0
;
pos
<
uspi
->
s_fpb
;
pos
++
)
{
for
(
pos
=
0
;
pos
<
uspi
->
s_fpb
;
pos
++
)
{
...
...
include/linux/ufs_fs.h
View file @
136b6223
...
@@ -33,6 +33,9 @@
...
@@ -33,6 +33,9 @@
#include <linux/stat.h>
#include <linux/stat.h>
#include <linux/fs.h>
#include <linux/fs.h>
#include <linux/ufs_fs_i.h>
#include <linux/ufs_fs_sb.h>
#define UFS_BBLOCK 0
#define UFS_BBLOCK 0
#define UFS_BBSIZE 8192
#define UFS_BBSIZE 8192
#define UFS_SBLOCK 8192
#define UFS_SBLOCK 8192
...
@@ -398,7 +401,7 @@ struct ufs_super_block {
...
@@ -398,7 +401,7 @@ struct ufs_super_block {
* Convert cylinder group to base address of its global summary info.
* Convert cylinder group to base address of its global summary info.
*/
*/
#define fs_cs(indx) \
#define fs_cs(indx) \
u.ufs_sb.
s_csp[(indx) >> uspi->s_csshift][(indx) & ~uspi->s_csmask]
s_csp[(indx) >> uspi->s_csshift][(indx) & ~uspi->s_csmask]
/*
/*
* Cylinder group block for a file system.
* Cylinder group block for a file system.
...
@@ -780,7 +783,10 @@ extern struct inode_operations ufs_fast_symlink_inode_operations;
...
@@ -780,7 +783,10 @@ extern struct inode_operations ufs_fast_symlink_inode_operations;
/* truncate.c */
/* truncate.c */
extern
void
ufs_truncate
(
struct
inode
*
);
extern
void
ufs_truncate
(
struct
inode
*
);
#include <linux/ufs_fs_i.h>
static
inline
struct
ufs_sb_info
*
UFS_SB
(
struct
super_block
*
sb
)
{
return
sb
->
u
.
generic_sbp
;
}
static
inline
struct
ufs_inode_info
*
UFS_I
(
struct
inode
*
inode
)
static
inline
struct
ufs_inode_info
*
UFS_I
(
struct
inode
*
inode
)
{
{
...
...
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