Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
b1a4d965
Commit
b1a4d965
authored
Apr 04, 2007
by
Chris Mason
Committed by
David Woodhouse
Apr 04, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: tweak the inode-map and free extent search starts on cold mount
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
e8f05c45
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
13 deletions
+39
-13
fs/btrfs/TODO
fs/btrfs/TODO
+0
-2
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+0
-1
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+0
-1
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+19
-2
fs/btrfs/inode-map.c
fs/btrfs/inode-map.c
+20
-7
No files found.
fs/btrfs/TODO
View file @
b1a4d965
* cleanup, add more error checking, get rid of BUG_ONs
* cleanup, add more error checking, get rid of BUG_ONs
* Fix ENOSPC handling
* Fix ENOSPC handling
* Do checksumming
* Add block mapping tree (simple dm layer)
* Add block mapping tree (simple dm layer)
* Make allocator smarter
* Make allocator smarter
* make level a field in header
* add a block group to struct inode
* add a block group to struct inode
* Make directory hashing work on 32 bit
* Make directory hashing work on 32 bit
* Make sure nobh stuff is working properly for cows
* Make sure nobh stuff is working properly for cows
...
...
fs/btrfs/ctree.h
View file @
b1a4d965
...
@@ -238,7 +238,6 @@ struct btrfs_fs_info {
...
@@ -238,7 +238,6 @@ struct btrfs_fs_info {
struct
radix_tree_root
pending_del_radix
;
struct
radix_tree_root
pending_del_radix
;
struct
radix_tree_root
pinned_radix
;
struct
radix_tree_root
pinned_radix
;
u64
last_inode_alloc
;
u64
last_inode_alloc
;
u64
last_inode_alloc_dirid
;
u64
generation
;
u64
generation
;
struct
btrfs_transaction
*
running_transaction
;
struct
btrfs_transaction
*
running_transaction
;
struct
btrfs_super_block
*
disk_super
;
struct
btrfs_super_block
*
disk_super
;
...
...
fs/btrfs/disk-io.c
View file @
b1a4d965
...
@@ -311,7 +311,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
...
@@ -311,7 +311,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info
->
extent_root
=
extent_root
;
fs_info
->
extent_root
=
extent_root
;
fs_info
->
inode_root
=
inode_root
;
fs_info
->
inode_root
=
inode_root
;
fs_info
->
last_inode_alloc
=
0
;
fs_info
->
last_inode_alloc
=
0
;
fs_info
->
last_inode_alloc_dirid
=
0
;
fs_info
->
sb
=
sb
;
fs_info
->
sb
=
sb
;
fs_info
->
btree_inode
=
new_inode
(
sb
);
fs_info
->
btree_inode
=
new_inode
(
sb
);
fs_info
->
btree_inode
->
i_ino
=
1
;
fs_info
->
btree_inode
->
i_ino
=
1
;
...
...
fs/btrfs/extent-tree.c
View file @
b1a4d965
...
@@ -339,13 +339,30 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
...
@@ -339,13 +339,30 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
int
total_needed
=
num_blocks
;
int
total_needed
=
num_blocks
;
int
level
;
int
level
;
path
=
btrfs_alloc_path
();
ins
->
flags
=
0
;
btrfs_set_key_type
(
ins
,
BTRFS_EXTENT_ITEM_KEY
);
level
=
btrfs_header_level
(
btrfs_buffer_header
(
root
->
node
));
level
=
btrfs_header_level
(
btrfs_buffer_header
(
root
->
node
));
total_needed
+=
(
level
+
1
)
*
3
;
total_needed
+=
(
level
+
1
)
*
3
;
if
(
root
->
fs_info
->
last_insert
.
objectid
==
0
&&
search_end
==
(
u64
)
-
1
)
{
struct
btrfs_disk_key
*
last_key
;
btrfs_init_path
(
path
);
ins
->
objectid
=
(
u64
)
-
1
;
ins
->
offset
=
(
u64
)
-
1
;
ret
=
btrfs_search_slot
(
trans
,
root
,
ins
,
path
,
0
,
0
);
if
(
ret
<
0
)
goto
error
;
BUG_ON
(
ret
==
0
);
if
(
path
->
slots
[
0
]
>
0
)
path
->
slots
[
0
]
--
;
l
=
btrfs_buffer_leaf
(
path
->
nodes
[
0
]);
last_key
=
&
l
->
items
[
path
->
slots
[
0
]].
key
;
search_start
=
btrfs_disk_key_objectid
(
last_key
);
}
if
(
root
->
fs_info
->
last_insert
.
objectid
>
search_start
)
if
(
root
->
fs_info
->
last_insert
.
objectid
>
search_start
)
search_start
=
root
->
fs_info
->
last_insert
.
objectid
;
search_start
=
root
->
fs_info
->
last_insert
.
objectid
;
ins
->
flags
=
0
;
btrfs_set_key_type
(
ins
,
BTRFS_EXTENT_ITEM_KEY
);
path
=
btrfs_alloc_path
();
path
=
btrfs_alloc_path
();
check_failed:
check_failed:
...
...
fs/btrfs/inode-map.c
View file @
b1a4d965
...
@@ -22,17 +22,31 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
...
@@ -22,17 +22,31 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
struct
btrfs_key
search_key
;
struct
btrfs_key
search_key
;
u64
search_start
=
dirid
;
u64
search_start
=
dirid
;
if
(
fs_root
->
fs_info
->
last_inode_alloc_dirid
==
dirid
)
path
=
btrfs_alloc_path
();
search_start
=
fs_root
->
fs_info
->
last_inode_alloc
;
BUG_ON
(
!
path
);
search_key
.
flags
=
0
;
btrfs_set_key_type
(
&
search_key
,
BTRFS_INODE_MAP_ITEM_KEY
);
search_start
=
fs_root
->
fs_info
->
last_inode_alloc
;
if
(
search_start
==
0
)
{
struct
btrfs_disk_key
*
last_key
;
btrfs_init_path
(
path
);
search_key
.
objectid
=
(
u64
)
-
1
;
search_key
.
offset
=
(
u64
)
-
1
;
ret
=
btrfs_search_slot
(
trans
,
root
,
&
search_key
,
path
,
0
,
0
);
if
(
ret
<
0
)
goto
error
;
BUG_ON
(
ret
==
0
);
if
(
path
->
slots
[
0
]
>
0
)
path
->
slots
[
0
]
--
;
l
=
btrfs_buffer_leaf
(
path
->
nodes
[
0
]);
last_key
=
&
l
->
items
[
path
->
slots
[
0
]].
key
;
search_start
=
btrfs_disk_key_objectid
(
last_key
);
}
search_start
=
max
(
search_start
,
BTRFS_FIRST_FREE_OBJECTID
);
search_start
=
max
(
search_start
,
BTRFS_FIRST_FREE_OBJECTID
);
search_key
.
objectid
=
search_start
;
search_key
.
objectid
=
search_start
;
search_key
.
flags
=
0
;
btrfs_set_key_type
(
&
search_key
,
BTRFS_INODE_MAP_ITEM_KEY
);
search_key
.
offset
=
0
;
search_key
.
offset
=
0
;
path
=
btrfs_alloc_path
();
BUG_ON
(
!
path
);
btrfs_init_path
(
path
);
btrfs_init_path
(
path
);
start_found
=
0
;
start_found
=
0
;
ret
=
btrfs_search_slot
(
trans
,
root
,
&
search_key
,
path
,
0
,
0
);
ret
=
btrfs_search_slot
(
trans
,
root
,
&
search_key
,
path
,
0
,
0
);
...
@@ -79,7 +93,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
...
@@ -79,7 +93,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
// FIXME -ENOSPC
// FIXME -ENOSPC
found:
found:
root
->
fs_info
->
last_inode_alloc
=
*
objectid
;
root
->
fs_info
->
last_inode_alloc
=
*
objectid
;
root
->
fs_info
->
last_inode_alloc_dirid
=
dirid
;
btrfs_release_path
(
root
,
path
);
btrfs_release_path
(
root
,
path
);
btrfs_free_path
(
path
);
btrfs_free_path
(
path
);
BUG_ON
(
*
objectid
<
search_start
);
BUG_ON
(
*
objectid
<
search_start
);
...
...
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