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
236454df
Commit
236454df
authored
Apr 19, 2007
by
Chris Mason
Committed by
David Woodhouse
Apr 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: many file_write fixes, inline data
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
a429e513
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
484 additions
and
116 deletions
+484
-116
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+35
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+6
-0
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+5
-0
fs/btrfs/file-item.c
fs/btrfs/file-item.c
+1
-0
fs/btrfs/super.c
fs/btrfs/super.c
+437
-116
No files found.
fs/btrfs/ctree.h
View file @
236454df
...
...
@@ -73,6 +73,9 @@ struct btrfs_header {
(sizeof(struct btrfs_disk_key) + sizeof(u64)))
#define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->blocksize))
#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
sizeof(struct btrfs_item) - \
sizeof(struct btrfs_file_extent_item))
struct
buffer_head
;
/*
...
...
@@ -204,8 +207,12 @@ struct btrfs_root_item {
__le32
refs
;
}
__attribute__
((
__packed__
));
#define BTRFS_FILE_EXTENT_REG 0
#define BTRFS_FILE_EXTENT_INLINE 1
struct
btrfs_file_extent_item
{
__le64
generation
;
u8
type
;
/*
* disk space consumed by the extent, checksum blocks are included
* in these numbers
...
...
@@ -862,6 +869,34 @@ static inline u8 *btrfs_leaf_data(struct btrfs_leaf *l)
return
(
u8
*
)
l
->
items
;
}
static
inline
int
btrfs_file_extent_type
(
struct
btrfs_file_extent_item
*
e
)
{
return
e
->
type
;
}
static
inline
void
btrfs_set_file_extent_type
(
struct
btrfs_file_extent_item
*
e
,
u8
val
)
{
e
->
type
=
val
;
}
static
inline
char
*
btrfs_file_extent_inline_start
(
struct
btrfs_file_extent_item
*
e
)
{
return
(
char
*
)(
&
e
->
disk_blocknr
);
}
static
inline
u32
btrfs_file_extent_calc_inline_size
(
u32
datasize
)
{
return
(
unsigned
long
)(
&
((
struct
btrfs_file_extent_item
*
)
NULL
)
->
disk_blocknr
)
+
datasize
;
}
static
inline
u32
btrfs_file_extent_inline_len
(
struct
btrfs_item
*
e
)
{
struct
btrfs_file_extent_item
*
fe
=
NULL
;
return
btrfs_item_size
(
e
)
-
(
unsigned
long
)(
&
fe
->
disk_blocknr
);
}
static
inline
u64
btrfs_file_extent_disk_blocknr
(
struct
btrfs_file_extent_item
*
e
)
{
...
...
fs/btrfs/disk-io.c
View file @
236454df
...
...
@@ -108,6 +108,12 @@ int btrfs_map_bh_to_logical(struct btrfs_root *root, struct buffer_head *bh,
int
ret
;
if
(
logical
==
0
)
{
bh
->
b_bdev
=
NULL
;
bh
->
b_blocknr
=
0
;
set_buffer_mapped
(
bh
);
return
0
;
}
root
=
root
->
fs_info
->
dev_root
;
ret
=
radix_tree_gang_lookup
(
&
root
->
fs_info
->
dev_radix
,
(
void
**
)
lookup
,
...
...
fs/btrfs/extent-tree.c
View file @
236454df
...
...
@@ -111,6 +111,9 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
continue
;
fi
=
btrfs_item_ptr
(
buf_leaf
,
i
,
struct
btrfs_file_extent_item
);
if
(
btrfs_file_extent_type
(
fi
)
==
BTRFS_FILE_EXTENT_INLINE
)
continue
;
ret
=
btrfs_inc_extent_ref
(
trans
,
root
,
btrfs_file_extent_disk_blocknr
(
fi
),
btrfs_file_extent_disk_num_blocks
(
fi
));
...
...
@@ -539,6 +542,8 @@ static int drop_leaf_ref(struct btrfs_trans_handle *trans,
if
(
btrfs_disk_key_type
(
key
)
!=
BTRFS_EXTENT_DATA_KEY
)
continue
;
fi
=
btrfs_item_ptr
(
leaf
,
i
,
struct
btrfs_file_extent_item
);
if
(
btrfs_file_extent_type
(
fi
)
==
BTRFS_FILE_EXTENT_INLINE
)
continue
;
/*
* FIXME make sure to insert a trans record that
* repeats the snapshot del on crash
...
...
fs/btrfs/file-item.c
View file @
236454df
...
...
@@ -34,6 +34,7 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
btrfs_set_file_extent_offset
(
item
,
0
);
btrfs_set_file_extent_num_blocks
(
item
,
num_blocks
);
btrfs_set_file_extent_generation
(
item
,
trans
->
transid
);
btrfs_set_file_extent_type
(
item
,
BTRFS_FILE_EXTENT_REG
);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
btrfs_release_path
(
root
,
path
);
...
...
fs/btrfs/super.c
View file @
236454df
This diff is collapsed.
Click to expand it.
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