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
482003f2
Commit
482003f2
authored
Nov 09, 2004
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://linux-acpi.bkbits.net/26-latest-release
into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents
86d45f2e
724fd34f
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
447 additions
and
397 deletions
+447
-397
arch/i386/kernel/timers/timer_pit.c
arch/i386/kernel/timers/timer_pit.c
+1
-1
fs/jfs/jfs_dinode.h
fs/jfs/jfs_dinode.h
+14
-14
fs/jfs/jfs_dmap.c
fs/jfs/jfs_dmap.c
+5
-5
fs/jfs/jfs_dmap.h
fs/jfs/jfs_dmap.h
+46
-29
fs/jfs/jfs_dtree.c
fs/jfs/jfs_dtree.c
+15
-11
fs/jfs/jfs_dtree.h
fs/jfs/jfs_dtree.h
+9
-9
fs/jfs/jfs_imap.c
fs/jfs/jfs_imap.c
+33
-32
fs/jfs/jfs_imap.h
fs/jfs/jfs_imap.h
+46
-28
fs/jfs/jfs_logmgr.c
fs/jfs/jfs_logmgr.c
+6
-4
fs/jfs/jfs_logmgr.h
fs/jfs/jfs_logmgr.h
+48
-48
fs/jfs/jfs_metapage.c
fs/jfs/jfs_metapage.c
+5
-5
fs/jfs/jfs_mount.c
fs/jfs/jfs_mount.c
+1
-1
fs/jfs/jfs_superblock.h
fs/jfs/jfs_superblock.h
+16
-16
fs/jfs/jfs_txnmgr.c
fs/jfs/jfs_txnmgr.c
+2
-2
fs/jfs/jfs_types.h
fs/jfs/jfs_types.h
+8
-8
fs/jfs/jfs_unicode.c
fs/jfs/jfs_unicode.c
+1
-1
fs/jfs/jfs_unicode.h
fs/jfs/jfs_unicode.h
+24
-8
fs/jfs/jfs_xattr.h
fs/jfs/jfs_xattr.h
+2
-2
fs/jfs/jfs_xtree.c
fs/jfs/jfs_xtree.c
+27
-35
fs/jfs/jfs_xtree.h
fs/jfs/jfs_xtree.h
+7
-7
fs/partitions/Kconfig
fs/partitions/Kconfig
+1
-1
fs/partitions/efi.c
fs/partitions/efi.c
+129
-129
lib/kobject.c
lib/kobject.c
+1
-1
No files found.
arch/i386/kernel/timers/timer_pit.c
View file @
482003f2
...
@@ -181,7 +181,7 @@ static int timer_resume(struct sys_device *dev)
...
@@ -181,7 +181,7 @@ static int timer_resume(struct sys_device *dev)
}
}
static
struct
sysdev_class
timer_sysclass
=
{
static
struct
sysdev_class
timer_sysclass
=
{
set_kset_name
(
"timer"
),
set_kset_name
(
"timer
_pit
"
),
.
resume
=
timer_resume
,
.
resume
=
timer_resume
,
};
};
...
...
fs/jfs/jfs_dinode.h
View file @
482003f2
...
@@ -39,22 +39,22 @@ struct dinode {
...
@@ -39,22 +39,22 @@ struct dinode {
*
*
* define generic/POSIX attributes
* define generic/POSIX attributes
*/
*/
u
32
di_inostamp
;
/* 4: stamp to show inode belongs to fileset */
__le
32
di_inostamp
;
/* 4: stamp to show inode belongs to fileset */
s32
di_fileset
;
/* 4: fileset number */
__le32
di_fileset
;
/* 4: fileset number */
u32
di_number
;
/* 4: inode number, aka file serial number */
__le32
di_number
;
/* 4: inode number, aka file serial number */
u
32
di_gen
;
/* 4: inode generation number */
__le
32
di_gen
;
/* 4: inode generation number */
pxd_t
di_ixpxd
;
/* 8: inode extent descriptor */
pxd_t
di_ixpxd
;
/* 8: inode extent descriptor */
s
64
di_size
;
/* 8: size */
__le
64
di_size
;
/* 8: size */
s64
di_nblocks
;
/* 8: number of blocks allocated */
__le64
di_nblocks
;
/* 8: number of blocks allocated */
u32
di_nlink
;
/* 4: number of links to the object */
__le32
di_nlink
;
/* 4: number of links to the object */
u
32
di_uid
;
/* 4: user id of owner */
__le
32
di_uid
;
/* 4: user id of owner */
u
32
di_gid
;
/* 4: group id of owner */
__le
32
di_gid
;
/* 4: group id of owner */
u
32
di_mode
;
/* 4: attribute, format and permission */
__le
32
di_mode
;
/* 4: attribute, format and permission */
struct
timestruc_t
di_atime
;
/* 8: time last data accessed */
struct
timestruc_t
di_atime
;
/* 8: time last data accessed */
struct
timestruc_t
di_ctime
;
/* 8: time last status changed */
struct
timestruc_t
di_ctime
;
/* 8: time last status changed */
...
@@ -65,9 +65,9 @@ struct dinode {
...
@@ -65,9 +65,9 @@ struct dinode {
dxd_t
di_ea
;
/* 16: ea descriptor */
dxd_t
di_ea
;
/* 16: ea descriptor */
u
32
di_next_index
;
/* 4: Next available dir_table index */
__le
32
di_next_index
;
/* 4: Next available dir_table index */
s32
di_acltype
;
/* 4: Type of ACL */
__le32
di_acltype
;
/* 4: Type of ACL */
/*
/*
* Extension Areas.
* Extension Areas.
...
@@ -103,7 +103,7 @@ struct dinode {
...
@@ -103,7 +103,7 @@ struct dinode {
u8
_data
[
96
];
/* 96: unused */
u8
_data
[
96
];
/* 96: unused */
struct
{
struct
{
void
*
_imap
;
/* 4: unused */
void
*
_imap
;
/* 4: unused */
u
32
_gengen
;
/* 4: generator */
__le
32
_gengen
;
/* 4: generator */
}
_imap
;
}
_imap
;
}
_u1
;
/* 96: */
}
_u1
;
/* 96: */
#define di_gengen u._file._u1._imap._gengen
#define di_gengen u._file._u1._imap._gengen
...
@@ -114,7 +114,7 @@ struct dinode {
...
@@ -114,7 +114,7 @@ struct dinode {
u8
unused
[
16
];
/* 16: */
u8
unused
[
16
];
/* 16: */
dxd_t
_dxd
;
/* 16: */
dxd_t
_dxd
;
/* 16: */
union
{
union
{
u
32
_rdev
;
/* 4: */
__le
32
_rdev
;
/* 4: */
u8
_fastsymlink
[
128
];
u8
_fastsymlink
[
128
];
}
_u
;
}
_u
;
u8
_inlineea
[
128
];
u8
_inlineea
[
128
];
...
...
fs/jfs/jfs_dmap.c
View file @
482003f2
...
@@ -194,7 +194,7 @@ static s8 budtab[256] = {
...
@@ -194,7 +194,7 @@ static s8 budtab[256] = {
int
dbMount
(
struct
inode
*
ipbmap
)
int
dbMount
(
struct
inode
*
ipbmap
)
{
{
struct
bmap
*
bmp
;
struct
bmap
*
bmp
;
struct
dbmap
*
dbmp_le
;
struct
dbmap
_disk
*
dbmp_le
;
struct
metapage
*
mp
;
struct
metapage
*
mp
;
int
i
;
int
i
;
...
@@ -216,7 +216,7 @@ int dbMount(struct inode *ipbmap)
...
@@ -216,7 +216,7 @@ int dbMount(struct inode *ipbmap)
}
}
/* copy the on-disk bmap descriptor to its in-memory version. */
/* copy the on-disk bmap descriptor to its in-memory version. */
dbmp_le
=
(
struct
dbmap
*
)
mp
->
data
;
dbmp_le
=
(
struct
dbmap
_disk
*
)
mp
->
data
;
bmp
->
db_mapsize
=
le64_to_cpu
(
dbmp_le
->
dn_mapsize
);
bmp
->
db_mapsize
=
le64_to_cpu
(
dbmp_le
->
dn_mapsize
);
bmp
->
db_nfree
=
le64_to_cpu
(
dbmp_le
->
dn_nfree
);
bmp
->
db_nfree
=
le64_to_cpu
(
dbmp_le
->
dn_nfree
);
bmp
->
db_l2nbperpage
=
le32_to_cpu
(
dbmp_le
->
dn_l2nbperpage
);
bmp
->
db_l2nbperpage
=
le32_to_cpu
(
dbmp_le
->
dn_l2nbperpage
);
...
@@ -301,7 +301,7 @@ int dbUnmount(struct inode *ipbmap, int mounterror)
...
@@ -301,7 +301,7 @@ int dbUnmount(struct inode *ipbmap, int mounterror)
*/
*/
int
dbSync
(
struct
inode
*
ipbmap
)
int
dbSync
(
struct
inode
*
ipbmap
)
{
{
struct
dbmap
*
dbmp_le
;
struct
dbmap
_disk
*
dbmp_le
;
struct
bmap
*
bmp
=
JFS_SBI
(
ipbmap
->
i_sb
)
->
bmap
;
struct
bmap
*
bmp
=
JFS_SBI
(
ipbmap
->
i_sb
)
->
bmap
;
struct
metapage
*
mp
;
struct
metapage
*
mp
;
int
i
;
int
i
;
...
@@ -318,7 +318,7 @@ int dbSync(struct inode *ipbmap)
...
@@ -318,7 +318,7 @@ int dbSync(struct inode *ipbmap)
return
-
EIO
;
return
-
EIO
;
}
}
/* copy the in-memory version of the bmap to the on-disk version */
/* copy the in-memory version of the bmap to the on-disk version */
dbmp_le
=
(
struct
dbmap
*
)
mp
->
data
;
dbmp_le
=
(
struct
dbmap
_disk
*
)
mp
->
data
;
dbmp_le
->
dn_mapsize
=
cpu_to_le64
(
bmp
->
db_mapsize
);
dbmp_le
->
dn_mapsize
=
cpu_to_le64
(
bmp
->
db_mapsize
);
dbmp_le
->
dn_nfree
=
cpu_to_le64
(
bmp
->
db_nfree
);
dbmp_le
->
dn_nfree
=
cpu_to_le64
(
bmp
->
db_nfree
);
dbmp_le
->
dn_l2nbperpage
=
cpu_to_le32
(
bmp
->
db_l2nbperpage
);
dbmp_le
->
dn_l2nbperpage
=
cpu_to_le32
(
bmp
->
db_l2nbperpage
);
...
@@ -3782,7 +3782,7 @@ static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks)
...
@@ -3782,7 +3782,7 @@ static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks)
/* set the rest of the words in the page to allocated (ONES) */
/* set the rest of the words in the page to allocated (ONES) */
for
(
i
=
w
;
i
<
LPERDMAP
;
i
++
)
for
(
i
=
w
;
i
<
LPERDMAP
;
i
++
)
dp
->
pmap
[
i
]
=
dp
->
wmap
[
i
]
=
ONES
;
dp
->
pmap
[
i
]
=
dp
->
wmap
[
i
]
=
cpu_to_le32
(
ONES
)
;
/*
/*
* init tree
* init tree
...
...
fs/jfs/jfs_dmap.h
View file @
482003f2
...
@@ -145,10 +145,10 @@ static __inline signed char TREEMAX(signed char *cp)
...
@@ -145,10 +145,10 @@ static __inline signed char TREEMAX(signed char *cp)
* dmaptree must be consistent with dmapctl.
* dmaptree must be consistent with dmapctl.
*/
*/
struct
dmaptree
{
struct
dmaptree
{
s
32
nleafs
;
/* 4: number of tree leafs */
__le
32
nleafs
;
/* 4: number of tree leafs */
s32
l2nleafs
;
/* 4: l2 number of tree leafs */
__le32
l2nleafs
;
/* 4: l2 number of tree leafs */
s
32
leafidx
;
/* 4: index of first tree leaf */
__le
32
leafidx
;
/* 4: index of first tree leaf */
s
32
height
;
/* 4: height of the tree */
__le
32
height
;
/* 4: height of the tree */
s8
budmin
;
/* 1: min l2 tree leaf value to combine */
s8
budmin
;
/* 1: min l2 tree leaf value to combine */
s8
stree
[
TREESIZE
];
/* TREESIZE: tree */
s8
stree
[
TREESIZE
];
/* TREESIZE: tree */
u8
pad
[
2
];
/* 2: pad to word boundary */
u8
pad
[
2
];
/* 2: pad to word boundary */
...
@@ -158,13 +158,13 @@ struct dmaptree {
...
@@ -158,13 +158,13 @@ struct dmaptree {
* dmap page per 8K blocks bitmap
* dmap page per 8K blocks bitmap
*/
*/
struct
dmap
{
struct
dmap
{
s
32
nblocks
;
/* 4: num blks covered by this dmap */
__le
32
nblocks
;
/* 4: num blks covered by this dmap */
s
32
nfree
;
/* 4: num of free blks in this dmap */
__le
32
nfree
;
/* 4: num of free blks in this dmap */
s
64
start
;
/* 8: starting blkno for this dmap */
__le
64
start
;
/* 8: starting blkno for this dmap */
struct
dmaptree
tree
;
/* 360: dmap tree */
struct
dmaptree
tree
;
/* 360: dmap tree */
u8
pad
[
1672
];
/* 1672: pad to 2048 bytes */
u8
pad
[
1672
];
/* 1672: pad to 2048 bytes */
u
32
wmap
[
LPERDMAP
];
/* 1024: bits of the working map */
__le
32
wmap
[
LPERDMAP
];
/* 1024: bits of the working map */
u
32
pmap
[
LPERDMAP
];
/* 1024: bits of the persistent map */
__le
32
pmap
[
LPERDMAP
];
/* 1024: bits of the persistent map */
};
/* - 4096 - */
};
/* - 4096 - */
/*
/*
...
@@ -173,10 +173,10 @@ struct dmap {
...
@@ -173,10 +173,10 @@ struct dmap {
* dmapctl must be consistent with dmaptree.
* dmapctl must be consistent with dmaptree.
*/
*/
struct
dmapctl
{
struct
dmapctl
{
s
32
nleafs
;
/* 4: number of tree leafs */
__le
32
nleafs
;
/* 4: number of tree leafs */
s32
l2nleafs
;
/* 4: l2 number of tree leafs */
__le32
l2nleafs
;
/* 4: l2 number of tree leafs */
s
32
leafidx
;
/* 4: index of the first tree leaf */
__le
32
leafidx
;
/* 4: index of the first tree leaf */
s
32
height
;
/* 4: height of tree */
__le
32
height
;
/* 4: height of tree */
s8
budmin
;
/* 1: minimum l2 tree leaf value */
s8
budmin
;
/* 1: minimum l2 tree leaf value */
s8
stree
[
CTLTREESIZE
];
/* CTLTREESIZE: dmapctl tree */
s8
stree
[
CTLTREESIZE
];
/* CTLTREESIZE: dmapctl tree */
u8
pad
[
2714
];
/* 2714: pad to 4096 */
u8
pad
[
2714
];
/* 2714: pad to 4096 */
...
@@ -201,30 +201,47 @@ typedef union dmtree {
...
@@ -201,30 +201,47 @@ typedef union dmtree {
/*
/*
* on-disk aggregate disk allocation map descriptor.
* on-disk aggregate disk allocation map descriptor.
*/
*/
struct
dbmap
{
struct
dbmap
_disk
{
s64
dn_mapsize
;
/* 8: number of blocks in aggregate */
__le64
dn_mapsize
;
/* 8: number of blocks in aggregate */
s64
dn_nfree
;
/* 8: num free blks in aggregate map */
__le64
dn_nfree
;
/* 8: num free blks in aggregate map */
s
32
dn_l2nbperpage
;
/* 4: number of blks per page */
__le
32
dn_l2nbperpage
;
/* 4: number of blks per page */
s32
dn_numag
;
/* 4: total number of ags */
__le32
dn_numag
;
/* 4: total number of ags */
s
32
dn_maxlevel
;
/* 4: number of active ags */
__le
32
dn_maxlevel
;
/* 4: number of active ags */
s32
dn_maxag
;
/* 4: max active alloc group number */
__le32
dn_maxag
;
/* 4: max active alloc group number */
s32
dn_agpref
;
/* 4: preferred alloc group (hint) */
__le32
dn_agpref
;
/* 4: preferred alloc group (hint) */
s32
dn_aglevel
;
/* 4: dmapctl level holding the AG */
__le32
dn_aglevel
;
/* 4: dmapctl level holding the AG */
s
32
dn_agheigth
;
/* 4: height in dmapctl of the AG */
__le
32
dn_agheigth
;
/* 4: height in dmapctl of the AG */
s32
dn_agwidth
;
/* 4: width in dmapctl of the AG */
__le32
dn_agwidth
;
/* 4: width in dmapctl of the AG */
s32
dn_agstart
;
/* 4: start tree index at AG height */
__le32
dn_agstart
;
/* 4: start tree index at AG height */
s
32
dn_agl2size
;
/* 4: l2 num of blks per alloc group */
__le
32
dn_agl2size
;
/* 4: l2 num of blks per alloc group */
s64
dn_agfree
[
MAXAG
];
/* 8*MAXAG: per AG free count */
__le64
dn_agfree
[
MAXAG
];
/* 8*MAXAG: per AG free count */
s64
dn_agsize
;
/* 8: num of blks per alloc group */
__le64
dn_agsize
;
/* 8: num of blks per alloc group */
s8
dn_maxfreebud
;
/* 1: max free buddy system */
s8
dn_maxfreebud
;
/* 1: max free buddy system */
u8
pad
[
3007
];
/* 3007: pad to 4096 */
u8
pad
[
3007
];
/* 3007: pad to 4096 */
};
/* - 4096 - */
};
/* - 4096 - */
struct
dbmap
{
s64
dn_mapsize
;
/* number of blocks in aggregate */
s64
dn_nfree
;
/* num free blks in aggregate map */
int
dn_l2nbperpage
;
/* number of blks per page */
int
dn_numag
;
/* total number of ags */
int
dn_maxlevel
;
/* number of active ags */
int
dn_maxag
;
/* max active alloc group number */
int
dn_agpref
;
/* preferred alloc group (hint) */
int
dn_aglevel
;
/* dmapctl level holding the AG */
int
dn_agheigth
;
/* height in dmapctl of the AG */
int
dn_agwidth
;
/* width in dmapctl of the AG */
int
dn_agstart
;
/* start tree index at AG height */
int
dn_agl2size
;
/* l2 num of blks per alloc group */
s64
dn_agfree
[
MAXAG
];
/* per AG free count */
s64
dn_agsize
;
/* num of blks per alloc group */
signed
char
dn_maxfreebud
;
/* max free buddy system */
};
/* - 4096 - */
/*
/*
* in-memory aggregate disk allocation map descriptor.
* in-memory aggregate disk allocation map descriptor.
*/
*/
struct
bmap
{
struct
bmap
{
struct
dbmap
db_bmap
;
/* on-disk aggregate map descriptor */
struct
dbmap
db_bmap
;
/* on-disk aggregate map descriptor */
struct
inode
*
db_ipbmap
;
/* ptr to aggregate map incore inode */
struct
inode
*
db_ipbmap
;
/* ptr to aggregate map incore inode */
struct
semaphore
db_bmaplock
;
/* aggregate map lock */
struct
semaphore
db_bmaplock
;
/* aggregate map lock */
atomic_t
db_active
[
MAXAG
];
/* count of active, open files in AG */
atomic_t
db_active
[
MAXAG
];
/* count of active, open files in AG */
...
...
fs/jfs/jfs_dtree.c
View file @
482003f2
...
@@ -852,7 +852,7 @@ int dtInsert(tid_t tid, struct inode *ip,
...
@@ -852,7 +852,7 @@ int dtInsert(tid_t tid, struct inode *ip,
n
=
NDTLEAF_LEGACY
(
name
->
namlen
);
n
=
NDTLEAF_LEGACY
(
name
->
namlen
);
data
.
leaf
.
ip
=
NULL
;
/* signifies legacy directory format */
data
.
leaf
.
ip
=
NULL
;
/* signifies legacy directory format */
}
}
data
.
leaf
.
ino
=
cpu_to_le32
(
*
fsn
)
;
data
.
leaf
.
ino
=
*
fsn
;
/*
/*
* leaf page does not have enough room for new entry:
* leaf page does not have enough room for new entry:
...
@@ -3570,7 +3570,8 @@ static int dtCompare(struct component_name * key, /* search key */
...
@@ -3570,7 +3570,8 @@ static int dtCompare(struct component_name * key, /* search key */
dtpage_t
*
p
,
/* directory page */
dtpage_t
*
p
,
/* directory page */
int
si
)
int
si
)
{
/* entry slot index */
{
/* entry slot index */
wchar_t
*
kname
,
*
name
;
wchar_t
*
kname
;
__le16
*
name
;
int
klen
,
namlen
,
len
,
rc
;
int
klen
,
namlen
,
len
,
rc
;
struct
idtentry
*
ih
;
struct
idtentry
*
ih
;
struct
dtslot
*
t
;
struct
dtslot
*
t
;
...
@@ -3646,7 +3647,8 @@ static int ciCompare(struct component_name * key, /* search key */
...
@@ -3646,7 +3647,8 @@ static int ciCompare(struct component_name * key, /* search key */
int
si
,
/* entry slot index */
int
si
,
/* entry slot index */
int
flag
)
int
flag
)
{
{
wchar_t
*
kname
,
*
name
,
x
;
wchar_t
*
kname
,
x
;
__le16
*
name
;
int
klen
,
namlen
,
len
,
rc
;
int
klen
,
namlen
,
len
,
rc
;
struct
ldtentry
*
lh
;
struct
ldtentry
*
lh
;
struct
idtentry
*
ih
;
struct
idtentry
*
ih
;
...
@@ -3824,7 +3826,8 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
...
@@ -3824,7 +3826,8 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
struct
idtentry
*
ih
;
struct
idtentry
*
ih
;
struct
dtslot
*
t
;
struct
dtslot
*
t
;
int
namlen
,
len
;
int
namlen
,
len
;
wchar_t
*
name
,
*
kname
;
wchar_t
*
kname
;
__le16
*
name
;
/* get entry */
/* get entry */
stbl
=
DT_GETSTBL
(
p
);
stbl
=
DT_GETSTBL
(
p
);
...
@@ -3852,7 +3855,7 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
...
@@ -3852,7 +3855,7 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
/*
/*
* move head/only segment
* move head/only segment
*/
*/
UniStrncpy_le
(
kname
,
name
,
len
);
UniStrncpy_
from_
le
(
kname
,
name
,
len
);
/*
/*
* move additional segment(s)
* move additional segment(s)
...
@@ -3863,7 +3866,7 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
...
@@ -3863,7 +3866,7 @@ static void dtGetKey(dtpage_t * p, int i, /* entry index */
kname
+=
len
;
kname
+=
len
;
namlen
-=
len
;
namlen
-=
len
;
len
=
min
(
namlen
,
DTSLOTDATALEN
);
len
=
min
(
namlen
,
DTSLOTDATALEN
);
UniStrncpy_le
(
kname
,
t
->
name
,
len
);
UniStrncpy_
from_
le
(
kname
,
t
->
name
,
len
);
si
=
t
->
next
;
si
=
t
->
next
;
}
}
...
@@ -3885,7 +3888,8 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
...
@@ -3885,7 +3888,8 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
struct
ldtentry
*
lh
=
NULL
;
struct
ldtentry
*
lh
=
NULL
;
struct
idtentry
*
ih
=
NULL
;
struct
idtentry
*
ih
=
NULL
;
int
hsi
,
fsi
,
klen
,
len
,
nextindex
;
int
hsi
,
fsi
,
klen
,
len
,
nextindex
;
wchar_t
*
kname
,
*
name
;
wchar_t
*
kname
;
__le16
*
name
;
s8
*
stbl
;
s8
*
stbl
;
pxd_t
*
xd
;
pxd_t
*
xd
;
struct
dt_lock
*
dtlck
=
*
dtlock
;
struct
dt_lock
*
dtlck
=
*
dtlock
;
...
@@ -3914,7 +3918,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
...
@@ -3914,7 +3918,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
if
(
p
->
header
.
flag
&
BT_LEAF
)
{
if
(
p
->
header
.
flag
&
BT_LEAF
)
{
lh
=
(
struct
ldtentry
*
)
h
;
lh
=
(
struct
ldtentry
*
)
h
;
lh
->
next
=
h
->
next
;
lh
->
next
=
h
->
next
;
lh
->
inumber
=
data
->
leaf
.
ino
;
/* little-endian */
lh
->
inumber
=
cpu_to_le32
(
data
->
leaf
.
ino
);
lh
->
namlen
=
klen
;
lh
->
namlen
=
klen
;
name
=
lh
->
name
;
name
=
lh
->
name
;
if
(
data
->
leaf
.
ip
)
{
if
(
data
->
leaf
.
ip
)
{
...
@@ -3936,7 +3940,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
...
@@ -3936,7 +3940,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
len
=
min
(
klen
,
DTIHDRDATALEN
);
len
=
min
(
klen
,
DTIHDRDATALEN
);
}
}
UniStrncpy_le
(
name
,
kname
,
len
);
UniStrncpy_
to_
le
(
name
,
kname
,
len
);
n
=
1
;
n
=
1
;
xsi
=
hsi
;
xsi
=
hsi
;
...
@@ -3971,7 +3975,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
...
@@ -3971,7 +3975,7 @@ static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
kname
+=
len
;
kname
+=
len
;
len
=
min
(
klen
,
DTSLOTDATALEN
);
len
=
min
(
klen
,
DTSLOTDATALEN
);
UniStrncpy_le
(
t
->
name
,
kname
,
len
);
UniStrncpy_
to_
le
(
t
->
name
,
kname
,
len
);
n
++
;
n
++
;
xsi
=
fsi
;
xsi
=
fsi
;
...
@@ -4174,7 +4178,7 @@ static void dtMoveEntry(dtpage_t * sp, int si, dtpage_t * dp,
...
@@ -4174,7 +4178,7 @@ static void dtMoveEntry(dtpage_t * sp, int si, dtpage_t * dp,
d
++
;
d
++
;
len
=
min
(
snamlen
,
DTSLOTDATALEN
);
len
=
min
(
snamlen
,
DTSLOTDATALEN
);
UniStrncpy
(
d
->
name
,
s
->
name
,
len
);
UniStrncpy
_le
(
d
->
name
,
s
->
name
,
len
);
ns
++
;
ns
++
;
nd
++
;
nd
++
;
...
...
fs/jfs/jfs_dtree.h
View file @
482003f2
...
@@ -47,7 +47,7 @@ typedef union {
...
@@ -47,7 +47,7 @@ typedef union {
struct
dtslot
{
struct
dtslot
{
s8
next
;
/* 1: */
s8
next
;
/* 1: */
s8
cnt
;
/* 1: */
s8
cnt
;
/* 1: */
wchar_t
name
[
15
];
/* 30: */
__le16
name
[
15
];
/* 30: */
};
/* (32) */
};
/* (32) */
...
@@ -67,7 +67,7 @@ struct idtentry {
...
@@ -67,7 +67,7 @@ struct idtentry {
s8
next
;
/* 1: */
s8
next
;
/* 1: */
u8
namlen
;
/* 1: */
u8
namlen
;
/* 1: */
wchar_t
name
[
11
];
/* 22: 2-byte aligned */
__le16
name
[
11
];
/* 22: 2-byte aligned */
};
/* (32) */
};
/* (32) */
#define DTIHDRSIZE 10
#define DTIHDRSIZE 10
...
@@ -83,11 +83,11 @@ struct idtentry {
...
@@ -83,11 +83,11 @@ struct idtentry {
* For legacy filesystems, name contains 13 wchars -- no index field
* For legacy filesystems, name contains 13 wchars -- no index field
*/
*/
struct
ldtentry
{
struct
ldtentry
{
u
32
inumber
;
/* 4: 4-byte aligned */
__le
32
inumber
;
/* 4: 4-byte aligned */
s8
next
;
/* 1: */
s8
next
;
/* 1: */
u8
namlen
;
/* 1: */
u8
namlen
;
/* 1: */
wchar_t
name
[
11
];
/* 22: 2-byte aligned */
__le16
name
[
11
];
/* 22: 2-byte aligned */
u
32
index
;
/* 4: index into dir_table */
__le
32
index
;
/* 4: index into dir_table */
};
/* (32) */
};
/* (32) */
#define DTLHDRSIZE 6
#define DTLHDRSIZE 6
...
@@ -113,7 +113,7 @@ struct dir_table_slot {
...
@@ -113,7 +113,7 @@ struct dir_table_slot {
u8
flag
;
/* 1: 0 if free */
u8
flag
;
/* 1: 0 if free */
u8
slot
;
/* 1: slot within leaf page of entry */
u8
slot
;
/* 1: slot within leaf page of entry */
u8
addr1
;
/* 1: upper 8 bits of leaf page address */
u8
addr1
;
/* 1: upper 8 bits of leaf page address */
u
32
addr2
;
/* 4: lower 32 bits of leaf page address -OR-
__le
32
addr2
;
/* 4: lower 32 bits of leaf page address -OR-
index of next entry when this entry was deleted */
index of next entry when this entry was deleted */
};
/* (8) */
};
/* (8) */
...
@@ -151,7 +151,7 @@ typedef union {
...
@@ -151,7 +151,7 @@ typedef union {
s8
freecnt
;
/* 1: free count */
s8
freecnt
;
/* 1: free count */
s8
freelist
;
/* 1: freelist header */
s8
freelist
;
/* 1: freelist header */
u
32
idotdot
;
/* 4: parent inode number */
__le
32
idotdot
;
/* 4: parent inode number */
s8
stbl
[
8
];
/* 8: sorted entry index table */
s8
stbl
[
8
];
/* 8: sorted entry index table */
}
header
;
/* (32) */
}
header
;
/* (32) */
...
@@ -192,8 +192,8 @@ typedef union {
...
@@ -192,8 +192,8 @@ typedef union {
*/
*/
typedef
union
{
typedef
union
{
struct
{
struct
{
s
64
next
;
/* 8: next sibling */
__le
64
next
;
/* 8: next sibling */
s
64
prev
;
/* 8: previous sibling */
__le
64
prev
;
/* 8: previous sibling */
u8
flag
;
/* 1: */
u8
flag
;
/* 1: */
u8
nextindex
;
/* 1: next entry index in stbl */
u8
nextindex
;
/* 1: next entry index in stbl */
...
...
fs/jfs/jfs_imap.c
View file @
482003f2
...
@@ -131,7 +131,7 @@ int diMount(struct inode *ipimap)
...
@@ -131,7 +131,7 @@ int diMount(struct inode *ipimap)
struct
inomap
*
imap
;
struct
inomap
*
imap
;
struct
metapage
*
mp
;
struct
metapage
*
mp
;
int
index
;
int
index
;
struct
dinomap
*
dinom_le
;
struct
dinomap
_disk
*
dinom_le
;
/*
/*
* allocate/initialize the in-memory inode map control structure
* allocate/initialize the in-memory inode map control structure
...
@@ -154,7 +154,7 @@ int diMount(struct inode *ipimap)
...
@@ -154,7 +154,7 @@ int diMount(struct inode *ipimap)
}
}
/* copy the on-disk version to the in-memory version. */
/* copy the on-disk version to the in-memory version. */
dinom_le
=
(
struct
dinomap
*
)
mp
->
data
;
dinom_le
=
(
struct
dinomap
_disk
*
)
mp
->
data
;
imap
->
im_freeiag
=
le32_to_cpu
(
dinom_le
->
in_freeiag
);
imap
->
im_freeiag
=
le32_to_cpu
(
dinom_le
->
in_freeiag
);
imap
->
im_nextiag
=
le32_to_cpu
(
dinom_le
->
in_nextiag
);
imap
->
im_nextiag
=
le32_to_cpu
(
dinom_le
->
in_nextiag
);
atomic_set
(
&
imap
->
im_numinos
,
le32_to_cpu
(
dinom_le
->
in_numinos
));
atomic_set
(
&
imap
->
im_numinos
,
le32_to_cpu
(
dinom_le
->
in_numinos
));
...
@@ -242,7 +242,7 @@ int diUnmount(struct inode *ipimap, int mounterror)
...
@@ -242,7 +242,7 @@ int diUnmount(struct inode *ipimap, int mounterror)
*/
*/
int
diSync
(
struct
inode
*
ipimap
)
int
diSync
(
struct
inode
*
ipimap
)
{
{
struct
dinomap
*
dinom_le
;
struct
dinomap
_disk
*
dinom_le
;
struct
inomap
*
imp
=
JFS_IP
(
ipimap
)
->
i_imap
;
struct
inomap
*
imp
=
JFS_IP
(
ipimap
)
->
i_imap
;
struct
metapage
*
mp
;
struct
metapage
*
mp
;
int
index
;
int
index
;
...
@@ -260,7 +260,7 @@ int diSync(struct inode *ipimap)
...
@@ -260,7 +260,7 @@ int diSync(struct inode *ipimap)
}
}
/* copy the in-memory version to the on-disk version */
/* copy the in-memory version to the on-disk version */
dinom_le
=
(
struct
dinomap
*
)
mp
->
data
;
dinom_le
=
(
struct
dinomap
_disk
*
)
mp
->
data
;
dinom_le
->
in_freeiag
=
cpu_to_le32
(
imp
->
im_freeiag
);
dinom_le
->
in_freeiag
=
cpu_to_le32
(
imp
->
im_freeiag
);
dinom_le
->
in_nextiag
=
cpu_to_le32
(
imp
->
im_nextiag
);
dinom_le
->
in_nextiag
=
cpu_to_le32
(
imp
->
im_nextiag
);
dinom_le
->
in_numinos
=
cpu_to_le32
(
atomic_read
(
&
imp
->
im_numinos
));
dinom_le
->
in_numinos
=
cpu_to_le32
(
atomic_read
(
&
imp
->
im_numinos
));
...
@@ -1027,7 +1027,7 @@ int diFree(struct inode *ip)
...
@@ -1027,7 +1027,7 @@ int diFree(struct inode *ip)
*/
*/
iagp
->
inofreefwd
=
iagp
->
inofreefwd
=
cpu_to_le32
(
imap
->
im_agctl
[
agno
].
inofree
);
cpu_to_le32
(
imap
->
im_agctl
[
agno
].
inofree
);
iagp
->
inofreeback
=
-
1
;
iagp
->
inofreeback
=
cpu_to_le32
(
-
1
)
;
imap
->
im_agctl
[
agno
].
inofree
=
iagno
;
imap
->
im_agctl
[
agno
].
inofree
=
iagno
;
}
}
IREAD_UNLOCK
(
ipimap
);
IREAD_UNLOCK
(
ipimap
);
...
@@ -1037,7 +1037,7 @@ int diFree(struct inode *ip)
...
@@ -1037,7 +1037,7 @@ int diFree(struct inode *ip)
* inodes (i.e., the inode being freed is the first free
* inodes (i.e., the inode being freed is the first free
* inode of extent),
* inode of extent),
*/
*/
if
(
iagp
->
wmap
[
extno
]
==
ONES
)
{
if
(
iagp
->
wmap
[
extno
]
==
cpu_to_le32
(
ONES
)
)
{
sword
=
extno
>>
L2EXTSPERSUM
;
sword
=
extno
>>
L2EXTSPERSUM
;
bitno
=
extno
&
(
EXTSPERSUM
-
1
);
bitno
=
extno
&
(
EXTSPERSUM
-
1
);
iagp
->
inosmap
[
sword
]
&=
iagp
->
inosmap
[
sword
]
&=
...
@@ -1185,7 +1185,7 @@ int diFree(struct inode *ip)
...
@@ -1185,7 +1185,7 @@ int diFree(struct inode *ip)
iagp
->
extfreefwd
=
iagp
->
extfreefwd
=
cpu_to_le32
(
imap
->
im_agctl
[
agno
].
extfree
);
cpu_to_le32
(
imap
->
im_agctl
[
agno
].
extfree
);
iagp
->
extfreeback
=
-
1
;
iagp
->
extfreeback
=
cpu_to_le32
(
-
1
)
;
imap
->
im_agctl
[
agno
].
extfree
=
iagno
;
imap
->
im_agctl
[
agno
].
extfree
=
iagno
;
}
else
{
}
else
{
/* remove the iag from the ag extent list if all extents
/* remove the iag from the ag extent list if all extents
...
@@ -1201,7 +1201,7 @@ int diFree(struct inode *ip)
...
@@ -1201,7 +1201,7 @@ int diFree(struct inode *ip)
imap
->
im_agctl
[
agno
].
extfree
=
imap
->
im_agctl
[
agno
].
extfree
=
le32_to_cpu
(
iagp
->
extfreefwd
);
le32_to_cpu
(
iagp
->
extfreefwd
);
iagp
->
extfreefwd
=
iagp
->
extfreeback
=
-
1
;
iagp
->
extfreefwd
=
iagp
->
extfreeback
=
cpu_to_le32
(
-
1
)
;
IAGFREE_LOCK
(
imap
);
IAGFREE_LOCK
(
imap
);
iagp
->
iagfree
=
cpu_to_le32
(
imap
->
im_freeiag
);
iagp
->
iagfree
=
cpu_to_le32
(
imap
->
im_freeiag
);
...
@@ -1223,7 +1223,7 @@ int diFree(struct inode *ip)
...
@@ -1223,7 +1223,7 @@ int diFree(struct inode *ip)
imap
->
im_agctl
[
agno
].
inofree
=
imap
->
im_agctl
[
agno
].
inofree
=
le32_to_cpu
(
iagp
->
inofreefwd
);
le32_to_cpu
(
iagp
->
inofreefwd
);
iagp
->
inofreefwd
=
iagp
->
inofreeback
=
-
1
;
iagp
->
inofreefwd
=
iagp
->
inofreeback
=
cpu_to_le32
(
-
1
)
;
}
}
/* update the inode extent address and working map
/* update the inode extent address and working map
...
@@ -2131,7 +2131,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
...
@@ -2131,7 +2131,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
* allocated. if so, update the free inode summary
* allocated. if so, update the free inode summary
* map to reflect this.
* map to reflect this.
*/
*/
if
(
iagp
->
wmap
[
extno
]
==
ONES
)
{
if
(
iagp
->
wmap
[
extno
]
==
cpu_to_le32
(
ONES
)
)
{
sword
=
extno
>>
L2EXTSPERSUM
;
sword
=
extno
>>
L2EXTSPERSUM
;
bitno
=
extno
&
(
EXTSPERSUM
-
1
);
bitno
=
extno
&
(
EXTSPERSUM
-
1
);
iagp
->
inosmap
[
sword
]
|=
cpu_to_le32
(
HIGHORDER
>>
bitno
);
iagp
->
inosmap
[
sword
]
|=
cpu_to_le32
(
HIGHORDER
>>
bitno
);
...
@@ -2153,7 +2153,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
...
@@ -2153,7 +2153,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
imap
->
im_agctl
[
agno
].
inofree
=
imap
->
im_agctl
[
agno
].
inofree
=
le32_to_cpu
(
iagp
->
inofreefwd
);
le32_to_cpu
(
iagp
->
inofreefwd
);
}
}
iagp
->
inofreefwd
=
iagp
->
inofreeback
=
-
1
;
iagp
->
inofreefwd
=
iagp
->
inofreeback
=
cpu_to_le32
(
-
1
)
;
}
}
/* update the free inode count at the iag, ag, inode
/* update the free inode count at the iag, ag, inode
...
@@ -2362,7 +2362,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
...
@@ -2362,7 +2362,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
imap
->
im_agctl
[
agno
].
extfree
=
imap
->
im_agctl
[
agno
].
extfree
=
le32_to_cpu
(
iagp
->
extfreefwd
);
le32_to_cpu
(
iagp
->
extfreefwd
);
iagp
->
extfreefwd
=
iagp
->
extfreeback
=
-
1
;
iagp
->
extfreefwd
=
iagp
->
extfreeback
=
cpu_to_le32
(
-
1
)
;
}
else
{
}
else
{
/* if the iag has all free extents (newly allocated iag),
/* if the iag has all free extents (newly allocated iag),
* add the iag to the ag free extent list.
* add the iag to the ag free extent list.
...
@@ -2372,7 +2372,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
...
@@ -2372,7 +2372,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
aiagp
->
extfreeback
=
cpu_to_le32
(
iagno
);
aiagp
->
extfreeback
=
cpu_to_le32
(
iagno
);
iagp
->
extfreefwd
=
cpu_to_le32
(
fwd
);
iagp
->
extfreefwd
=
cpu_to_le32
(
fwd
);
iagp
->
extfreeback
=
-
1
;
iagp
->
extfreeback
=
cpu_to_le32
(
-
1
)
;
imap
->
im_agctl
[
agno
].
extfree
=
iagno
;
imap
->
im_agctl
[
agno
].
extfree
=
iagno
;
}
}
}
}
...
@@ -2386,7 +2386,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
...
@@ -2386,7 +2386,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
iagp
->
inofreefwd
=
iagp
->
inofreefwd
=
cpu_to_le32
(
imap
->
im_agctl
[
agno
].
inofree
);
cpu_to_le32
(
imap
->
im_agctl
[
agno
].
inofree
);
iagp
->
inofreeback
=
-
1
;
iagp
->
inofreeback
=
cpu_to_le32
(
-
1
)
;
imap
->
im_agctl
[
agno
].
inofree
=
iagno
;
imap
->
im_agctl
[
agno
].
inofree
=
iagno
;
}
}
...
@@ -2592,9 +2592,9 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
...
@@ -2592,9 +2592,9 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
/* init the iag */
/* init the iag */
memset
(
iagp
,
0
,
sizeof
(
struct
iag
));
memset
(
iagp
,
0
,
sizeof
(
struct
iag
));
iagp
->
iagnum
=
cpu_to_le32
(
iagno
);
iagp
->
iagnum
=
cpu_to_le32
(
iagno
);
iagp
->
inofreefwd
=
iagp
->
inofreeback
=
-
1
;
iagp
->
inofreefwd
=
iagp
->
inofreeback
=
cpu_to_le32
(
-
1
)
;
iagp
->
extfreefwd
=
iagp
->
extfreeback
=
-
1
;
iagp
->
extfreefwd
=
iagp
->
extfreeback
=
cpu_to_le32
(
-
1
)
;
iagp
->
iagfree
=
-
1
;
iagp
->
iagfree
=
cpu_to_le32
(
-
1
)
;
iagp
->
nfreeinos
=
0
;
iagp
->
nfreeinos
=
0
;
iagp
->
nfreeexts
=
cpu_to_le32
(
EXTSPERIAG
);
iagp
->
nfreeexts
=
cpu_to_le32
(
EXTSPERIAG
);
...
@@ -2602,7 +2602,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
...
@@ -2602,7 +2602,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
* summary map initialization handled by bzero).
* summary map initialization handled by bzero).
*/
*/
for
(
i
=
0
;
i
<
SMAPSZ
;
i
++
)
for
(
i
=
0
;
i
<
SMAPSZ
;
i
++
)
iagp
->
inosmap
[
i
]
=
ONES
;
iagp
->
inosmap
[
i
]
=
cpu_to_le32
(
ONES
)
;
flush_metapage
(
mp
);
flush_metapage
(
mp
);
...
@@ -2676,7 +2676,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
...
@@ -2676,7 +2676,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
/* remove the iag from the iag free list */
/* remove the iag from the iag free list */
imap
->
im_freeiag
=
le32_to_cpu
(
iagp
->
iagfree
);
imap
->
im_freeiag
=
le32_to_cpu
(
iagp
->
iagfree
);
iagp
->
iagfree
=
-
1
;
iagp
->
iagfree
=
cpu_to_le32
(
-
1
)
;
/* set the return iag number and buffer pointer */
/* set the return iag number and buffer pointer */
*
iagnop
=
iagno
;
*
iagnop
=
iagno
;
...
@@ -2924,8 +2924,8 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
...
@@ -2924,8 +2924,8 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
/* init per AG control information im_agctl[] */
/* init per AG control information im_agctl[] */
for
(
i
=
0
;
i
<
MAXAG
;
i
++
)
{
for
(
i
=
0
;
i
<
MAXAG
;
i
++
)
{
imap
->
im_agctl
[
i
].
inofree
=
-
1
;
/* free inode list */
imap
->
im_agctl
[
i
].
inofree
=
-
1
;
imap
->
im_agctl
[
i
].
extfree
=
-
1
;
/* free extent list */
imap
->
im_agctl
[
i
].
extfree
=
-
1
;
imap
->
im_agctl
[
i
].
numinos
=
0
;
/* number of backed inodes */
imap
->
im_agctl
[
i
].
numinos
=
0
;
/* number of backed inodes */
imap
->
im_agctl
[
i
].
numfree
=
0
;
/* number of free backed inodes */
imap
->
im_agctl
[
i
].
numfree
=
0
;
/* number of free backed inodes */
}
}
...
@@ -2970,18 +2970,18 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
...
@@ -2970,18 +2970,18 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
/* if any backed free inodes, insert at AG free inode list */
/* if any backed free inodes, insert at AG free inode list */
if
((
int
)
le32_to_cpu
(
iagp
->
nfreeinos
)
>
0
)
{
if
((
int
)
le32_to_cpu
(
iagp
->
nfreeinos
)
>
0
)
{
if
((
head
=
imap
->
im_agctl
[
n
].
inofree
)
==
-
1
)
if
((
head
=
imap
->
im_agctl
[
n
].
inofree
)
==
-
1
)
{
iagp
->
inofreefwd
=
iagp
->
inofreeback
=
-
1
;
iagp
->
inofreefwd
=
cpu_to_le32
(
-
1
);
else
{
iagp
->
inofreeback
=
cpu_to_le32
(
-
1
);
}
else
{
if
((
rc
=
diIAGRead
(
imap
,
head
,
&
hbp
)))
{
if
((
rc
=
diIAGRead
(
imap
,
head
,
&
hbp
)))
{
rcx
=
rc
;
rcx
=
rc
;
goto
nextiag
;
goto
nextiag
;
}
}
hiagp
=
(
struct
iag
*
)
hbp
->
data
;
hiagp
=
(
struct
iag
*
)
hbp
->
data
;
hiagp
->
inofreeback
=
hiagp
->
inofreeback
=
iagp
->
iagnum
;
le32_to_cpu
(
iagp
->
iagnum
);
iagp
->
inofreefwd
=
cpu_to_le32
(
head
);
iagp
->
inofreefwd
=
cpu_to_le32
(
head
);
iagp
->
inofreeback
=
-
1
;
iagp
->
inofreeback
=
cpu_to_le32
(
-
1
)
;
write_metapage
(
hbp
);
write_metapage
(
hbp
);
}
}
...
@@ -2996,9 +2996,10 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
...
@@ -2996,9 +2996,10 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
/* if any free extents, insert at AG free extent list */
/* if any free extents, insert at AG free extent list */
if
(
le32_to_cpu
(
iagp
->
nfreeexts
)
>
0
)
{
if
(
le32_to_cpu
(
iagp
->
nfreeexts
)
>
0
)
{
if
((
head
=
imap
->
im_agctl
[
n
].
extfree
)
==
-
1
)
if
((
head
=
imap
->
im_agctl
[
n
].
extfree
)
==
-
1
)
{
iagp
->
extfreefwd
=
iagp
->
extfreeback
=
-
1
;
iagp
->
extfreefwd
=
cpu_to_le32
(
-
1
);
else
{
iagp
->
extfreeback
=
cpu_to_le32
(
-
1
);
}
else
{
if
((
rc
=
diIAGRead
(
imap
,
head
,
&
hbp
)))
{
if
((
rc
=
diIAGRead
(
imap
,
head
,
&
hbp
)))
{
rcx
=
rc
;
rcx
=
rc
;
goto
nextiag
;
goto
nextiag
;
...
@@ -3006,7 +3007,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
...
@@ -3006,7 +3007,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
hiagp
=
(
struct
iag
*
)
hbp
->
data
;
hiagp
=
(
struct
iag
*
)
hbp
->
data
;
hiagp
->
extfreeback
=
iagp
->
iagnum
;
hiagp
->
extfreeback
=
iagp
->
iagnum
;
iagp
->
extfreefwd
=
cpu_to_le32
(
head
);
iagp
->
extfreefwd
=
cpu_to_le32
(
head
);
iagp
->
extfreeback
=
-
1
;
iagp
->
extfreeback
=
cpu_to_le32
(
-
1
)
;
write_metapage
(
hbp
);
write_metapage
(
hbp
);
}
}
...
@@ -3053,7 +3054,7 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno,
...
@@ -3053,7 +3054,7 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno,
if
(
readSuper
(
sb
,
&
bh
))
if
(
readSuper
(
sb
,
&
bh
))
return
;
return
;
j_sb
=
(
struct
jfs_superblock
*
)
bh
->
b_data
;
j_sb
=
(
struct
jfs_superblock
*
)
bh
->
b_data
;
j_sb
->
s_flag
|=
JFS_BAD_SAIT
;
j_sb
->
s_flag
|=
cpu_to_le32
(
JFS_BAD_SAIT
)
;
mark_buffer_dirty
(
bh
);
mark_buffer_dirty
(
bh
);
sync_dirty_buffer
(
bh
);
sync_dirty_buffer
(
bh
);
...
...
fs/jfs/jfs_imap.h
View file @
482003f2
...
@@ -60,16 +60,16 @@
...
@@ -60,16 +60,16 @@
* inode allocation group page (per 4096 inodes of an AG)
* inode allocation group page (per 4096 inodes of an AG)
*/
*/
struct
iag
{
struct
iag
{
s
64
agstart
;
/* 8: starting block of ag */
__le
64
agstart
;
/* 8: starting block of ag */
s
32
iagnum
;
/* 4: inode allocation group number */
__le
32
iagnum
;
/* 4: inode allocation group number */
s32
inofreefwd
;
/* 4: ag inode free list forward */
__le32
inofreefwd
;
/* 4: ag inode free list forward */
s
32
inofreeback
;
/* 4: ag inode free list back */
__le
32
inofreeback
;
/* 4: ag inode free list back */
s32
extfreefwd
;
/* 4: ag inode extent free list forward */
__le32
extfreefwd
;
/* 4: ag inode extent free list forward */
s
32
extfreeback
;
/* 4: ag inode extent free list back */
__le
32
extfreeback
;
/* 4: ag inode extent free list back */
s
32
iagfree
;
/* 4: iag free list */
__le
32
iagfree
;
/* 4: iag free list */
/* summary map: 1 bit per inode extent */
/* summary map: 1 bit per inode extent */
s
32
inosmap
[
SMAPSZ
];
/* 16: sum map of mapwords w/ free inodes;
__le
32
inosmap
[
SMAPSZ
];
/* 16: sum map of mapwords w/ free inodes;
* note: this indicates free and backed
* note: this indicates free and backed
* inodes, if the extent is not backed the
* inodes, if the extent is not backed the
* value will be 1. if the extent is
* value will be 1. if the extent is
...
@@ -78,43 +78,61 @@ struct iag {
...
@@ -78,43 +78,61 @@ struct iag {
* backed but at least one of the inodes is
* backed but at least one of the inodes is
* free the value will be 0.
* free the value will be 0.
*/
*/
s
32
extsmap
[
SMAPSZ
];
/* 16: sum map of mapwords w/ free extents */
__le
32
extsmap
[
SMAPSZ
];
/* 16: sum map of mapwords w/ free extents */
s
32
nfreeinos
;
/* 4: number of free inodes */
__le
32
nfreeinos
;
/* 4: number of free inodes */
s
32
nfreeexts
;
/* 4: number of free extents */
__le
32
nfreeexts
;
/* 4: number of free extents */
/* (72) */
/* (72) */
u8
pad
[
1976
];
/* 1976: pad to 2048 bytes */
u8
pad
[
1976
];
/* 1976: pad to 2048 bytes */
/* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */
/* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */
u
32
wmap
[
EXTSPERIAG
];
/* 512: working allocation map */
__le
32
wmap
[
EXTSPERIAG
];
/* 512: working allocation map */
u
32
pmap
[
EXTSPERIAG
];
/* 512: persistent allocation map */
__le
32
pmap
[
EXTSPERIAG
];
/* 512: persistent allocation map */
pxd_t
inoext
[
EXTSPERIAG
];
/* 1024: inode extent addresses */
pxd_t
inoext
[
EXTSPERIAG
];
/* 1024: inode extent addresses */
};
/* (4096) */
};
/* (4096) */
/*
/*
* per AG control information (in inode map control page)
* per AG control information (in inode map control page)
*/
*/
struct
iagctl
{
struct
iagctl
_disk
{
s
32
inofree
;
/* 4: free inode list anchor */
__le
32
inofree
;
/* 4: free inode list anchor */
s
32
extfree
;
/* 4: free extent list anchor */
__le
32
extfree
;
/* 4: free extent list anchor */
s
32
numinos
;
/* 4: number of backed inodes */
__le
32
numinos
;
/* 4: number of backed inodes */
s
32
numfree
;
/* 4: number of free inodes */
__le
32
numfree
;
/* 4: number of free inodes */
};
/* (16) */
};
/* (16) */
struct
iagctl
{
int
inofree
;
/* free inode list anchor */
int
extfree
;
/* free extent list anchor */
int
numinos
;
/* number of backed inodes */
int
numfree
;
/* number of free inodes */
};
/*
/*
* per fileset/aggregate inode map control page
* per fileset/aggregate inode map control page
*/
*/
struct
dinomap
{
struct
dinomap
_disk
{
s32
in_freeiag
;
/* 4: free iag list anchor */
__le32
in_freeiag
;
/* 4: free iag list anchor */
s32
in_nextiag
;
/* 4: next free iag number */
__le32
in_nextiag
;
/* 4: next free iag number */
s32
in_numinos
;
/* 4: num of backed inodes */
__le32
in_numinos
;
/* 4: num of backed inodes */
s32
in_numfree
;
/* 4: num of free backed inodes */
__le32
in_numfree
;
/* 4: num of free backed inodes */
s
32
in_nbperiext
;
/* 4: num of blocks per inode extent */
__le
32
in_nbperiext
;
/* 4: num of blocks per inode extent */
s
32
in_l2nbperiext
;
/* 4: l2 of in_nbperiext */
__le
32
in_l2nbperiext
;
/* 4: l2 of in_nbperiext */
s
32
in_diskblock
;
/* 4: for standalone test driver */
__le
32
in_diskblock
;
/* 4: for standalone test driver */
s32
in_maxag
;
/* 4: for standalone test driver */
__le32
in_maxag
;
/* 4: for standalone test driver */
u8
pad
[
2016
];
/* 2016: pad to 2048 */
u8
pad
[
2016
];
/* 2016: pad to 2048 */
struct
iagctl
in_agctl
[
MAXAG
];
/* 2048: AG control information */
struct
iagctl
_disk
in_agctl
[
MAXAG
];
/* 2048: AG control information */
};
/* (4096) */
};
/* (4096) */
struct
dinomap
{
int
in_freeiag
;
/* free iag list anchor */
int
in_nextiag
;
/* next free iag number */
int
in_numinos
;
/* num of backed inodes */
int
in_numfree
;
/* num of free backed inodes */
int
in_nbperiext
;
/* num of blocks per inode extent */
int
in_l2nbperiext
;
/* l2 of in_nbperiext */
int
in_diskblock
;
/* for standalone test driver */
int
in_maxag
;
/* for standalone test driver */
struct
iagctl
in_agctl
[
MAXAG
];
/* AG control information */
};
/*
/*
* In-core inode map control page
* In-core inode map control page
...
...
fs/jfs/jfs_logmgr.c
View file @
482003f2
...
@@ -161,9 +161,9 @@ do { \
...
@@ -161,9 +161,9 @@ do { \
/*
/*
* Global list of active external journals
* Global list of active external journals
*/
*/
LIST_HEAD
(
jfs_external_logs
);
static
LIST_HEAD
(
jfs_external_logs
);
struct
jfs_log
*
dummy_log
=
NULL
;
st
atic
st
ruct
jfs_log
*
dummy_log
=
NULL
;
DECLARE_MUTEX
(
jfs_log_sem
);
static
DECLARE_MUTEX
(
jfs_log_sem
);
/*
/*
* external references
* external references
...
@@ -205,7 +205,7 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait);
...
@@ -205,7 +205,7 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait);
* statistics
* statistics
*/
*/
#ifdef CONFIG_JFS_STATISTICS
#ifdef CONFIG_JFS_STATISTICS
struct
lmStat
{
st
atic
st
ruct
lmStat
{
uint
commit
;
/* # of commit */
uint
commit
;
/* # of commit */
uint
pagedone
;
/* # of page written */
uint
pagedone
;
/* # of page written */
uint
submitted
;
/* # of pages submitted */
uint
submitted
;
/* # of pages submitted */
...
@@ -1435,6 +1435,8 @@ int lmLogInit(struct jfs_log * log)
...
@@ -1435,6 +1435,8 @@ int lmLogInit(struct jfs_log * log)
* unwind on error
* unwind on error
*/
*/
errout30:
/* release log page */
errout30:
/* release log page */
log
->
wqueue
=
NULL
;
bp
->
l_wqnext
=
NULL
;
lbmFree
(
bp
);
lbmFree
(
bp
);
errout20:
/* release log superblock */
errout20:
/* release log superblock */
...
...
fs/jfs/jfs_logmgr.h
View file @
482003f2
...
@@ -62,17 +62,17 @@
...
@@ -62,17 +62,17 @@
#define MAX_ACTIVE 128
/* Max active file systems sharing log */
#define MAX_ACTIVE 128
/* Max active file systems sharing log */
struct
logsuper
{
struct
logsuper
{
u
32
magic
;
/* 4: log lv identifier */
__le
32
magic
;
/* 4: log lv identifier */
s
32
version
;
/* 4: version number */
__le
32
version
;
/* 4: version number */
s
32
serial
;
/* 4: log open/mount counter */
__le
32
serial
;
/* 4: log open/mount counter */
s
32
size
;
/* 4: size in number of LOGPSIZE blocks */
__le
32
size
;
/* 4: size in number of LOGPSIZE blocks */
s
32
bsize
;
/* 4: logical block size in byte */
__le
32
bsize
;
/* 4: logical block size in byte */
s
32
l2bsize
;
/* 4: log2 of bsize */
__le
32
l2bsize
;
/* 4: log2 of bsize */
u
32
flag
;
/* 4: option */
__le
32
flag
;
/* 4: option */
u
32
state
;
/* 4: state - see below */
__le
32
state
;
/* 4: state - see below */
s
32
end
;
/* 4: addr of last log record set by logredo */
__le
32
end
;
/* 4: addr of last log record set by logredo */
char
uuid
[
16
];
/* 16: 128-bit journal uuid */
char
uuid
[
16
];
/* 16: 128-bit journal uuid */
char
label
[
16
];
/* 16: journal label */
char
label
[
16
];
/* 16: journal label */
struct
{
struct
{
...
@@ -121,17 +121,17 @@ struct logsuper {
...
@@ -121,17 +121,17 @@ struct logsuper {
*/
*/
struct
logpage
{
struct
logpage
{
struct
{
/* header */
struct
{
/* header */
s
32
page
;
/* 4: log sequence page number */
__le
32
page
;
/* 4: log sequence page number */
s
16
rsrvd
;
/* 2: */
__le
16
rsrvd
;
/* 2: */
s
16
eor
;
/* 2: end-of-log offset of lasrt record write */
__le
16
eor
;
/* 2: end-of-log offset of lasrt record write */
}
h
;
}
h
;
s
32
data
[
LOGPSIZE
/
4
-
4
];
/* log record area */
__le
32
data
[
LOGPSIZE
/
4
-
4
];
/* log record area */
struct
{
/* trailer */
struct
{
/* trailer */
s
32
page
;
/* 4: normally the same as h.page */
__le
32
page
;
/* 4: normally the same as h.page */
s
16
rsrvd
;
/* 2: */
__le
16
rsrvd
;
/* 2: */
s
16
eor
;
/* 2: normally the same as h.eor */
__le
16
eor
;
/* 2: normally the same as h.eor */
}
t
;
}
t
;
};
};
...
@@ -202,11 +202,11 @@ struct lrd {
...
@@ -202,11 +202,11 @@ struct lrd {
/*
/*
* type independent area
* type independent area
*/
*/
s
32
logtid
;
/* 4: log transaction identifier */
__le
32
logtid
;
/* 4: log transaction identifier */
s32
backchain
;
/* 4: ptr to prev record of same transaction */
__le32
backchain
;
/* 4: ptr to prev record of same transaction */
u
16
type
;
/* 2: record type */
__le
16
type
;
/* 2: record type */
s
16
length
;
/* 2: length of data in record (in byte) */
__le
16
length
;
/* 2: length of data in record (in byte) */
u32
aggregate
;
/* 4: file system lv/aggregate */
__le32
aggregate
;
/* 4: file system lv/aggregate */
/* (16) */
/* (16) */
/*
/*
...
@@ -228,10 +228,10 @@ struct lrd {
...
@@ -228,10 +228,10 @@ struct lrd {
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
*/
*/
struct
{
struct
{
u
32
fileset
;
/* 4: fileset number */
__le
32
fileset
;
/* 4: fileset number */
u
32
inode
;
/* 4: inode number */
__le
32
inode
;
/* 4: inode number */
u
16
type
;
/* 2: REDOPAGE record type */
__le
16
type
;
/* 2: REDOPAGE record type */
s
16
l2linesize
;
/* 2: log2 of line size */
__le
16
l2linesize
;
/* 2: log2 of line size */
pxd_t
pxd
;
/* 8: on-disk page pxd */
pxd_t
pxd
;
/* 8: on-disk page pxd */
}
redopage
;
/* (20) */
}
redopage
;
/* (20) */
...
@@ -244,10 +244,10 @@ struct lrd {
...
@@ -244,10 +244,10 @@ struct lrd {
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
*/
*/
struct
{
struct
{
s
32
fileset
;
/* 4: fileset number */
__le
32
fileset
;
/* 4: fileset number */
u
32
inode
;
/* 4: inode number */
__le
32
inode
;
/* 4: inode number */
u
16
type
;
/* 2: NOREDOPAGE record type */
__le
16
type
;
/* 2: NOREDOPAGE record type */
s
16
rsrvd
;
/* 2: reserved */
__le
16
rsrvd
;
/* 2: reserved */
pxd_t
pxd
;
/* 8: on-disk page pxd */
pxd_t
pxd
;
/* 8: on-disk page pxd */
}
noredopage
;
/* (20) */
}
noredopage
;
/* (20) */
...
@@ -260,10 +260,10 @@ struct lrd {
...
@@ -260,10 +260,10 @@ struct lrd {
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
* N.B. REDOPAGE, NOREDOPAGE, and UPDATEMAP must be same format;
*/
*/
struct
{
struct
{
u
32
fileset
;
/* 4: fileset number */
__le
32
fileset
;
/* 4: fileset number */
u
32
inode
;
/* 4: inode number */
__le
32
inode
;
/* 4: inode number */
u
16
type
;
/* 2: UPDATEMAP record type */
__le
16
type
;
/* 2: UPDATEMAP record type */
s
16
nxd
;
/* 2: number of extents */
__le
16
nxd
;
/* 2: number of extents */
pxd_t
pxd
;
/* 8: pxd */
pxd_t
pxd
;
/* 8: pxd */
}
updatemap
;
/* (20) */
}
updatemap
;
/* (20) */
...
@@ -279,9 +279,9 @@ struct lrd {
...
@@ -279,9 +279,9 @@ struct lrd {
*
*
*/
*/
struct
{
struct
{
s
32
fileset
;
/* 4: fileset number */
__le
32
fileset
;
/* 4: fileset number */
s
32
iagnum
;
/* 4: IAG number */
__le
32
iagnum
;
/* 4: IAG number */
s
32
inoext_idx
;
/* 4: inode extent index */
__le
32
inoext_idx
;
/* 4: inode extent index */
pxd_t
pxd
;
/* 8: on-disk page pxd */
pxd_t
pxd
;
/* 8: on-disk page pxd */
}
noredoinoext
;
/* (20) */
}
noredoinoext
;
/* (20) */
...
@@ -291,7 +291,7 @@ struct lrd {
...
@@ -291,7 +291,7 @@ struct lrd {
* replay log upto syncpt address specified;
* replay log upto syncpt address specified;
*/
*/
struct
{
struct
{
s
32
sync
;
/* 4: syncpt address (0 = here) */
__le
32
sync
;
/* 4: syncpt address (0 = here) */
}
syncpt
;
}
syncpt
;
/*
/*
...
@@ -307,8 +307,8 @@ struct lrd {
...
@@ -307,8 +307,8 @@ struct lrd {
* N.B.: nextents should be length of data/sizeof(xad_t)
* N.B.: nextents should be length of data/sizeof(xad_t)
*/
*/
struct
{
struct
{
s
32
type
;
/* 4: FREEXTENT record type */
__le
32
type
;
/* 4: FREEXTENT record type */
s
32
nextent
;
/* 4: number of extents */
__le
32
nextent
;
/* 4: number of extents */
/* data: PXD or XAD list */
/* data: PXD or XAD list */
}
freextent
;
}
freextent
;
...
@@ -327,8 +327,8 @@ struct lrd {
...
@@ -327,8 +327,8 @@ struct lrd {
* replay of the
* replay of the
*/
*/
struct
{
struct
{
s
32
fileset
;
/* 4: fileset number */
__le
32
fileset
;
/* 4: fileset number */
u
32
inode
;
/* 4: inode number */
__le
32
inode
;
/* 4: inode number */
}
noredofile
;
}
noredofile
;
/*
/*
...
@@ -337,9 +337,9 @@ struct lrd {
...
@@ -337,9 +337,9 @@ struct lrd {
* metadata type dependent
* metadata type dependent
*/
*/
struct
{
struct
{
s
32
fileset
;
/* 4: fileset number */
__le
32
fileset
;
/* 4: fileset number */
u
32
inode
;
/* 4: inode number */
__le
32
inode
;
/* 4: inode number */
s
32
type
;
/* 4: NEWPAGE record type */
__le
32
type
;
/* 4: NEWPAGE record type */
pxd_t
pxd
;
/* 8: on-disk page pxd */
pxd_t
pxd
;
/* 8: on-disk page pxd */
}
newpage
;
}
newpage
;
...
@@ -357,8 +357,8 @@ struct lrd {
...
@@ -357,8 +357,8 @@ struct lrd {
* line vector descriptor
* line vector descriptor
*/
*/
struct
lvd
{
struct
lvd
{
s
16
offset
;
__le
16
offset
;
s
16
length
;
__le
16
length
;
};
};
...
@@ -372,7 +372,7 @@ struct jfs_log {
...
@@ -372,7 +372,7 @@ struct jfs_log {
*/
*/
struct
list_head
journal_list
;
/* Global list */
struct
list_head
journal_list
;
/* Global list */
struct
block_device
*
bdev
;
/* 4: log lv pointer */
struct
block_device
*
bdev
;
/* 4: log lv pointer */
s32
serial
;
/* 4: log mount serial number */
int
serial
;
/* 4: log mount serial number */
s64
base
;
/* @8: log extent address (inline log ) */
s64
base
;
/* @8: log extent address (inline log ) */
int
size
;
/* 4: log size in log page (in page) */
int
size
;
/* 4: log size in log page (in page) */
...
@@ -398,7 +398,7 @@ struct jfs_log {
...
@@ -398,7 +398,7 @@ struct jfs_log {
/* commit */
/* commit */
uint
cflag
;
/* 4: */
uint
cflag
;
/* 4: */
struct
list_head
cqueue
;
/* FIFO commit queue */
struct
list_head
cqueue
;
/* FIFO commit queue */
struct
tblock
*
flush_tblk
;
/* tblk we're waiting on for flush */
struct
tblock
*
flush_tblk
;
/* tblk we're waiting on for flush */
int
gcrtc
;
/* 4: GC_READY transaction count */
int
gcrtc
;
/* 4: GC_READY transaction count */
struct
tblock
*
gclrt
;
/* 4: latest GC_READY transaction */
struct
tblock
*
gclrt
;
/* 4: latest GC_READY transaction */
...
...
fs/jfs/jfs_metapage.c
View file @
482003f2
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
static
spinlock_t
meta_lock
=
SPIN_LOCK_UNLOCKED
;
static
spinlock_t
meta_lock
=
SPIN_LOCK_UNLOCKED
;
#ifdef CONFIG_JFS_STATISTICS
#ifdef CONFIG_JFS_STATISTICS
struct
{
st
atic
st
ruct
{
uint
pagealloc
;
/* # of page allocations */
uint
pagealloc
;
/* # of page allocations */
uint
pagefree
;
/* # of page frees */
uint
pagefree
;
/* # of page frees */
uint
lockwait
;
/* # of sleeping lock_metapage() calls */
uint
lockwait
;
/* # of sleeping lock_metapage() calls */
...
@@ -108,9 +108,9 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags)
...
@@ -108,9 +108,9 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags)
}
}
}
}
static
inline
struct
metapage
*
alloc_metapage
(
int
no_wait
)
static
inline
struct
metapage
*
alloc_metapage
(
int
gfp_mask
)
{
{
return
mempool_alloc
(
metapage_mempool
,
no_wait
?
GFP_ATOMIC
:
GFP_NOFS
);
return
mempool_alloc
(
metapage_mempool
,
gfp_mask
);
}
}
static
inline
void
free_metapage
(
struct
metapage
*
mp
)
static
inline
void
free_metapage
(
struct
metapage
*
mp
)
...
@@ -289,7 +289,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
...
@@ -289,7 +289,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
*/
*/
mp
=
NULL
;
mp
=
NULL
;
if
(
JFS_IP
(
inode
)
->
fileset
==
AGGREGATE_I
)
{
if
(
JFS_IP
(
inode
)
->
fileset
==
AGGREGATE_I
)
{
mp
=
mempool_alloc
(
metapage_mempool
,
GFP_ATOMIC
);
mp
=
alloc_metapage
(
GFP_ATOMIC
);
if
(
!
mp
)
{
if
(
!
mp
)
{
/*
/*
* mempool is supposed to protect us from
* mempool is supposed to protect us from
...
@@ -306,7 +306,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
...
@@ -306,7 +306,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
struct
metapage
*
mp2
;
struct
metapage
*
mp2
;
spin_unlock
(
&
meta_lock
);
spin_unlock
(
&
meta_lock
);
mp
=
mempool_alloc
(
metapage_mempool
,
GFP_NOFS
);
mp
=
alloc_metapage
(
GFP_NOFS
);
spin_lock
(
&
meta_lock
);
spin_lock
(
&
meta_lock
);
/* we dropped the meta_lock, we need to search the
/* we dropped the meta_lock, we need to search the
...
...
fs/jfs/jfs_mount.c
View file @
482003f2
...
@@ -324,7 +324,7 @@ static int chkSuper(struct super_block *sb)
...
@@ -324,7 +324,7 @@ static int chkSuper(struct super_block *sb)
*/
*/
/* validate fs signature */
/* validate fs signature */
if
(
strncmp
(
j_sb
->
s_magic
,
JFS_MAGIC
,
4
)
||
if
(
strncmp
(
j_sb
->
s_magic
,
JFS_MAGIC
,
4
)
||
j_sb
->
s_version
>
cpu_to_le32
(
JFS_VERSION
)
)
{
le32_to_cpu
(
j_sb
->
s_version
)
>
JFS_VERSION
)
{
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
goto
out
;
goto
out
;
}
}
...
...
fs/jfs/jfs_superblock.h
View file @
482003f2
...
@@ -35,29 +35,29 @@
...
@@ -35,29 +35,29 @@
*/
*/
struct
jfs_superblock
{
struct
jfs_superblock
{
char
s_magic
[
4
];
/* 4: magic number */
char
s_magic
[
4
];
/* 4: magic number */
u32
s_version
;
/* 4: version number */
__le32
s_version
;
/* 4: version number */
s
64
s_size
;
/* 8: aggregate size in hardware/LVM blocks;
__le
64
s_size
;
/* 8: aggregate size in hardware/LVM blocks;
* VFS: number of blocks
* VFS: number of blocks
*/
*/
s
32
s_bsize
;
/* 4: aggregate block size in bytes;
__le
32
s_bsize
;
/* 4: aggregate block size in bytes;
* VFS: fragment size
* VFS: fragment size
*/
*/
s16
s_l2bsize
;
/* 2: log2 of s_bsize */
__le16
s_l2bsize
;
/* 2: log2 of s_bsize */
s
16
s_l2bfactor
;
/* 2: log2(s_bsize/hardware block size) */
__le
16
s_l2bfactor
;
/* 2: log2(s_bsize/hardware block size) */
s32
s_pbsize
;
/* 4: hardware/LVM block size in bytes */
__le32
s_pbsize
;
/* 4: hardware/LVM block size in bytes */
s16
s_l2pbsize
;
/* 2: log2 of s_pbsize */
__le16
s_l2pbsize
;
/* 2: log2 of s_pbsize */
s
16
pad
;
/* 2: padding necessary for alignment */
__le
16
pad
;
/* 2: padding necessary for alignment */
u32
s_agsize
;
/* 4: allocation group size in aggr. blocks */
__le32
s_agsize
;
/* 4: allocation group size in aggr. blocks */
u
32
s_flag
;
/* 4: aggregate attributes:
__le
32
s_flag
;
/* 4: aggregate attributes:
* see jfs_filsys.h
* see jfs_filsys.h
*/
*/
u
32
s_state
;
/* 4: mount/unmount/recovery state:
__le
32
s_state
;
/* 4: mount/unmount/recovery state:
* see jfs_filsys.h
* see jfs_filsys.h
*/
*/
s
32
s_compress
;
/* 4: > 0 if data compression */
__le
32
s_compress
;
/* 4: > 0 if data compression */
pxd_t
s_ait2
;
/* 8: first extent of secondary
pxd_t
s_ait2
;
/* 8: first extent of secondary
* aggregate inode table
* aggregate inode table
...
@@ -66,15 +66,15 @@ struct jfs_superblock {
...
@@ -66,15 +66,15 @@ struct jfs_superblock {
pxd_t
s_aim2
;
/* 8: first extent of secondary
pxd_t
s_aim2
;
/* 8: first extent of secondary
* aggregate inode map
* aggregate inode map
*/
*/
u
32
s_logdev
;
/* 4: device address of log */
__le
32
s_logdev
;
/* 4: device address of log */
s
32
s_logserial
;
/* 4: log serial number at aggregate mount */
__le
32
s_logserial
;
/* 4: log serial number at aggregate mount */
pxd_t
s_logpxd
;
/* 8: inline log extent */
pxd_t
s_logpxd
;
/* 8: inline log extent */
pxd_t
s_fsckpxd
;
/* 8: inline fsck work space extent */
pxd_t
s_fsckpxd
;
/* 8: inline fsck work space extent */
struct
timestruc_t
s_time
;
/* 8: time last updated */
struct
timestruc_t
s_time
;
/* 8: time last updated */
s
32
s_fsckloglen
;
/* 4: Number of filesystem blocks reserved for
__le
32
s_fsckloglen
;
/* 4: Number of filesystem blocks reserved for
* the fsck service log.
* the fsck service log.
* N.B. These blocks are divided among the
* N.B. These blocks are divided among the
* versions kept. This is not a per
* versions kept. This is not a per
...
@@ -95,7 +95,7 @@ struct jfs_superblock {
...
@@ -95,7 +95,7 @@ struct jfs_superblock {
*/
*/
/* extendfs() parameter under s_state & FM_EXTENDFS */
/* extendfs() parameter under s_state & FM_EXTENDFS */
s
64
s_xsize
;
/* 8: extendfs s_size */
__le
64
s_xsize
;
/* 8: extendfs s_size */
pxd_t
s_xfsckpxd
;
/* 8: extendfs fsckpxd */
pxd_t
s_xfsckpxd
;
/* 8: extendfs fsckpxd */
pxd_t
s_xlogpxd
;
/* 8: extendfs logpxd */
pxd_t
s_xlogpxd
;
/* 8: extendfs logpxd */
/* - 128 byte boundary - */
/* - 128 byte boundary - */
...
...
fs/jfs/jfs_txnmgr.c
View file @
482003f2
...
@@ -80,7 +80,7 @@ static struct {
...
@@ -80,7 +80,7 @@ static struct {
int
jfs_tlocks_low
;
/* Indicates low number of available tlocks */
int
jfs_tlocks_low
;
/* Indicates low number of available tlocks */
#ifdef CONFIG_JFS_STATISTICS
#ifdef CONFIG_JFS_STATISTICS
struct
{
st
atic
st
ruct
{
uint
txBegin
;
uint
txBegin
;
uint
txBegin_barrier
;
uint
txBegin_barrier
;
uint
txBegin_lockslow
;
uint
txBegin_lockslow
;
...
@@ -152,7 +152,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event)
...
@@ -152,7 +152,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event)
/*
/*
* statistics
* statistics
*/
*/
struct
{
st
atic
st
ruct
{
tid_t
maxtid
;
/* 4: biggest tid ever used */
tid_t
maxtid
;
/* 4: biggest tid ever used */
lid_t
maxlid
;
/* 4: biggest lid ever used */
lid_t
maxlid
;
/* 4: biggest lid ever used */
int
ntid
;
/* 4: # of transactions performed */
int
ntid
;
/* 4: # of transactions performed */
...
...
fs/jfs/jfs_types.h
View file @
482003f2
...
@@ -45,8 +45,8 @@ typedef u16 lid_t;
...
@@ -45,8 +45,8 @@ typedef u16 lid_t;
* Almost identical to Linux's timespec, but not quite
* Almost identical to Linux's timespec, but not quite
*/
*/
struct
timestruc_t
{
struct
timestruc_t
{
u
32
tv_sec
;
__le
32
tv_sec
;
u
32
tv_nsec
;
__le
32
tv_nsec
;
};
};
/*
/*
...
@@ -96,7 +96,7 @@ struct lxdlist {
...
@@ -96,7 +96,7 @@ struct lxdlist {
typedef
struct
{
typedef
struct
{
unsigned
len
:
24
;
unsigned
len
:
24
;
unsigned
addr1
:
8
;
unsigned
addr1
:
8
;
u
32
addr2
;
__le
32
addr2
;
}
pxd_t
;
}
pxd_t
;
/* xd_t field construction */
/* xd_t field construction */
...
@@ -127,11 +127,11 @@ struct pxdlist {
...
@@ -127,11 +127,11 @@ struct pxdlist {
*/
*/
typedef
struct
{
typedef
struct
{
unsigned
flag
:
8
;
/* 1: flags */
unsigned
flag
:
8
;
/* 1: flags */
unsigned
rsrvd
:
24
;
/* 3: */
unsigned
rsrvd
:
24
;
u
32
size
;
/* 4: size in byte */
__le
32
size
;
/* 4: size in byte */
unsigned
len
:
24
;
/* 3: length in unit of fsblksize */
unsigned
len
:
24
;
/* 3: length in unit of fsblksize */
unsigned
addr1
:
8
;
/* 1: address in unit of fsblksize */
unsigned
addr1
:
8
;
/* 1: address in unit of fsblksize */
u
32
addr2
;
/* 4: address in unit of fsblksize */
__le
32
addr2
;
/* 4: address in unit of fsblksize */
}
dxd_t
;
/* - 16 - */
}
dxd_t
;
/* - 16 - */
/* dxd_t flags */
/* dxd_t flags */
...
@@ -168,10 +168,10 @@ struct dasd {
...
@@ -168,10 +168,10 @@ struct dasd {
u8
delta
;
/* Alert Threshold delta (in percent) */
u8
delta
;
/* Alert Threshold delta (in percent) */
u8
rsrvd1
;
u8
rsrvd1
;
u8
limit_hi
;
/* DASD limit (in logical blocks) */
u8
limit_hi
;
/* DASD limit (in logical blocks) */
u32
limit_lo
;
/* DASD limit (in logical blocks) */
__le32
limit_lo
;
/* DASD limit (in logical blocks) */
u8
rsrvd2
[
3
];
u8
rsrvd2
[
3
];
u8
used_hi
;
/* DASD usage (in logical blocks) */
u8
used_hi
;
/* DASD usage (in logical blocks) */
u
32
used_lo
;
/* DASD usage (in logical blocks) */
__le
32
used_lo
;
/* DASD usage (in logical blocks) */
};
};
#define DASDLIMIT(dasdp) \
#define DASDLIMIT(dasdp) \
...
...
fs/jfs/jfs_unicode.c
View file @
482003f2
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
* FUNCTION: Convert little-endian unicode string to character string
* FUNCTION: Convert little-endian unicode string to character string
*
*
*/
*/
int
jfs_strfromUCS_le
(
char
*
to
,
const
wchar_t
*
from
,
/* LITTLE ENDIAN */
int
jfs_strfromUCS_le
(
char
*
to
,
const
__le16
*
from
,
int
len
,
struct
nls_table
*
codepage
)
int
len
,
struct
nls_table
*
codepage
)
{
{
int
i
;
int
i
;
...
...
fs/jfs/jfs_unicode.h
View file @
482003f2
...
@@ -31,7 +31,7 @@ typedef struct {
...
@@ -31,7 +31,7 @@ typedef struct {
extern
signed
char
UniUpperTable
[
512
];
extern
signed
char
UniUpperTable
[
512
];
extern
UNICASERANGE
UniUpperRange
[];
extern
UNICASERANGE
UniUpperRange
[];
extern
int
get_UCSname
(
struct
component_name
*
,
struct
dentry
*
);
extern
int
get_UCSname
(
struct
component_name
*
,
struct
dentry
*
);
extern
int
jfs_strfromUCS_le
(
char
*
,
const
wchar_t
*
,
int
,
struct
nls_table
*
);
extern
int
jfs_strfromUCS_le
(
char
*
,
const
__le16
*
,
int
,
struct
nls_table
*
);
#define free_UCSname(COMP) kfree((COMP)->name)
#define free_UCSname(COMP) kfree((COMP)->name)
...
@@ -51,10 +51,10 @@ static inline wchar_t *UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2)
...
@@ -51,10 +51,10 @@ static inline wchar_t *UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2)
/*
/*
* UniStrncpy: Copy length limited string with pad
* UniStrncpy: Copy length limited string with pad
*/
*/
static
inline
wchar_t
*
UniStrncpy
(
wchar_t
*
ucs1
,
const
wchar_t
*
ucs2
,
static
inline
__le16
*
UniStrncpy_le
(
__le16
*
ucs1
,
const
__le16
*
ucs2
,
size_t
n
)
size_t
n
)
{
{
wchar_t
*
anchor
=
ucs1
;
__le16
*
anchor
=
ucs1
;
while
(
n
--
&&
*
ucs2
)
/* Copy the strings */
while
(
n
--
&&
*
ucs2
)
/* Copy the strings */
*
ucs1
++
=
*
ucs2
++
;
*
ucs1
++
=
*
ucs2
++
;
...
@@ -68,7 +68,7 @@ static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2,
...
@@ -68,7 +68,7 @@ static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2,
/*
/*
* UniStrncmp_le: Compare length limited string - native to little-endian
* UniStrncmp_le: Compare length limited string - native to little-endian
*/
*/
static
inline
int
UniStrncmp_le
(
const
wchar_t
*
ucs1
,
const
wchar_t
*
ucs2
,
static
inline
int
UniStrncmp_le
(
const
wchar_t
*
ucs1
,
const
__le16
*
ucs2
,
size_t
n
)
size_t
n
)
{
{
if
(
!
n
)
if
(
!
n
)
...
@@ -81,10 +81,27 @@ static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2,
...
@@ -81,10 +81,27 @@ static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2,
}
}
/*
/*
* UniStrncpy_le: Copy length limited string with pad to little-endian
* UniStrncpy_to_le: Copy length limited string with pad to little-endian
*/
static
inline
__le16
*
UniStrncpy_to_le
(
__le16
*
ucs1
,
const
wchar_t
*
ucs2
,
size_t
n
)
{
__le16
*
anchor
=
ucs1
;
while
(
n
--
&&
*
ucs2
)
/* Copy the strings */
*
ucs1
++
=
cpu_to_le16
(
*
ucs2
++
);
n
++
;
while
(
n
--
)
/* Pad with nulls */
*
ucs1
++
=
0
;
return
anchor
;
}
/*
* UniStrncpy_from_le: Copy length limited string with pad from little-endian
*/
*/
static
inline
wchar_t
*
UniStrncpy_
le
(
wchar_t
*
ucs1
,
const
wchar_t
*
ucs2
,
static
inline
wchar_t
*
UniStrncpy_
from_le
(
wchar_t
*
ucs1
,
const
__le16
*
ucs2
,
size_t
n
)
size_t
n
)
{
{
wchar_t
*
anchor
=
ucs1
;
wchar_t
*
anchor
=
ucs1
;
...
@@ -97,7 +114,6 @@ static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2,
...
@@ -97,7 +114,6 @@ static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2,
return
anchor
;
return
anchor
;
}
}
/*
/*
* UniToupper: Convert a unicode character to upper case
* UniToupper: Convert a unicode character to upper case
*/
*/
...
...
fs/jfs/jfs_xattr.h
View file @
482003f2
...
@@ -27,12 +27,12 @@
...
@@ -27,12 +27,12 @@
struct
jfs_ea
{
struct
jfs_ea
{
u8
flag
;
/* Unused? */
u8
flag
;
/* Unused? */
u8
namelen
;
/* Length of name */
u8
namelen
;
/* Length of name */
u
16
valuelen
;
/* Length of value */
__le
16
valuelen
;
/* Length of value */
char
name
[
0
];
/* Attribute name (includes null-terminator) */
char
name
[
0
];
/* Attribute name (includes null-terminator) */
};
/* Value immediately follows name */
};
/* Value immediately follows name */
struct
jfs_ea_list
{
struct
jfs_ea_list
{
u
32
size
;
/* overall size */
__le
32
size
;
/* overall size */
struct
jfs_ea
ea
[
0
];
/* Variable length list */
struct
jfs_ea
ea
[
0
];
/* Variable length list */
};
};
...
...
fs/jfs/jfs_xtree.c
View file @
482003f2
...
@@ -958,7 +958,7 @@ xtSplitUp(tid_t tid,
...
@@ -958,7 +958,7 @@ xtSplitUp(tid_t tid,
/* is inode xtree root extension/inline EA area free ? */
/* is inode xtree root extension/inline EA area free ? */
if
((
sp
->
header
.
flag
&
BT_ROOT
)
&&
(
!
S_ISDIR
(
ip
->
i_mode
))
&&
if
((
sp
->
header
.
flag
&
BT_ROOT
)
&&
(
!
S_ISDIR
(
ip
->
i_mode
))
&&
(
sp
->
header
.
maxentry
<
cpu_to_le16
(
XTROOTMAXSLOT
)
)
&&
(
le16_to_cpu
(
sp
->
header
.
maxentry
)
<
XTROOTMAXSLOT
)
&&
(
JFS_IP
(
ip
)
->
mode2
&
INLINEEA
))
{
(
JFS_IP
(
ip
)
->
mode2
&
INLINEEA
))
{
sp
->
header
.
maxentry
=
cpu_to_le16
(
XTROOTMAXSLOT
);
sp
->
header
.
maxentry
=
cpu_to_le16
(
XTROOTMAXSLOT
);
JFS_IP
(
ip
)
->
mode2
&=
~
INLINEEA
;
JFS_IP
(
ip
)
->
mode2
&=
~
INLINEEA
;
...
@@ -1622,7 +1622,6 @@ int xtExtend(tid_t tid, /* transaction id */
...
@@ -1622,7 +1622,6 @@ int xtExtend(tid_t tid, /* transaction id */
s64
xaddr
;
s64
xaddr
;
struct
tlock
*
tlck
;
struct
tlock
*
tlck
;
struct
xtlock
*
xtlck
=
NULL
;
struct
xtlock
*
xtlck
=
NULL
;
int
rootsplit
=
0
;
jfs_info
(
"xtExtend: nxoff:0x%lx nxlen:0x%x"
,
(
ulong
)
xoff
,
xlen
);
jfs_info
(
"xtExtend: nxoff:0x%lx nxlen:0x%x"
,
(
ulong
)
xoff
,
xlen
);
...
@@ -1678,8 +1677,6 @@ int xtExtend(tid_t tid, /* transaction id */
...
@@ -1678,8 +1677,6 @@ int xtExtend(tid_t tid, /* transaction id */
* The xtSplitUp() will insert the entry and unpin the leaf page.
* The xtSplitUp() will insert the entry and unpin the leaf page.
*/
*/
if
(
nextindex
==
le16_to_cpu
(
p
->
header
.
maxentry
))
{
if
(
nextindex
==
le16_to_cpu
(
p
->
header
.
maxentry
))
{
rootsplit
=
p
->
header
.
flag
&
BT_ROOT
;
/* xtSpliUp() unpins leaf pages */
/* xtSpliUp() unpins leaf pages */
split
.
mp
=
mp
;
split
.
mp
=
mp
;
split
.
index
=
index
+
1
;
split
.
index
=
index
+
1
;
...
@@ -1691,16 +1688,21 @@ int xtExtend(tid_t tid, /* transaction id */
...
@@ -1691,16 +1688,21 @@ int xtExtend(tid_t tid, /* transaction id */
if
((
rc
=
xtSplitUp
(
tid
,
ip
,
&
split
,
&
btstack
)))
if
((
rc
=
xtSplitUp
(
tid
,
ip
,
&
split
,
&
btstack
)))
return
rc
;
return
rc
;
/* get back old page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
return
rc
;
/*
/*
* if leaf root has been split, original root has been
* if leaf root has been split, original root has been
* copied to new child page, i.e., original entry now
* copied to new child page, i.e., original entry now
* resides on the new child page;
* resides on the new child page;
*/
*/
if
(
rootsplit
)
{
if
(
p
->
header
.
flag
&
BT_INTERNAL
)
{
ASSERT
(
p
->
header
.
nextindex
==
ASSERT
(
p
->
header
.
nextindex
==
cpu_to_le16
(
XTENTRYSTART
+
1
));
cpu_to_le16
(
XTENTRYSTART
+
1
));
xad
=
&
p
->
xad
[
XTENTRYSTART
];
xad
=
&
p
->
xad
[
XTENTRYSTART
];
bn
=
addressXAD
(
xad
);
bn
=
addressXAD
(
xad
);
XT_PUTPAGE
(
mp
);
/* get new child page */
/* get new child page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
...
@@ -1712,11 +1714,6 @@ int xtExtend(tid_t tid, /* transaction id */
...
@@ -1712,11 +1714,6 @@ int xtExtend(tid_t tid, /* transaction id */
tlck
=
txLock
(
tid
,
ip
,
mp
,
tlckXTREE
|
tlckGROW
);
tlck
=
txLock
(
tid
,
ip
,
mp
,
tlckXTREE
|
tlckGROW
);
xtlck
=
(
struct
xtlock
*
)
&
tlck
->
lock
;
xtlck
=
(
struct
xtlock
*
)
&
tlck
->
lock
;
}
}
}
else
{
/* get back old page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
return
rc
;
}
}
}
}
/*
/*
...
@@ -1790,7 +1787,6 @@ int xtTailgate(tid_t tid, /* transaction id */
...
@@ -1790,7 +1787,6 @@ int xtTailgate(tid_t tid, /* transaction id */
struct
xtlock
*
xtlck
=
0
;
struct
xtlock
*
xtlck
=
0
;
struct
tlock
*
mtlck
;
struct
tlock
*
mtlck
;
struct
maplock
*
pxdlock
;
struct
maplock
*
pxdlock
;
int
rootsplit
=
0
;
/*
/*
printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n",
printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n",
...
@@ -1848,8 +1844,6 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
...
@@ -1848,8 +1844,6 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
* The xtSplitUp() will insert the entry and unpin the leaf page.
* The xtSplitUp() will insert the entry and unpin the leaf page.
*/
*/
if
(
nextindex
==
le16_to_cpu
(
p
->
header
.
maxentry
))
{
if
(
nextindex
==
le16_to_cpu
(
p
->
header
.
maxentry
))
{
rootsplit
=
p
->
header
.
flag
&
BT_ROOT
;
/* xtSpliUp() unpins leaf pages */
/* xtSpliUp() unpins leaf pages */
split
.
mp
=
mp
;
split
.
mp
=
mp
;
split
.
index
=
index
+
1
;
split
.
index
=
index
+
1
;
...
@@ -1861,16 +1855,21 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
...
@@ -1861,16 +1855,21 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
if
((
rc
=
xtSplitUp
(
tid
,
ip
,
&
split
,
&
btstack
)))
if
((
rc
=
xtSplitUp
(
tid
,
ip
,
&
split
,
&
btstack
)))
return
rc
;
return
rc
;
/* get back old page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
return
rc
;
/*
/*
* if leaf root has been split, original root has been
* if leaf root has been split, original root has been
* copied to new child page, i.e., original entry now
* copied to new child page, i.e., original entry now
* resides on the new child page;
* resides on the new child page;
*/
*/
if
(
rootsplit
)
{
if
(
p
->
header
.
flag
&
BT_INTERNAL
)
{
ASSERT
(
p
->
header
.
nextindex
==
ASSERT
(
p
->
header
.
nextindex
==
cpu_to_le16
(
XTENTRYSTART
+
1
));
cpu_to_le16
(
XTENTRYSTART
+
1
));
xad
=
&
p
->
xad
[
XTENTRYSTART
];
xad
=
&
p
->
xad
[
XTENTRYSTART
];
bn
=
addressXAD
(
xad
);
bn
=
addressXAD
(
xad
);
XT_PUTPAGE
(
mp
);
/* get new child page */
/* get new child page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
...
@@ -1882,11 +1881,6 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
...
@@ -1882,11 +1881,6 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n",
tlck
=
txLock
(
tid
,
ip
,
mp
,
tlckXTREE
|
tlckGROW
);
tlck
=
txLock
(
tid
,
ip
,
mp
,
tlckXTREE
|
tlckGROW
);
xtlck
=
(
struct
xtlock
*
)
&
tlck
->
lock
;
xtlck
=
(
struct
xtlock
*
)
&
tlck
->
lock
;
}
}
}
else
{
/* get back old page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
return
rc
;
}
}
}
}
/*
/*
...
@@ -1976,7 +1970,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
...
@@ -1976,7 +1970,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
s64
nxaddr
,
xaddr
;
s64
nxaddr
,
xaddr
;
struct
tlock
*
tlck
;
struct
tlock
*
tlck
;
struct
xtlock
*
xtlck
=
NULL
;
struct
xtlock
*
xtlck
=
NULL
;
int
rootsplit
=
0
,
newpage
=
0
;
int
newpage
=
0
;
/* there must exist extent to be tailgated */
/* there must exist extent to be tailgated */
nxoff
=
offsetXAD
(
nxad
);
nxoff
=
offsetXAD
(
nxad
);
...
@@ -2183,7 +2177,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
...
@@ -2183,7 +2177,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
/* insert nXAD:recorded */
/* insert nXAD:recorded */
if
(
nextindex
==
le16_to_cpu
(
p
->
header
.
maxentry
))
{
if
(
nextindex
==
le16_to_cpu
(
p
->
header
.
maxentry
))
{
rootsplit
=
p
->
header
.
flag
&
BT_ROOT
;
/* xtSpliUp() unpins leaf pages */
/* xtSpliUp() unpins leaf pages */
split
.
mp
=
mp
;
split
.
mp
=
mp
;
...
@@ -2196,16 +2189,21 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
...
@@ -2196,16 +2189,21 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
if
((
rc
=
xtSplitUp
(
tid
,
ip
,
&
split
,
&
btstack
)))
if
((
rc
=
xtSplitUp
(
tid
,
ip
,
&
split
,
&
btstack
)))
return
rc
;
return
rc
;
/* get back old page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
return
rc
;
/*
/*
* if leaf root has been split, original root has been
* if leaf root has been split, original root has been
* copied to new child page, i.e., original entry now
* copied to new child page, i.e., original entry now
* resides on the new child page;
* resides on the new child page;
*/
*/
if
(
rootsplit
)
{
if
(
p
->
header
.
flag
&
BT_INTERNAL
)
{
ASSERT
(
p
->
header
.
nextindex
==
ASSERT
(
p
->
header
.
nextindex
==
cpu_to_le16
(
XTENTRYSTART
+
1
));
cpu_to_le16
(
XTENTRYSTART
+
1
));
xad
=
&
p
->
xad
[
XTENTRYSTART
];
xad
=
&
p
->
xad
[
XTENTRYSTART
];
bn
=
addressXAD
(
xad
);
bn
=
addressXAD
(
xad
);
XT_PUTPAGE
(
mp
);
/* get new child page */
/* get new child page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
...
@@ -2218,11 +2216,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
...
@@ -2218,11 +2216,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
xtlck
=
(
struct
xtlock
*
)
&
tlck
->
lock
;
xtlck
=
(
struct
xtlock
*
)
&
tlck
->
lock
;
}
}
}
else
{
}
else
{
/* get back old page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
return
rc
;
/* is nXAD on new page ? */
/* is nXAD on new page ? */
if
(
newindex
>
if
(
newindex
>
(
le16_to_cpu
(
p
->
header
.
maxentry
)
>>
1
))
{
(
le16_to_cpu
(
p
->
header
.
maxentry
)
>>
1
))
{
...
@@ -2336,8 +2329,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
...
@@ -2336,8 +2329,6 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
xlen
=
xlen
-
nxlen
;
xlen
=
xlen
-
nxlen
;
xaddr
=
xaddr
+
nxlen
;
xaddr
=
xaddr
+
nxlen
;
if
(
nextindex
==
le16_to_cpu
(
p
->
header
.
maxentry
))
{
if
(
nextindex
==
le16_to_cpu
(
p
->
header
.
maxentry
))
{
rootsplit
=
p
->
header
.
flag
&
BT_ROOT
;
/*
/*
printf("xtUpdate.updateLeft.split p:0x%p\n", p);
printf("xtUpdate.updateLeft.split p:0x%p\n", p);
*/
*/
...
@@ -2352,16 +2343,22 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p);
...
@@ -2352,16 +2343,22 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p);
if
((
rc
=
xtSplitUp
(
tid
,
ip
,
&
split
,
&
btstack
)))
if
((
rc
=
xtSplitUp
(
tid
,
ip
,
&
split
,
&
btstack
)))
return
rc
;
return
rc
;
/* get back old page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
return
rc
;
/*
/*
* if leaf root has been split, original root has been
* if leaf root has been split, original root has been
* copied to new child page, i.e., original entry now
* copied to new child page, i.e., original entry now
* resides on the new child page;
* resides on the new child page;
*/
*/
if
(
rootsplit
)
{
if
(
p
->
header
.
flag
&
BT_INTERNAL
)
{
ASSERT
(
p
->
header
.
nextindex
==
ASSERT
(
p
->
header
.
nextindex
==
cpu_to_le16
(
XTENTRYSTART
+
1
));
cpu_to_le16
(
XTENTRYSTART
+
1
));
xad
=
&
p
->
xad
[
XTENTRYSTART
];
xad
=
&
p
->
xad
[
XTENTRYSTART
];
bn
=
addressXAD
(
xad
);
bn
=
addressXAD
(
xad
);
XT_PUTPAGE
(
mp
);
/* get new child page */
/* get new child page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
...
@@ -2373,11 +2370,6 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p);
...
@@ -2373,11 +2370,6 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p);
tlck
=
txLock
(
tid
,
ip
,
mp
,
tlckXTREE
|
tlckGROW
);
tlck
=
txLock
(
tid
,
ip
,
mp
,
tlckXTREE
|
tlckGROW
);
xtlck
=
(
struct
xtlock
*
)
&
tlck
->
lock
;
xtlck
=
(
struct
xtlock
*
)
&
tlck
->
lock
;
}
}
}
else
{
/* get back old page */
XT_GETPAGE
(
ip
,
bn
,
mp
,
PSIZE
,
p
,
rc
);
if
(
rc
)
return
rc
;
}
}
}
else
{
}
else
{
/* if insert into middle, shift right remaining entries */
/* if insert into middle, shift right remaining entries */
...
...
fs/jfs/jfs_xtree.h
View file @
482003f2
...
@@ -32,10 +32,10 @@ typedef struct xad {
...
@@ -32,10 +32,10 @@ typedef struct xad {
unsigned
flag
:
8
;
/* 1: flag */
unsigned
flag
:
8
;
/* 1: flag */
unsigned
rsvrd
:
16
;
/* 2: reserved */
unsigned
rsvrd
:
16
;
/* 2: reserved */
unsigned
off1
:
8
;
/* 1: offset in unit of fsblksize */
unsigned
off1
:
8
;
/* 1: offset in unit of fsblksize */
u
32
off2
;
/* 4: offset in unit of fsblksize */
__le
32
off2
;
/* 4: offset in unit of fsblksize */
unsigned
len
:
24
;
/* 3: length in unit of fsblksize */
unsigned
len
:
24
;
/* 3: length in unit of fsblksize */
unsigned
addr1
:
8
;
/* 1: address in unit of fsblksize */
unsigned
addr1
:
8
;
/* 1: address in unit of fsblksize */
u
32
addr2
;
/* 4: address in unit of fsblksize */
__le
32
addr2
;
/* 4: address in unit of fsblksize */
}
xad_t
;
/* (16) */
}
xad_t
;
/* (16) */
#define MAXXLEN ((1 << 24) - 1)
#define MAXXLEN ((1 << 24) - 1)
...
@@ -90,14 +90,14 @@ struct xadlist {
...
@@ -90,14 +90,14 @@ struct xadlist {
*/
*/
typedef
union
{
typedef
union
{
struct
xtheader
{
struct
xtheader
{
s
64
next
;
/* 8: */
__le
64
next
;
/* 8: */
s
64
prev
;
/* 8: */
__le
64
prev
;
/* 8: */
u8
flag
;
/* 1: */
u8
flag
;
/* 1: */
u8
rsrvd1
;
/* 1: */
u8
rsrvd1
;
/* 1: */
s
16
nextindex
;
/* 2: next index = number of entries */
__le
16
nextindex
;
/* 2: next index = number of entries */
s
16
maxentry
;
/* 2: max number of entries */
__le
16
maxentry
;
/* 2: max number of entries */
s
16
rsrvd2
;
/* 2: */
__le
16
rsrvd2
;
/* 2: */
pxd_t
self
;
/* 8: self */
pxd_t
self
;
/* 8: self */
}
header
;
/* (32) */
}
header
;
/* (32) */
...
...
fs/partitions/Kconfig
View file @
482003f2
...
@@ -219,7 +219,7 @@ config SUN_PARTITION
...
@@ -219,7 +219,7 @@ config SUN_PARTITION
config EFI_PARTITION
config EFI_PARTITION
bool "EFI GUID Partition support"
bool "EFI GUID Partition support"
depends on PARTITION_ADVANCED
&& IA64
depends on PARTITION_ADVANCED
select CRC32
select CRC32
help
help
Say Y here if you would like to use hard disks under Linux which
Say Y here if you would like to use hard disks under Linux which
...
...
fs/partitions/efi.c
View file @
482003f2
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* Per Intel EFI Specification v1.02
* Per Intel EFI Specification v1.02
* http://developer.intel.com/technology/efi/efi.htm
* http://developer.intel.com/technology/efi/efi.htm
* efi.[ch] by Matt Domsch <Matt_Domsch@dell.com>
* efi.[ch] by Matt Domsch <Matt_Domsch@dell.com>
* Copyright 2000,2001,2002 Dell Inc.
* Copyright 2000,2001,2002
,2004
Dell Inc.
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -23,6 +23,11 @@
...
@@ -23,6 +23,11 @@
* TODO:
* TODO:
*
*
* Changelog:
* Changelog:
* Mon Nov 09 2004 Matt Domsch <Matt_Domsch@dell.com>
* - test for valid PMBR and valid PGPT before ever reading
* AGPT, allow override with 'gpt' kernel command line option.
* - check for first/last_usable_lba outside of size of disk
*
* Tue Mar 26 2002 Matt Domsch <Matt_Domsch@dell.com>
* Tue Mar 26 2002 Matt Domsch <Matt_Domsch@dell.com>
* - Ported to 2.5.7-pre1 and 2.5.7-dj2
* - Ported to 2.5.7-pre1 and 2.5.7-dj2
* - Applied patch to avoid fault in alternate header handling
* - Applied patch to avoid fault in alternate header handling
...
@@ -130,32 +135,6 @@ efi_crc32(const void *buf, unsigned long len)
...
@@ -130,32 +135,6 @@ efi_crc32(const void *buf, unsigned long len)
return
(
crc32
(
~
0L
,
buf
,
len
)
^
~
0L
);
return
(
crc32
(
~
0L
,
buf
,
len
)
^
~
0L
);
}
}
/**
* is_pmbr_valid(): test Protective MBR for validity
* @mbr: pointer to a legacy mbr structure
*
* Description: Returns 1 if PMBR is valid, 0 otherwise.
* Validity depends on two things:
* 1) MSDOS signature is in the last two bytes of the MBR
* 2) One partition of type 0xEE is found
*/
static
int
is_pmbr_valid
(
legacy_mbr
*
mbr
)
{
int
i
,
found
=
0
,
signature
=
0
;
if
(
!
mbr
)
return
0
;
signature
=
(
le16_to_cpu
(
mbr
->
signature
)
==
MSDOS_MBR_SIGNATURE
);
for
(
i
=
0
;
signature
&&
i
<
4
;
i
++
)
{
if
(
mbr
->
partition_record
[
i
].
sys_ind
==
EFI_PMBR_OSTYPE_EFI_GPT
)
{
found
=
1
;
break
;
}
}
return
(
signature
&&
found
);
}
/**
/**
* last_lba(): return number of last logical block of device
* last_lba(): return number of last logical block of device
* @bdev: block device
* @bdev: block device
...
@@ -168,7 +147,40 @@ is_pmbr_valid(legacy_mbr *mbr)
...
@@ -168,7 +147,40 @@ is_pmbr_valid(legacy_mbr *mbr)
static
u64
static
u64
last_lba
(
struct
block_device
*
bdev
)
last_lba
(
struct
block_device
*
bdev
)
{
{
return
(
bdev
->
bd_inode
->
i_size
>>
9
)
-
1
;
if
(
!
bdev
||
!
bdev
->
bd_inode
)
return
0
;
return
(
bdev
->
bd_inode
->
i_size
>>
9
)
-
1ULL
;
}
static
inline
int
pmbr_part_valid
(
struct
partition
*
part
,
u64
lastlba
)
{
if
(
part
->
sys_ind
==
EFI_PMBR_OSTYPE_EFI_GPT
&&
le32_to_cpu
(
part
->
start_sect
)
==
1UL
)
return
1
;
return
0
;
}
/**
* is_pmbr_valid(): test Protective MBR for validity
* @mbr: pointer to a legacy mbr structure
* @lastlba: last_lba for the whole device
*
* Description: Returns 1 if PMBR is valid, 0 otherwise.
* Validity depends on two things:
* 1) MSDOS signature is in the last two bytes of the MBR
* 2) One partition of type 0xEE is found
*/
static
int
is_pmbr_valid
(
legacy_mbr
*
mbr
,
u64
lastlba
)
{
int
i
;
if
(
!
mbr
||
le16_to_cpu
(
mbr
->
signature
)
!=
MSDOS_MBR_SIGNATURE
)
return
0
;
for
(
i
=
0
;
i
<
4
;
i
++
)
if
(
pmbr_part_valid
(
&
mbr
->
partition_record
[
i
],
lastlba
))
return
1
;
return
0
;
}
}
/**
/**
...
@@ -186,8 +198,8 @@ read_lba(struct block_device *bdev, u64 lba, u8 * buffer, size_t count)
...
@@ -186,8 +198,8 @@ read_lba(struct block_device *bdev, u64 lba, u8 * buffer, size_t count)
{
{
size_t
totalreadcount
=
0
;
size_t
totalreadcount
=
0
;
if
(
!
bdev
||
!
buffer
)
if
(
!
bdev
||
!
buffer
||
lba
>
last_lba
(
bdev
)
)
return
0
;
return
0
;
while
(
count
)
{
while
(
count
)
{
int
copied
=
512
;
int
copied
=
512
;
...
@@ -206,7 +218,6 @@ read_lba(struct block_device *bdev, u64 lba, u8 * buffer, size_t count)
...
@@ -206,7 +218,6 @@ read_lba(struct block_device *bdev, u64 lba, u8 * buffer, size_t count)
return
totalreadcount
;
return
totalreadcount
;
}
}
/**
/**
* alloc_read_gpt_entries(): reads partition entries from disk
* alloc_read_gpt_entries(): reads partition entries from disk
* @bdev
* @bdev
...
@@ -289,6 +300,7 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
...
@@ -289,6 +300,7 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
gpt_header
**
gpt
,
gpt_entry
**
ptes
)
gpt_header
**
gpt
,
gpt_entry
**
ptes
)
{
{
u32
crc
,
origcrc
;
u32
crc
,
origcrc
;
u64
lastlba
;
if
(
!
bdev
||
!
gpt
||
!
ptes
)
if
(
!
bdev
||
!
gpt
||
!
ptes
)
return
0
;
return
0
;
...
@@ -301,9 +313,7 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
...
@@ -301,9 +313,7 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
"%lld != %lld
\n
"
,
"%lld != %lld
\n
"
,
(
unsigned
long
long
)
le64_to_cpu
((
*
gpt
)
->
signature
),
(
unsigned
long
long
)
le64_to_cpu
((
*
gpt
)
->
signature
),
(
unsigned
long
long
)
GPT_HEADER_SIGNATURE
);
(
unsigned
long
long
)
GPT_HEADER_SIGNATURE
);
kfree
(
*
gpt
);
goto
fail
;
*
gpt
=
NULL
;
return
0
;
}
}
/* Check the GUID Partition Table CRC */
/* Check the GUID Partition Table CRC */
...
@@ -315,9 +325,7 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
...
@@ -315,9 +325,7 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
Dprintk
Dprintk
(
"GUID Partition Table Header CRC is wrong: %x != %x
\n
"
,
(
"GUID Partition Table Header CRC is wrong: %x != %x
\n
"
,
crc
,
origcrc
);
crc
,
origcrc
);
kfree
(
*
gpt
);
goto
fail
;
*
gpt
=
NULL
;
return
0
;
}
}
(
*
gpt
)
->
header_crc32
=
cpu_to_le32
(
origcrc
);
(
*
gpt
)
->
header_crc32
=
cpu_to_le32
(
origcrc
);
...
@@ -327,16 +335,28 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
...
@@ -327,16 +335,28 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
Dprintk
(
"GPT my_lba incorrect: %lld != %lld
\n
"
,
Dprintk
(
"GPT my_lba incorrect: %lld != %lld
\n
"
,
(
unsigned
long
long
)
le64_to_cpu
((
*
gpt
)
->
my_lba
),
(
unsigned
long
long
)
le64_to_cpu
((
*
gpt
)
->
my_lba
),
(
unsigned
long
long
)
lba
);
(
unsigned
long
long
)
lba
);
kfree
(
*
gpt
);
goto
fail
;
*
gpt
=
NULL
;
return
0
;
}
}
if
(
!
(
*
ptes
=
alloc_read_gpt_entries
(
bdev
,
*
gpt
)))
{
/* Check the first_usable_lba and last_usable_lba are
kfree
(
*
gpt
);
* within the disk.
*
gpt
=
NULL
;
*/
return
0
;
lastlba
=
last_lba
(
bdev
);
if
(
le64_to_cpu
((
*
gpt
)
->
first_usable_lba
)
>
lastlba
)
{
Dprintk
(
"GPT: first_usable_lba incorrect: %lld > %lld
\n
"
,
(
unsigned
long
long
)
le64_to_cpu
((
*
gpt
)
->
first_usable_lba
),
(
unsigned
long
long
)
lastlba
);
goto
fail
;
}
}
if
(
le64_to_cpu
((
*
gpt
)
->
last_usable_lba
)
>
lastlba
)
{
Dprintk
(
"GPT: last_usable_lba incorrect: %lld > %lld
\n
"
,
(
unsigned
long
long
)
le64_to_cpu
((
*
gpt
)
->
last_usable_lba
),
(
unsigned
long
long
)
lastlba
);
goto
fail
;
}
if
(
!
(
*
ptes
=
alloc_read_gpt_entries
(
bdev
,
*
gpt
)))
goto
fail
;
/* Check the GUID Partition Entry Array CRC */
/* Check the GUID Partition Entry Array CRC */
crc
=
efi_crc32
((
const
unsigned
char
*
)
(
*
ptes
),
crc
=
efi_crc32
((
const
unsigned
char
*
)
(
*
ptes
),
...
@@ -345,15 +365,36 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
...
@@ -345,15 +365,36 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
if
(
crc
!=
le32_to_cpu
((
*
gpt
)
->
partition_entry_array_crc32
))
{
if
(
crc
!=
le32_to_cpu
((
*
gpt
)
->
partition_entry_array_crc32
))
{
Dprintk
(
"GUID Partitition Entry Array CRC check failed.
\n
"
);
Dprintk
(
"GUID Partitition Entry Array CRC check failed.
\n
"
);
kfree
(
*
gpt
);
goto
fail_ptes
;
*
gpt
=
NULL
;
kfree
(
*
ptes
);
*
ptes
=
NULL
;
return
0
;
}
}
/* We're done, all's well */
/* We're done, all's well */
return
1
;
return
1
;
fail_ptes:
kfree
(
*
ptes
);
*
ptes
=
NULL
;
fail:
kfree
(
*
gpt
);
*
gpt
=
NULL
;
return
0
;
}
/**
* is_pte_valid() - tests one PTE for validity
* @pte is the pte to check
* @lastlba is last lba of the disk
*
* Description: returns 1 if valid, 0 on error.
*/
static
inline
int
is_pte_valid
(
const
gpt_entry
*
pte
,
const
u64
lastlba
)
{
if
((
!
efi_guidcmp
(
pte
->
partition_type_guid
,
NULL_GUID
))
||
le64_to_cpu
(
pte
->
starting_lba
)
>
lastlba
||
le64_to_cpu
(
pte
->
ending_lba
)
>
lastlba
)
return
0
;
return
1
;
}
}
/**
/**
...
@@ -464,8 +505,13 @@ compare_gpts(gpt_header *pgpt, gpt_header *agpt, u64 lastlba)
...
@@ -464,8 +505,13 @@ compare_gpts(gpt_header *pgpt, gpt_header *agpt, u64 lastlba)
* @ptes is a PTEs ptr, filled on return.
* @ptes is a PTEs ptr, filled on return.
* Description: Returns 1 if valid, 0 on error.
* Description: Returns 1 if valid, 0 on error.
* If valid, returns pointers to newly allocated GPT header and PTEs.
* If valid, returns pointers to newly allocated GPT header and PTEs.
* Validity depends on finding either the Primary GPT header and PTEs valid,
* Validity depends on PMBR being valid (or being overridden by the
* or the Alternate GPT header and PTEs valid, and the PMBR valid.
* 'gpt' kernel command line option) and finding either the Primary
* GPT header and PTEs valid, or the Alternate GPT header and PTEs
* valid. If the Primary GPT header is not valid, the Alternate GPT header
* is not checked unless the 'gpt' kernel command line option is passed.
* This protects against devices which misreport their size, and forces
* the user to decide to use the Alternate GPT.
*/
*/
static
int
static
int
find_valid_gpt
(
struct
block_device
*
bdev
,
gpt_header
**
gpt
,
gpt_entry
**
ptes
)
find_valid_gpt
(
struct
block_device
*
bdev
,
gpt_header
**
gpt
,
gpt_entry
**
ptes
)
...
@@ -479,70 +525,43 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, gpt_entry **ptes)
...
@@ -479,70 +525,43 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, gpt_entry **ptes)
return
0
;
return
0
;
lastlba
=
last_lba
(
bdev
);
lastlba
=
last_lba
(
bdev
);
if
(
!
force_gpt
)
{
/* This will be added to the EFI Spec. per Intel after v1.02. */
legacymbr
=
kmalloc
(
sizeof
(
*
legacymbr
),
GFP_KERNEL
);
if
(
legacymbr
)
{
memset
(
legacymbr
,
0
,
sizeof
(
*
legacymbr
));
read_lba
(
bdev
,
0
,
(
u8
*
)
legacymbr
,
sizeof
(
*
legacymbr
));
good_pmbr
=
is_pmbr_valid
(
legacymbr
,
lastlba
);
kfree
(
legacymbr
);
legacymbr
=
NULL
;
}
if
(
!
good_pmbr
)
goto
fail
;
}
good_pgpt
=
is_gpt_valid
(
bdev
,
GPT_PRIMARY_PARTITION_TABLE_LBA
,
good_pgpt
=
is_gpt_valid
(
bdev
,
GPT_PRIMARY_PARTITION_TABLE_LBA
,
&
pgpt
,
&
pptes
);
&
pgpt
,
&
pptes
);
if
(
good_pgpt
)
{
if
(
good_pgpt
)
good_agpt
=
is_gpt_valid
(
bdev
,
good_agpt
=
is_gpt_valid
(
bdev
,
le64_to_cpu
(
pgpt
->
alternate_lba
),
le64_to_cpu
(
pgpt
->
alternate_lba
),
&
agpt
,
&
aptes
);
&
agpt
,
&
aptes
);
if
(
!
good_agpt
)
{
if
(
!
good_agpt
&&
force_gpt
)
good_agpt
=
is_gpt_valid
(
bdev
,
lastlba
,
&
agpt
,
&
aptes
);
}
}
else
{
good_agpt
=
is_gpt_valid
(
bdev
,
lastlba
,
good_agpt
=
is_gpt_valid
(
bdev
,
lastlba
,
&
agpt
,
&
aptes
);
&
agpt
,
&
aptes
);
}
/* The obviously unsuccessful case */
/* The obviously unsuccessful case */
if
(
!
good_pgpt
&&
!
good_agpt
)
{
if
(
!
good_pgpt
&&
!
good_agpt
)
goto
fail
;
}
/* This will be added to the EFI Spec. per Intel after v1.02. */
legacymbr
=
kmalloc
(
sizeof
(
*
legacymbr
),
GFP_KERNEL
);
if
(
legacymbr
)
{
memset
(
legacymbr
,
0
,
sizeof
(
*
legacymbr
));
read_lba
(
bdev
,
0
,
(
u8
*
)
legacymbr
,
sizeof
(
*
legacymbr
));
good_pmbr
=
is_pmbr_valid
(
legacymbr
);
kfree
(
legacymbr
);
legacymbr
=
NULL
;
}
/* Failure due to bad PMBR */
if
((
good_pgpt
||
good_agpt
)
&&
!
good_pmbr
&&
!
force_gpt
)
{
printk
(
KERN_WARNING
" Warning: Disk has a valid GPT signature "
"but invalid PMBR.
\n
"
);
printk
(
KERN_WARNING
" Assuming this disk is *not* a GPT disk anymore.
\n
"
);
printk
(
KERN_WARNING
" Use gpt kernel option to override. "
"Use GNU Parted to correct disk.
\n
"
);
goto
fail
;
goto
fail
;
}
/* Would fail due to bad PMBR, but force GPT anyhow */
if
((
good_pgpt
||
good_agpt
)
&&
!
good_pmbr
&&
force_gpt
)
{
printk
(
KERN_WARNING
" Warning: Disk has a valid GPT signature but "
"invalid PMBR.
\n
"
);
printk
(
KERN_WARNING
" Use GNU Parted to correct disk.
\n
"
);
printk
(
KERN_WARNING
" gpt option taken, disk treated as GPT.
\n
"
);
}
compare_gpts
(
pgpt
,
agpt
,
lastlba
);
compare_gpts
(
pgpt
,
agpt
,
lastlba
);
/* The good cases */
/* The good cases */
if
(
good_pgpt
&&
(
good_pmbr
||
force_gpt
)
)
{
if
(
good_pgpt
)
{
*
gpt
=
pgpt
;
*
gpt
=
pgpt
;
*
ptes
=
pptes
;
*
ptes
=
pptes
;
if
(
agpt
)
{
kfree
(
agpt
);
agpt
=
NULL
;
}
kfree
(
agpt
);
if
(
aptes
)
{
kfree
(
aptes
);
aptes
=
NULL
;
}
kfree
(
aptes
);
if
(
!
good_agpt
)
{
if
(
!
good_agpt
)
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"Alternate GPT is invalid, "
"Alternate GPT is invalid, "
...
@@ -550,21 +569,21 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, gpt_entry **ptes)
...
@@ -550,21 +569,21 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, gpt_entry **ptes)
}
}
return
1
;
return
1
;
}
}
else
if
(
good_agpt
&&
(
good_pmbr
||
force_gpt
)
)
{
else
if
(
good_agpt
)
{
*
gpt
=
agpt
;
*
gpt
=
agpt
;
*
ptes
=
aptes
;
*
ptes
=
aptes
;
if
(
pgpt
)
{
kfree
(
pgpt
);
pgpt
=
NULL
;
}
kfree
(
pgpt
);
if
(
pptes
)
{
kfree
(
pptes
);
pptes
=
NULL
;
}
kfree
(
pptes
);
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"Primary GPT is invalid, using alternate GPT.
\n
"
);
"Primary GPT is invalid, using alternate GPT.
\n
"
);
return
1
;
return
1
;
}
}
fail:
fail:
if
(
pgpt
)
{
kfree
(
pgpt
);
pgpt
=
NULL
;
}
kfree
(
pgpt
);
if
(
agpt
)
{
kfree
(
agpt
);
agpt
=
NULL
;
}
kfree
(
agpt
);
if
(
pptes
)
{
kfree
(
pptes
);
pptes
=
NULL
;
}
kfree
(
pptes
);
if
(
aptes
)
{
kfree
(
aptes
);
aptes
=
NULL
;
}
kfree
(
aptes
);
*
gpt
=
NULL
;
*
gpt
=
NULL
;
*
ptes
=
NULL
;
*
ptes
=
NULL
;
return
0
;
return
0
;
...
@@ -606,15 +625,15 @@ efi_partition(struct parsed_partitions *state, struct block_device *bdev)
...
@@ -606,15 +625,15 @@ efi_partition(struct parsed_partitions *state, struct block_device *bdev)
Dprintk
(
"GUID Partition Table is valid! Yea!
\n
"
);
Dprintk
(
"GUID Partition Table is valid! Yea!
\n
"
);
for
(
i
=
0
;
i
<
le32_to_cpu
(
gpt
->
num_partition_entries
)
&&
i
<
state
->
limit
-
1
;
i
++
)
{
for
(
i
=
0
;
i
<
le32_to_cpu
(
gpt
->
num_partition_entries
)
&&
i
<
state
->
limit
-
1
;
i
++
)
{
if
(
!
efi_guidcmp
(
ptes
[
i
].
partition_type_guid
,
NULL_GUID
))
if
(
!
is_pte_valid
(
&
ptes
[
i
],
last_lba
(
bdev
)
))
continue
;
continue
;
put_partition
(
state
,
i
+
1
,
le64_to_cpu
(
ptes
[
i
].
starting_lba
),
put_partition
(
state
,
i
+
1
,
le64_to_cpu
(
ptes
[
i
].
starting_lba
),
(
le64_to_cpu
(
ptes
[
i
].
ending_lba
)
-
(
le64_to_cpu
(
ptes
[
i
].
ending_lba
)
-
le64_to_cpu
(
ptes
[
i
].
starting_lba
)
+
le64_to_cpu
(
ptes
[
i
].
starting_lba
)
+
1
));
1
ULL
));
/* If th
ere's th
is is a RAID volume, tell md */
/* If this is a RAID volume, tell md */
if
(
!
efi_guidcmp
(
ptes
[
i
].
partition_type_guid
,
if
(
!
efi_guidcmp
(
ptes
[
i
].
partition_type_guid
,
PARTITION_LINUX_RAID_GUID
))
PARTITION_LINUX_RAID_GUID
))
state
->
parts
[
i
+
1
].
flags
=
1
;
state
->
parts
[
i
+
1
].
flags
=
1
;
...
@@ -624,22 +643,3 @@ efi_partition(struct parsed_partitions *state, struct block_device *bdev)
...
@@ -624,22 +643,3 @@ efi_partition(struct parsed_partitions *state, struct block_device *bdev)
printk
(
"
\n
"
);
printk
(
"
\n
"
);
return
1
;
return
1
;
}
}
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-indent-level: 4
* c-brace-imaginary-offset: 0
* c-brace-offset: -4
* c-argdecl-indent: 4
* c-label-offset: -4
* c-continued-statement-offset: 4
* c-continued-brace-offset: 0
* indent-tabs-mode: nil
* tab-width: 8
* End:
*/
lib/kobject.c
View file @
482003f2
...
@@ -180,10 +180,10 @@ int kobject_add(struct kobject * kobj)
...
@@ -180,10 +180,10 @@ int kobject_add(struct kobject * kobj)
error
=
create_dir
(
kobj
);
error
=
create_dir
(
kobj
);
if
(
error
)
{
if
(
error
)
{
/* unlink does the kobject_put() for us */
unlink
(
kobj
);
unlink
(
kobj
);
if
(
parent
)
if
(
parent
)
kobject_put
(
parent
);
kobject_put
(
parent
);
kobject_put
(
kobj
);
}
else
{
}
else
{
kobject_hotplug
(
kobj
,
KOBJ_ADD
);
kobject_hotplug
(
kobj
,
KOBJ_ADD
);
}
}
...
...
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