Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
e93117ef
Commit
e93117ef
authored
Sep 15, 2009
by
Stephen Rothwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'ext4/next'
parents
882415a8
dd474650
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
704 additions
and
484 deletions
+704
-484
Documentation/filesystems/ext4.txt
Documentation/filesystems/ext4.txt
+1
-7
fs/ext4/Kconfig
fs/ext4/Kconfig
+10
-1
fs/ext4/balloc.c
fs/ext4/balloc.c
+1
-1
fs/ext4/ext4.h
fs/ext4/ext4.h
+65
-19
fs/ext4/ext4_extents.h
fs/ext4/ext4_extents.h
+1
-2
fs/ext4/ext4_jbd2.c
fs/ext4/ext4_jbd2.c
+6
-3
fs/ext4/extents.c
fs/ext4/extents.c
+71
-41
fs/ext4/fsync.c
fs/ext4/fsync.c
+9
-4
fs/ext4/ialloc.c
fs/ext4/ialloc.c
+1
-1
fs/ext4/inode.c
fs/ext4/inode.c
+84
-44
fs/ext4/ioctl.c
fs/ext4/ioctl.c
+3
-4
fs/ext4/mballoc.c
fs/ext4/mballoc.c
+215
-205
fs/ext4/mballoc.h
fs/ext4/mballoc.h
+15
-7
fs/ext4/migrate.c
fs/ext4/migrate.c
+1
-1
fs/ext4/move_extent.c
fs/ext4/move_extent.c
+27
-20
fs/ext4/namei.c
fs/ext4/namei.c
+15
-7
fs/ext4/resize.c
fs/ext4/resize.c
+1
-6
fs/ext4/super.c
fs/ext4/super.c
+85
-67
fs/jbd2/commit.c
fs/jbd2/commit.c
+7
-4
fs/jbd2/journal.c
fs/jbd2/journal.c
+6
-0
fs/jbd2/transaction.c
fs/jbd2/transaction.c
+4
-3
include/linux/jbd2.h
include/linux/jbd2.h
+1
-1
include/trace/events/ext4.h
include/trace/events/ext4.h
+74
-35
include/trace/events/jbd2.h
include/trace/events/jbd2.h
+1
-1
No files found.
Documentation/filesystems/ext4.txt
View file @
e93117ef
...
@@ -134,15 +134,9 @@ ro Mount filesystem read only. Note that ext4 will
...
@@ -134,15 +134,9 @@ ro Mount filesystem read only. Note that ext4 will
mount options "ro,noload" can be used to prevent
mount options "ro,noload" can be used to prevent
writes to the filesystem.
writes to the filesystem.
journal_checksum Enable checksumming of the journal transactions.
This will allow the recovery code in e2fsck and the
kernel to detect corruption in the kernel. It is a
compatible change and will be ignored by older kernels.
journal_async_commit Commit block can be written to disk without waiting
journal_async_commit Commit block can be written to disk without waiting
for descriptor blocks. If enabled older kernels cannot
for descriptor blocks. If enabled older kernels cannot
mount the device. This will enable 'journal_checksum'
mount the device.
internally.
journal=update Update the ext4 file system's journal to the current
journal=update Update the ext4 file system's journal to the current
format.
format.
...
...
fs/ext4/Kconfig
View file @
e93117ef
...
@@ -37,7 +37,7 @@ config EXT4DEV_COMPAT
...
@@ -37,7 +37,7 @@ config EXT4DEV_COMPAT
To enable backwards compatibility so that systems that are
To enable backwards compatibility so that systems that are
still expecting to mount ext4 filesystems using ext4dev,
still expecting to mount ext4 filesystems using ext4dev,
chose Y here. This feature will go away by 2.6.31, so
cho
o
se Y here. This feature will go away by 2.6.31, so
please arrange to get your userspace programs fixed!
please arrange to get your userspace programs fixed!
config EXT4_FS_XATTR
config EXT4_FS_XATTR
...
@@ -77,3 +77,12 @@ config EXT4_FS_SECURITY
...
@@ -77,3 +77,12 @@ config EXT4_FS_SECURITY
If you are not using a security module that requires using
If you are not using a security module that requires using
extended attributes for file security labels, say N.
extended attributes for file security labels, say N.
config EXT4_DEBUG
bool "EXT4 debugging support"
depends on EXT4_FS
help
Enables run-time debugging support for the ext4 filesystem.
If you select Y here, then you will be able to turn on debugging
with a command such as "echo 1 > /sys/kernel/debug/ext4/mballoc-debug"
fs/ext4/balloc.c
View file @
e93117ef
...
@@ -478,7 +478,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb,
...
@@ -478,7 +478,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb,
* new bitmap information
* new bitmap information
*/
*/
set_bit
(
EXT4_GROUP_INFO_NEED_INIT_BIT
,
&
(
grp
->
bb_state
));
set_bit
(
EXT4_GROUP_INFO_NEED_INIT_BIT
,
&
(
grp
->
bb_state
));
ext4_mb_update_group_info
(
grp
,
blocks_freed
)
;
grp
->
bb_free
+=
blocks_freed
;
up_write
(
&
grp
->
alloc_sem
);
up_write
(
&
grp
->
alloc_sem
);
/* We dirtied the bitmap block */
/* We dirtied the bitmap block */
...
...
fs/ext4/ext4.h
View file @
e93117ef
...
@@ -67,27 +67,29 @@ typedef unsigned int ext4_group_t;
...
@@ -67,27 +67,29 @@ typedef unsigned int ext4_group_t;
/* prefer goal again. length */
/* prefer goal again. length */
#define EXT4_MB_HINT_MERGE 1
#define EXT4_MB_HINT_MERGE
0x000
1
/* blocks already reserved */
/* blocks already reserved */
#define EXT4_MB_HINT_RESERVED 2
#define EXT4_MB_HINT_RESERVED
0x000
2
/* metadata is being allocated */
/* metadata is being allocated */
#define EXT4_MB_HINT_METADATA 4
#define EXT4_MB_HINT_METADATA
0x000
4
/* first blocks in the file */
/* first blocks in the file */
#define EXT4_MB_HINT_FIRST 8
#define EXT4_MB_HINT_FIRST
0x000
8
/* search for the best chunk */
/* search for the best chunk */
#define EXT4_MB_HINT_BEST
16
#define EXT4_MB_HINT_BEST
0x0010
/* data is being allocated */
/* data is being allocated */
#define EXT4_MB_HINT_DATA
32
#define EXT4_MB_HINT_DATA
0x0020
/* don't preallocate (for tails) */
/* don't preallocate (for tails) */
#define EXT4_MB_HINT_NOPREALLOC
64
#define EXT4_MB_HINT_NOPREALLOC
0x0040
/* allocate for locality group */
/* allocate for locality group */
#define EXT4_MB_HINT_GROUP_ALLOC
128
#define EXT4_MB_HINT_GROUP_ALLOC
0x0080
/* allocate goal blocks or none */
/* allocate goal blocks or none */
#define EXT4_MB_HINT_GOAL_ONLY
256
#define EXT4_MB_HINT_GOAL_ONLY
0x0100
/* goal is meaningful */
/* goal is meaningful */
#define EXT4_MB_HINT_TRY_GOAL
512
#define EXT4_MB_HINT_TRY_GOAL
0x0200
/* blocks already pre-reserved by delayed allocation */
/* blocks already pre-reserved by delayed allocation */
#define EXT4_MB_DELALLOC_RESERVED 1024
#define EXT4_MB_DELALLOC_RESERVED 0x0400
/* We are doing stream allocation */
#define EXT4_MB_STREAM_ALLOC 0x0800
struct
ext4_allocation_request
{
struct
ext4_allocation_request
{
...
@@ -111,6 +113,21 @@ struct ext4_allocation_request {
...
@@ -111,6 +113,21 @@ struct ext4_allocation_request {
unsigned
int
flags
;
unsigned
int
flags
;
};
};
/*
* For delayed allocation tracking
*/
struct
mpage_da_data
{
struct
inode
*
inode
;
sector_t
b_blocknr
;
/* start block number of extent */
size_t
b_size
;
/* size of extent */
unsigned
long
b_state
;
/* state of the extent */
unsigned
long
first_page
,
next_page
;
/* extent of pages */
struct
writeback_control
*
wbc
;
int
io_done
;
int
pages_written
;
int
retval
;
};
/*
/*
* Special inodes numbers
* Special inodes numbers
*/
*/
...
@@ -694,7 +711,6 @@ struct ext4_inode_info {
...
@@ -694,7 +711,6 @@ struct ext4_inode_info {
#define EXT4_MOUNT_QUOTA 0x80000
/* Some quota option set */
#define EXT4_MOUNT_QUOTA 0x80000
/* Some quota option set */
#define EXT4_MOUNT_USRQUOTA 0x100000
/* "old" user quota */
#define EXT4_MOUNT_USRQUOTA 0x100000
/* "old" user quota */
#define EXT4_MOUNT_GRPQUOTA 0x200000
/* "old" group quota */
#define EXT4_MOUNT_GRPQUOTA 0x200000
/* "old" group quota */
#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000
/* Journal checksums */
#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000
/* Journal Async Commit */
#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000
/* Journal Async Commit */
#define EXT4_MOUNT_I_VERSION 0x2000000
/* i_version support */
#define EXT4_MOUNT_I_VERSION 0x2000000
/* i_version support */
#define EXT4_MOUNT_DELALLOC 0x8000000
/* Delalloc support */
#define EXT4_MOUNT_DELALLOC 0x8000000
/* Delalloc support */
...
@@ -950,6 +966,7 @@ struct ext4_sb_info {
...
@@ -950,6 +966,7 @@ struct ext4_sb_info {
atomic_t
s_mb_lost_chunks
;
atomic_t
s_mb_lost_chunks
;
atomic_t
s_mb_preallocated
;
atomic_t
s_mb_preallocated
;
atomic_t
s_mb_discarded
;
atomic_t
s_mb_discarded
;
atomic_t
s_lock_busy
;
/* locality groups */
/* locality groups */
struct
ext4_locality_group
*
s_locality_groups
;
struct
ext4_locality_group
*
s_locality_groups
;
...
@@ -1340,8 +1357,6 @@ extern void ext4_mb_free_blocks(handle_t *, struct inode *,
...
@@ -1340,8 +1357,6 @@ extern void ext4_mb_free_blocks(handle_t *, struct inode *,
ext4_fsblk_t
,
unsigned
long
,
int
,
unsigned
long
*
);
ext4_fsblk_t
,
unsigned
long
,
int
,
unsigned
long
*
);
extern
int
ext4_mb_add_groupinfo
(
struct
super_block
*
sb
,
extern
int
ext4_mb_add_groupinfo
(
struct
super_block
*
sb
,
ext4_group_t
i
,
struct
ext4_group_desc
*
desc
);
ext4_group_t
i
,
struct
ext4_group_desc
*
desc
);
extern
void
ext4_mb_update_group_info
(
struct
ext4_group_info
*
grp
,
ext4_grpblk_t
add
);
extern
int
ext4_mb_get_buddy_cache_lock
(
struct
super_block
*
,
ext4_group_t
);
extern
int
ext4_mb_get_buddy_cache_lock
(
struct
super_block
*
,
ext4_group_t
);
extern
void
ext4_mb_put_buddy_cache_lock
(
struct
super_block
*
,
extern
void
ext4_mb_put_buddy_cache_lock
(
struct
super_block
*
,
ext4_group_t
,
int
);
ext4_group_t
,
int
);
...
@@ -1367,6 +1382,7 @@ extern int ext4_change_inode_journal_flag(struct inode *, int);
...
@@ -1367,6 +1382,7 @@ extern int ext4_change_inode_journal_flag(struct inode *, int);
extern
int
ext4_get_inode_loc
(
struct
inode
*
,
struct
ext4_iloc
*
);
extern
int
ext4_get_inode_loc
(
struct
inode
*
,
struct
ext4_iloc
*
);
extern
int
ext4_can_truncate
(
struct
inode
*
inode
);
extern
int
ext4_can_truncate
(
struct
inode
*
inode
);
extern
void
ext4_truncate
(
struct
inode
*
);
extern
void
ext4_truncate
(
struct
inode
*
);
extern
int
ext4_truncate_restart_trans
(
handle_t
*
,
struct
inode
*
,
int
nblocks
);
extern
void
ext4_set_inode_flags
(
struct
inode
*
);
extern
void
ext4_set_inode_flags
(
struct
inode
*
);
extern
void
ext4_get_inode_flags
(
struct
ext4_inode_info
*
);
extern
void
ext4_get_inode_flags
(
struct
ext4_inode_info
*
);
extern
int
ext4_alloc_da_blocks
(
struct
inode
*
inode
);
extern
int
ext4_alloc_da_blocks
(
struct
inode
*
inode
);
...
@@ -1575,15 +1591,18 @@ static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize)
...
@@ -1575,15 +1591,18 @@ static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize)
struct
ext4_group_info
{
struct
ext4_group_info
{
unsigned
long
bb_state
;
unsigned
long
bb_state
;
struct
rb_root
bb_free_root
;
struct
rb_root
bb_free_root
;
unsigned
short
bb_first_free
;
ext4_grpblk_t
bb_first_free
;
/* first free block */
unsigned
short
bb_free
;
ext4_grpblk_t
bb_free
;
/* total free blocks */
unsigned
short
bb_fragments
;
ext4_grpblk_t
bb_fragments
;
/* nr of freespace fragments */
struct
list_head
bb_prealloc_list
;
struct
list_head
bb_prealloc_list
;
#ifdef DOUBLE_CHECK
#ifdef DOUBLE_CHECK
void
*
bb_bitmap
;
void
*
bb_bitmap
;
#endif
#endif
struct
rw_semaphore
alloc_sem
;
struct
rw_semaphore
alloc_sem
;
unsigned
short
bb_counters
[];
ext4_grpblk_t
bb_counters
[];
/* Nr of free power-of-two-block
* regions, index is order.
* bb_counters[3] = 5 means
* 5 free 8-block regions. */
};
};
#define EXT4_GROUP_INFO_NEED_INIT_BIT 0
#define EXT4_GROUP_INFO_NEED_INIT_BIT 0
...
@@ -1591,15 +1610,42 @@ struct ext4_group_info {
...
@@ -1591,15 +1610,42 @@ struct ext4_group_info {
#define EXT4_MB_GRP_NEED_INIT(grp) \
#define EXT4_MB_GRP_NEED_INIT(grp) \
(test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state)))
(test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state)))
#define EXT4_MAX_CONTENTION 8
#define EXT4_CONTENTION_THRESHOLD 2
static
inline
spinlock_t
*
ext4_group_lock_ptr
(
struct
super_block
*
sb
,
static
inline
spinlock_t
*
ext4_group_lock_ptr
(
struct
super_block
*
sb
,
ext4_group_t
group
)
ext4_group_t
group
)
{
{
return
bgl_lock_ptr
(
EXT4_SB
(
sb
)
->
s_blockgroup_lock
,
group
);
return
bgl_lock_ptr
(
EXT4_SB
(
sb
)
->
s_blockgroup_lock
,
group
);
}
}
/*
* Returns true if the filesystem is busy enough that attempts to
* access the block group locks has run into contention.
*/
static
inline
int
ext4_fs_is_busy
(
struct
ext4_sb_info
*
sbi
)
{
return
(
atomic_read
(
&
sbi
->
s_lock_busy
)
>
EXT4_CONTENTION_THRESHOLD
);
}
static
inline
void
ext4_lock_group
(
struct
super_block
*
sb
,
ext4_group_t
group
)
static
inline
void
ext4_lock_group
(
struct
super_block
*
sb
,
ext4_group_t
group
)
{
{
spin_lock
(
ext4_group_lock_ptr
(
sb
,
group
));
spinlock_t
*
lock
=
ext4_group_lock_ptr
(
sb
,
group
);
if
(
spin_trylock
(
lock
))
/*
* We're able to grab the lock right away, so drop the
* lock contention counter.
*/
atomic_add_unless
(
&
EXT4_SB
(
sb
)
->
s_lock_busy
,
-
1
,
0
);
else
{
/*
* The lock is busy, so bump the contention counter,
* and then wait on the spin lock.
*/
atomic_add_unless
(
&
EXT4_SB
(
sb
)
->
s_lock_busy
,
1
,
EXT4_MAX_CONTENTION
);
spin_lock
(
lock
);
}
}
}
static
inline
void
ext4_unlock_group
(
struct
super_block
*
sb
,
static
inline
void
ext4_unlock_group
(
struct
super_block
*
sb
,
...
...
fs/ext4/ext4_extents.h
View file @
e93117ef
...
@@ -43,8 +43,7 @@
...
@@ -43,8 +43,7 @@
#define CHECK_BINSEARCH__
#define CHECK_BINSEARCH__
/*
/*
* If EXT_DEBUG is defined you can use the 'extdebug' mount option
* Turn on EXT_DEBUG to get lots of info about extents operations.
* to get lots of info about what's going on.
*/
*/
#define EXT_DEBUG__
#define EXT_DEBUG__
#ifdef EXT_DEBUG
#ifdef EXT_DEBUG
...
...
fs/ext4/ext4_jbd2.c
View file @
e93117ef
...
@@ -44,7 +44,7 @@ int __ext4_journal_forget(const char *where, handle_t *handle,
...
@@ -44,7 +44,7 @@ int __ext4_journal_forget(const char *where, handle_t *handle,
handle
,
err
);
handle
,
err
);
}
}
else
else
b
relse
(
bh
);
b
forget
(
bh
);
return
err
;
return
err
;
}
}
...
@@ -60,7 +60,7 @@ int __ext4_journal_revoke(const char *where, handle_t *handle,
...
@@ -60,7 +60,7 @@ int __ext4_journal_revoke(const char *where, handle_t *handle,
handle
,
err
);
handle
,
err
);
}
}
else
else
b
relse
(
bh
);
b
forget
(
bh
);
return
err
;
return
err
;
}
}
...
@@ -89,7 +89,10 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
...
@@ -89,7 +89,10 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
ext4_journal_abort_handle
(
where
,
__func__
,
bh
,
ext4_journal_abort_handle
(
where
,
__func__
,
bh
,
handle
,
err
);
handle
,
err
);
}
else
{
}
else
{
mark_buffer_dirty
(
bh
);
if
(
inode
&&
bh
)
mark_buffer_dirty_inode
(
bh
,
inode
);
else
mark_buffer_dirty
(
bh
);
if
(
inode
&&
inode_needs_sync
(
inode
))
{
if
(
inode
&&
inode_needs_sync
(
inode
))
{
sync_dirty_buffer
(
bh
);
sync_dirty_buffer
(
bh
);
if
(
buffer_req
(
bh
)
&&
!
buffer_uptodate
(
bh
))
{
if
(
buffer_req
(
bh
)
&&
!
buffer_uptodate
(
bh
))
{
...
...
fs/ext4/extents.c
View file @
e93117ef
This diff is collapsed.
Click to expand it.
fs/ext4/fsync.c
View file @
e93117ef
...
@@ -50,7 +50,7 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
...
@@ -50,7 +50,7 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
{
{
struct
inode
*
inode
=
dentry
->
d_inode
;
struct
inode
*
inode
=
dentry
->
d_inode
;
journal_t
*
journal
=
EXT4_SB
(
inode
->
i_sb
)
->
s_journal
;
journal_t
*
journal
=
EXT4_SB
(
inode
->
i_sb
)
->
s_journal
;
int
ret
=
0
;
int
err
,
ret
=
0
;
J_ASSERT
(
ext4_journal_current_handle
()
==
NULL
);
J_ASSERT
(
ext4_journal_current_handle
()
==
NULL
);
...
@@ -79,6 +79,9 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
...
@@ -79,6 +79,9 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
goto
out
;
goto
out
;
}
}
if
(
!
journal
)
ret
=
sync_mapping_buffers
(
inode
->
i_mapping
);
if
(
datasync
&&
!
(
inode
->
i_state
&
I_DIRTY_DATASYNC
))
if
(
datasync
&&
!
(
inode
->
i_state
&
I_DIRTY_DATASYNC
))
goto
out
;
goto
out
;
...
@@ -91,10 +94,12 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
...
@@ -91,10 +94,12 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
.
sync_mode
=
WB_SYNC_ALL
,
.
sync_mode
=
WB_SYNC_ALL
,
.
nr_to_write
=
0
,
/* sys_fsync did this */
.
nr_to_write
=
0
,
/* sys_fsync did this */
};
};
ret
=
sync_inode
(
inode
,
&
wbc
);
err
=
sync_inode
(
inode
,
&
wbc
);
if
(
journal
&&
(
journal
->
j_flags
&
JBD2_BARRIER
)
)
if
(
ret
==
0
)
blkdev_issue_flush
(
inode
->
i_sb
->
s_bdev
,
NULL
)
;
ret
=
err
;
}
}
out:
out:
if
(
journal
&&
(
journal
->
j_flags
&
JBD2_BARRIER
))
blkdev_issue_flush
(
inode
->
i_sb
->
s_bdev
,
NULL
);
return
ret
;
return
ret
;
}
}
fs/ext4/ialloc.c
View file @
e93117ef
...
@@ -1189,7 +1189,7 @@ unsigned long ext4_count_free_inodes(struct super_block *sb)
...
@@ -1189,7 +1189,7 @@ unsigned long ext4_count_free_inodes(struct super_block *sb)
x
=
ext4_count_free
(
bitmap_bh
,
EXT4_INODES_PER_GROUP
(
sb
)
/
8
);
x
=
ext4_count_free
(
bitmap_bh
,
EXT4_INODES_PER_GROUP
(
sb
)
/
8
);
printk
(
KERN_DEBUG
"group %lu: stored = %d, counted = %lu
\n
"
,
printk
(
KERN_DEBUG
"group %lu: stored = %d, counted = %lu
\n
"
,
i
,
ext4_free_inodes_count
(
sb
,
gdp
),
x
);
(
unsigned
long
)
i
,
ext4_free_inodes_count
(
sb
,
gdp
),
x
);
bitmap_count
+=
x
;
bitmap_count
+=
x
;
}
}
brelse
(
bitmap_bh
);
brelse
(
bitmap_bh
);
...
...
fs/ext4/inode.c
View file @
e93117ef
...
@@ -192,11 +192,24 @@ static int try_to_extend_transaction(handle_t *handle, struct inode *inode)
...
@@ -192,11 +192,24 @@ static int try_to_extend_transaction(handle_t *handle, struct inode *inode)
* so before we call here everything must be consistently dirtied against
* so before we call here everything must be consistently dirtied against
* this transaction.
* this transaction.
*/
*/
static
int
ext4_journal_test_restart
(
handle_t
*
handle
,
struct
inode
*
inode
)
int
ext4_truncate_restart_trans
(
handle_t
*
handle
,
struct
inode
*
inode
,
int
nblocks
)
{
{
int
ret
;
/*
* Drop i_data_sem to avoid deadlock with ext4_get_blocks At this
* moment, get_block can be called only for blocks inside i_size since
* page cache has been already dropped and writes are blocked by
* i_mutex. So we can safely drop the i_data_sem here.
*/
BUG_ON
(
EXT4_JOURNAL
(
inode
)
==
NULL
);
BUG_ON
(
EXT4_JOURNAL
(
inode
)
==
NULL
);
jbd_debug
(
2
,
"restarting handle %p
\n
"
,
handle
);
jbd_debug
(
2
,
"restarting handle %p
\n
"
,
handle
);
return
ext4_journal_restart
(
handle
,
blocks_for_truncate
(
inode
));
up_write
(
&
EXT4_I
(
inode
)
->
i_data_sem
);
ret
=
ext4_journal_restart
(
handle
,
blocks_for_truncate
(
inode
));
down_write
(
&
EXT4_I
(
inode
)
->
i_data_sem
);
return
ret
;
}
}
/*
/*
...
@@ -341,9 +354,7 @@ static int ext4_block_to_path(struct inode *inode,
...
@@ -341,9 +354,7 @@ static int ext4_block_to_path(struct inode *inode,
int
n
=
0
;
int
n
=
0
;
int
final
=
0
;
int
final
=
0
;
if
(
i_block
<
0
)
{
if
(
i_block
<
direct_blocks
)
{
ext4_warning
(
inode
->
i_sb
,
"ext4_block_to_path"
,
"block < 0"
);
}
else
if
(
i_block
<
direct_blocks
)
{
offsets
[
n
++
]
=
i_block
;
offsets
[
n
++
]
=
i_block
;
final
=
direct_blocks
;
final
=
direct_blocks
;
}
else
if
((
i_block
-=
direct_blocks
)
<
indirect_blocks
)
{
}
else
if
((
i_block
-=
direct_blocks
)
<
indirect_blocks
)
{
...
@@ -762,8 +773,9 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
...
@@ -762,8 +773,9 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
BUFFER_TRACE
(
bh
,
"call get_create_access"
);
BUFFER_TRACE
(
bh
,
"call get_create_access"
);
err
=
ext4_journal_get_create_access
(
handle
,
bh
);
err
=
ext4_journal_get_create_access
(
handle
,
bh
);
if
(
err
)
{
if
(
err
)
{
/* Don't brelse(bh) here; it's done in
* ext4_journal_forget() below */
unlock_buffer
(
bh
);
unlock_buffer
(
bh
);
brelse
(
bh
);
goto
failed
;
goto
failed
;
}
}
...
@@ -1109,16 +1121,15 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
...
@@ -1109,16 +1121,15 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
ext4_discard_preallocations
(
inode
);
ext4_discard_preallocations
(
inode
);
}
}
static
int
check_block_validity
(
struct
inode
*
inode
,
sector_t
logical
,
static
int
check_block_validity
(
struct
inode
*
inode
,
const
char
*
msg
,
sector_t
phys
,
int
len
)
sector_t
logical
,
sector_t
phys
,
int
len
)
{
{
if
(
!
ext4_data_block_valid
(
EXT4_SB
(
inode
->
i_sb
),
phys
,
len
))
{
if
(
!
ext4_data_block_valid
(
EXT4_SB
(
inode
->
i_sb
),
phys
,
len
))
{
ext4_error
(
inode
->
i_sb
,
"check_block_validity"
,
ext4_error
(
inode
->
i_sb
,
msg
,
"inode #%lu logical block %llu mapped to %llu "
"inode #%lu logical block %llu mapped to %llu "
"(size %d)"
,
inode
->
i_ino
,
"(size %d)"
,
inode
->
i_ino
,
(
unsigned
long
long
)
logical
,
(
unsigned
long
long
)
logical
,
(
unsigned
long
long
)
phys
,
len
);
(
unsigned
long
long
)
phys
,
len
);
WARN_ON
(
1
);
return
-
EIO
;
return
-
EIO
;
}
}
return
0
;
return
0
;
...
@@ -1170,8 +1181,8 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
...
@@ -1170,8 +1181,8 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
up_read
((
&
EXT4_I
(
inode
)
->
i_data_sem
));
up_read
((
&
EXT4_I
(
inode
)
->
i_data_sem
));
if
(
retval
>
0
&&
buffer_mapped
(
bh
))
{
if
(
retval
>
0
&&
buffer_mapped
(
bh
))
{
int
ret
=
check_block_validity
(
inode
,
block
,
int
ret
=
check_block_validity
(
inode
,
"file system corruption"
,
bh
->
b_blocknr
,
retval
);
b
lock
,
b
h
->
b_blocknr
,
retval
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
return
ret
;
return
ret
;
}
}
...
@@ -1252,8 +1263,9 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
...
@@ -1252,8 +1263,9 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
up_write
((
&
EXT4_I
(
inode
)
->
i_data_sem
));
up_write
((
&
EXT4_I
(
inode
)
->
i_data_sem
));
if
(
retval
>
0
&&
buffer_mapped
(
bh
))
{
if
(
retval
>
0
&&
buffer_mapped
(
bh
))
{
int
ret
=
check_block_validity
(
inode
,
block
,
int
ret
=
check_block_validity
(
inode
,
"file system "
bh
->
b_blocknr
,
retval
);
"corruption after allocation"
,
block
,
bh
->
b_blocknr
,
retval
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
return
ret
;
return
ret
;
}
}
...
@@ -1863,18 +1875,6 @@ static void ext4_da_page_release_reservation(struct page *page,
...
@@ -1863,18 +1875,6 @@ static void ext4_da_page_release_reservation(struct page *page,
* Delayed allocation stuff
* Delayed allocation stuff
*/
*/
struct
mpage_da_data
{
struct
inode
*
inode
;
sector_t
b_blocknr
;
/* start block number of extent */
size_t
b_size
;
/* size of extent */
unsigned
long
b_state
;
/* state of the extent */
unsigned
long
first_page
,
next_page
;
/* extent of pages */
struct
writeback_control
*
wbc
;
int
io_done
;
int
pages_written
;
int
retval
;
};
/*
/*
* mpage_da_submit_io - walks through extent of pages and try to write
* mpage_da_submit_io - walks through extent of pages and try to write
* them with writepage() call back
* them with writepage() call back
...
@@ -2737,6 +2737,7 @@ static int ext4_da_writepages(struct address_space *mapping,
...
@@ -2737,6 +2737,7 @@ static int ext4_da_writepages(struct address_space *mapping,
long
pages_skipped
;
long
pages_skipped
;
int
range_cyclic
,
cycled
=
1
,
io_done
=
0
;
int
range_cyclic
,
cycled
=
1
,
io_done
=
0
;
int
needed_blocks
,
ret
=
0
,
nr_to_writebump
=
0
;
int
needed_blocks
,
ret
=
0
,
nr_to_writebump
=
0
;
loff_t
range_start
=
wbc
->
range_start
;
struct
ext4_sb_info
*
sbi
=
EXT4_SB
(
mapping
->
host
->
i_sb
);
struct
ext4_sb_info
*
sbi
=
EXT4_SB
(
mapping
->
host
->
i_sb
);
trace_ext4_da_writepages
(
inode
,
wbc
);
trace_ext4_da_writepages
(
inode
,
wbc
);
...
@@ -2850,6 +2851,7 @@ retry:
...
@@ -2850,6 +2851,7 @@ retry:
mpd
.
io_done
=
1
;
mpd
.
io_done
=
1
;
ret
=
MPAGE_DA_EXTENT_TAIL
;
ret
=
MPAGE_DA_EXTENT_TAIL
;
}
}
trace_ext4_da_write_pages
(
inode
,
&
mpd
);
wbc
->
nr_to_write
-=
mpd
.
pages_written
;
wbc
->
nr_to_write
-=
mpd
.
pages_written
;
ext4_journal_stop
(
handle
);
ext4_journal_stop
(
handle
);
...
@@ -2905,6 +2907,7 @@ out_writepages:
...
@@ -2905,6 +2907,7 @@ out_writepages:
if
(
!
no_nrwrite_index_update
)
if
(
!
no_nrwrite_index_update
)
wbc
->
no_nrwrite_index_update
=
0
;
wbc
->
no_nrwrite_index_update
=
0
;
wbc
->
nr_to_write
-=
nr_to_writebump
;
wbc
->
nr_to_write
-=
nr_to_writebump
;
wbc
->
range_start
=
range_start
;
trace_ext4_da_writepages_result
(
inode
,
wbc
,
ret
,
pages_written
);
trace_ext4_da_writepages_result
(
inode
,
wbc
,
ret
,
pages_written
);
return
ret
;
return
ret
;
}
}
...
@@ -3659,7 +3662,8 @@ static void ext4_clear_blocks(handle_t *handle, struct inode *inode,
...
@@ -3659,7 +3662,8 @@ static void ext4_clear_blocks(handle_t *handle, struct inode *inode,
ext4_handle_dirty_metadata
(
handle
,
inode
,
bh
);
ext4_handle_dirty_metadata
(
handle
,
inode
,
bh
);
}
}
ext4_mark_inode_dirty
(
handle
,
inode
);
ext4_mark_inode_dirty
(
handle
,
inode
);
ext4_journal_test_restart
(
handle
,
inode
);
ext4_truncate_restart_trans
(
handle
,
inode
,
blocks_for_truncate
(
inode
));
if
(
bh
)
{
if
(
bh
)
{
BUFFER_TRACE
(
bh
,
"retaking write access"
);
BUFFER_TRACE
(
bh
,
"retaking write access"
);
ext4_journal_get_write_access
(
handle
,
bh
);
ext4_journal_get_write_access
(
handle
,
bh
);
...
@@ -3870,7 +3874,8 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
...
@@ -3870,7 +3874,8 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
return
;
return
;
if
(
try_to_extend_transaction
(
handle
,
inode
))
{
if
(
try_to_extend_transaction
(
handle
,
inode
))
{
ext4_mark_inode_dirty
(
handle
,
inode
);
ext4_mark_inode_dirty
(
handle
,
inode
);
ext4_journal_test_restart
(
handle
,
inode
);
ext4_truncate_restart_trans
(
handle
,
inode
,
blocks_for_truncate
(
inode
));
}
}
ext4_free_blocks
(
handle
,
inode
,
nr
,
1
,
1
);
ext4_free_blocks
(
handle
,
inode
,
nr
,
1
,
1
);
...
@@ -4533,7 +4538,8 @@ static int ext4_inode_blocks_set(handle_t *handle,
...
@@ -4533,7 +4538,8 @@ static int ext4_inode_blocks_set(handle_t *handle,
*/
*/
static
int
ext4_do_update_inode
(
handle_t
*
handle
,
static
int
ext4_do_update_inode
(
handle_t
*
handle
,
struct
inode
*
inode
,
struct
inode
*
inode
,
struct
ext4_iloc
*
iloc
)
struct
ext4_iloc
*
iloc
,
int
do_sync
)
{
{
struct
ext4_inode
*
raw_inode
=
ext4_raw_inode
(
iloc
);
struct
ext4_inode
*
raw_inode
=
ext4_raw_inode
(
iloc
);
struct
ext4_inode_info
*
ei
=
EXT4_I
(
inode
);
struct
ext4_inode_info
*
ei
=
EXT4_I
(
inode
);
...
@@ -4635,10 +4641,22 @@ static int ext4_do_update_inode(handle_t *handle,
...
@@ -4635,10 +4641,22 @@ static int ext4_do_update_inode(handle_t *handle,
raw_inode
->
i_extra_isize
=
cpu_to_le16
(
ei
->
i_extra_isize
);
raw_inode
->
i_extra_isize
=
cpu_to_le16
(
ei
->
i_extra_isize
);
}
}
BUFFER_TRACE
(
bh
,
"call ext4_handle_dirty_metadata"
);
/*
rc
=
ext4_handle_dirty_metadata
(
handle
,
inode
,
bh
);
* If we're not using a journal and we were called from
if
(
!
err
)
* ext4_write_inode() to sync the inode (making do_sync true),
err
=
rc
;
* we can just use sync_dirty_buffer() directly to do our dirty
* work. Testing s_journal here is a bit redundant but it's
* worth it to avoid potential future trouble.
*/
if
(
EXT4_SB
(
inode
->
i_sb
)
->
s_journal
==
NULL
&&
do_sync
)
{
BUFFER_TRACE
(
bh
,
"call sync_dirty_buffer"
);
sync_dirty_buffer
(
bh
);
}
else
{
BUFFER_TRACE
(
bh
,
"call ext4_handle_dirty_metadata"
);
rc
=
ext4_handle_dirty_metadata
(
handle
,
inode
,
bh
);
if
(
!
err
)
err
=
rc
;
}
ei
->
i_state
&=
~
EXT4_STATE_NEW
;
ei
->
i_state
&=
~
EXT4_STATE_NEW
;
out_brelse:
out_brelse:
...
@@ -4684,19 +4702,32 @@ out_brelse:
...
@@ -4684,19 +4702,32 @@ out_brelse:
*/
*/
int
ext4_write_inode
(
struct
inode
*
inode
,
int
wait
)
int
ext4_write_inode
(
struct
inode
*
inode
,
int
wait
)
{
{
int
err
;
if
(
current
->
flags
&
PF_MEMALLOC
)
if
(
current
->
flags
&
PF_MEMALLOC
)
return
0
;
return
0
;
if
(
ext4_journal_current_handle
())
{
if
(
EXT4_SB
(
inode
->
i_sb
)
->
s_journal
)
{
jbd_debug
(
1
,
"called recursively, non-PF_MEMALLOC!
\n
"
);
if
(
ext4_journal_current_handle
())
{
dump_stack
();
jbd_debug
(
1
,
"called recursively, non-PF_MEMALLOC!
\n
"
);
return
-
EIO
;
dump_stack
();
}
return
-
EIO
;
}
if
(
!
wait
)
if
(
!
wait
)
return
0
;
return
0
;
return
ext4_force_commit
(
inode
->
i_sb
);
err
=
ext4_force_commit
(
inode
->
i_sb
);
}
else
{
struct
ext4_iloc
iloc
;
err
=
ext4_get_inode_loc
(
inode
,
&
iloc
);
if
(
err
)
return
err
;
err
=
ext4_do_update_inode
(
EXT4_NOJOURNAL_HANDLE
,
inode
,
&
iloc
,
wait
);
}
return
err
;
}
}
/*
/*
...
@@ -4990,7 +5021,7 @@ int ext4_mark_iloc_dirty(handle_t *handle,
...
@@ -4990,7 +5021,7 @@ int ext4_mark_iloc_dirty(handle_t *handle,
get_bh
(
iloc
->
bh
);
get_bh
(
iloc
->
bh
);
/* ext4_do_update_inode() does jbd2_journal_dirty_metadata */
/* ext4_do_update_inode() does jbd2_journal_dirty_metadata */
err
=
ext4_do_update_inode
(
handle
,
inode
,
iloc
);
err
=
ext4_do_update_inode
(
handle
,
inode
,
iloc
,
0
);
put_bh
(
iloc
->
bh
);
put_bh
(
iloc
->
bh
);
return
err
;
return
err
;
}
}
...
@@ -5281,12 +5312,21 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
...
@@ -5281,12 +5312,21 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
else
else
len
=
PAGE_CACHE_SIZE
;
len
=
PAGE_CACHE_SIZE
;
lock_page
(
page
);
/*
* return if we have all the buffers mapped. This avoid
* the need to call write_begin/write_end which does a
* journal_start/journal_stop which can block and take
* long time
*/
if
(
page_has_buffers
(
page
))
{
if
(
page_has_buffers
(
page
))
{
/* return if we have all the buffers mapped */
if
(
!
walk_page_buffers
(
NULL
,
page_buffers
(
page
),
0
,
len
,
NULL
,
if
(
!
walk_page_buffers
(
NULL
,
page_buffers
(
page
),
0
,
len
,
NULL
,
ext4_bh_unmapped
))
ext4_bh_unmapped
))
{
unlock_page
(
page
);
goto
out_unlock
;
goto
out_unlock
;
}
}
}
unlock_page
(
page
);
/*
/*
* OK, we need to fill the hole... Do write_begin write_end
* OK, we need to fill the hole... Do write_begin write_end
* to do block allocation/reservation.We are not holding
* to do block allocation/reservation.We are not holding
...
...
fs/ext4/ioctl.c
View file @
e93117ef
...
@@ -243,10 +243,9 @@ setversion_out:
...
@@ -243,10 +243,9 @@ setversion_out:
me
.
donor_start
,
me
.
len
,
&
me
.
moved_len
);
me
.
donor_start
,
me
.
len
,
&
me
.
moved_len
);
fput
(
donor_filp
);
fput
(
donor_filp
);
if
(
!
err
)
if
(
copy_to_user
((
struct
move_extent
*
)
arg
,
&
me
,
sizeof
(
me
)))
if
(
copy_to_user
((
struct
move_extent
*
)
arg
,
return
-
EFAULT
;
&
me
,
sizeof
(
me
)))
return
-
EFAULT
;
return
err
;
return
err
;
}
}
...
...
fs/ext4/mballoc.c
View file @
e93117ef
This diff is collapsed.
Click to expand it.
fs/ext4/mballoc.h
View file @
e93117ef
...
@@ -37,11 +37,19 @@
...
@@ -37,11 +37,19 @@
/*
/*
*/
*/
#define MB_DEBUG__
#ifdef CONFIG_EXT4_DEBUG
#ifdef MB_DEBUG
extern
u8
mb_enable_debug
;
#define mb_debug(fmt, a...) printk(fmt, ##a)
#define mb_debug(n, fmt, a...) \
do { \
if ((n) <= mb_enable_debug) { \
printk (KERN_DEBUG "(%s, %d): %s: ", \
__FILE__, __LINE__, __func__); \
printk (fmt, ## a); \
} \
} while (0)
#else
#else
#define mb_debug(fmt, a...)
#define mb_debug(
n,
fmt, a...)
#endif
#endif
/*
/*
...
@@ -128,8 +136,8 @@ struct ext4_prealloc_space {
...
@@ -128,8 +136,8 @@ struct ext4_prealloc_space {
unsigned
pa_deleted
;
unsigned
pa_deleted
;
ext4_fsblk_t
pa_pstart
;
/* phys. block */
ext4_fsblk_t
pa_pstart
;
/* phys. block */
ext4_lblk_t
pa_lstart
;
/* log. block */
ext4_lblk_t
pa_lstart
;
/* log. block */
unsigned
shor
t
pa_len
;
/* len of preallocated chunk */
ext4_grpblk_
t
pa_len
;
/* len of preallocated chunk */
unsigned
shor
t
pa_free
;
/* how many blocks are free */
ext4_grpblk_
t
pa_free
;
/* how many blocks are free */
unsigned
short
pa_type
;
/* pa type. inode or group */
unsigned
short
pa_type
;
/* pa type. inode or group */
spinlock_t
*
pa_obj_lock
;
spinlock_t
*
pa_obj_lock
;
struct
inode
*
pa_inode
;
/* hack, for history only */
struct
inode
*
pa_inode
;
/* hack, for history only */
...
@@ -144,7 +152,7 @@ struct ext4_free_extent {
...
@@ -144,7 +152,7 @@ struct ext4_free_extent {
ext4_lblk_t
fe_logical
;
ext4_lblk_t
fe_logical
;
ext4_grpblk_t
fe_start
;
ext4_grpblk_t
fe_start
;
ext4_group_t
fe_group
;
ext4_group_t
fe_group
;
in
t
fe_len
;
ext4_grpblk_
t
fe_len
;
};
};
/*
/*
...
...
fs/ext4/migrate.c
View file @
e93117ef
...
@@ -618,7 +618,7 @@ err_out:
...
@@ -618,7 +618,7 @@ err_out:
tmp_inode
->
i_nlink
=
0
;
tmp_inode
->
i_nlink
=
0
;
ext4_journal_stop
(
handle
);
ext4_journal_stop
(
handle
);
unlock_new_inode
(
tmp_inode
);
iput
(
tmp_inode
);
iput
(
tmp_inode
);
return
retval
;
return
retval
;
...
...
fs/ext4/move_extent.c
View file @
e93117ef
...
@@ -740,7 +740,7 @@ out:
...
@@ -740,7 +740,7 @@ out:
* on success, or a negative error value on failure.
* on success, or a negative error value on failure.
*/
*/
static
int
static
int
move_extent_p
a
r_page
(
struct
file
*
o_filp
,
struct
inode
*
donor_inode
,
move_extent_p
e
r_page
(
struct
file
*
o_filp
,
struct
inode
*
donor_inode
,
pgoff_t
orig_page_offset
,
int
data_offset_in_page
,
pgoff_t
orig_page_offset
,
int
data_offset_in_page
,
int
block_len_in_page
,
int
uninit
)
int
block_len_in_page
,
int
uninit
)
{
{
...
@@ -871,6 +871,7 @@ out:
...
@@ -871,6 +871,7 @@ out:
if
(
PageLocked
(
page
))
if
(
PageLocked
(
page
))
unlock_page
(
page
);
unlock_page
(
page
);
page_cache_release
(
page
);
page_cache_release
(
page
);
ext4_journal_stop
(
handle
);
}
}
out2:
out2:
ext4_journal_stop
(
handle
);
ext4_journal_stop
(
handle
);
...
@@ -971,43 +972,52 @@ mext_check_arguments(struct inode *orig_inode,
...
@@ -971,43 +972,52 @@ mext_check_arguments(struct inode *orig_inode,
}
}
if
(
orig_inode
->
i_size
>
donor_inode
->
i_size
)
{
if
(
orig_inode
->
i_size
>
donor_inode
->
i_size
)
{
if
(
orig_start
>=
donor_inode
->
i_size
)
{
if
(
orig_start
<<
orig_inode
->
i_blkbits
>=
donor_inode
->
i_size
)
{
ext4_debug
(
"ext4 move extent: orig start offset "
ext4_debug
(
"ext4 move extent: orig start offset "
"[%llu] should be less than donor file size "
"[%llu] should be less than donor file size "
"[%lld] [ino:orig %lu, donor_inode %lu]
\n
"
,
"[%lld] [ino:orig %lu, donor_inode %lu]
\n
"
,
orig_start
,
donor_inode
->
i_size
,
orig_start
<<
orig_inode
->
i_blkbits
,
orig_inode
->
i_ino
,
donor_inode
->
i_ino
);
donor_inode
->
i_size
,
orig_inode
->
i_ino
,
donor_inode
->
i_ino
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
if
((
orig_start
+
*
len
)
<<
orig_inode
->
i_blkbits
>
if
(
orig_start
+
*
len
>
donor_inode
->
i_size
)
{
donor_inode
->
i_size
)
{
ext4_debug
(
"ext4 move extent: End offset [%llu] should "
ext4_debug
(
"ext4 move extent: End offset [%llu] should "
"be less than donor file size [%lld]."
"be less than donor file size [%lld]."
"So adjust length from %llu to %lld "
"So adjust length from %llu to %lld "
"[ino:orig %lu, donor %lu]
\n
"
,
"[ino:orig %lu, donor %lu]
\n
"
,
orig_start
+
*
len
,
donor_inode
->
i_size
,
(
orig_start
+
*
len
)
<<
orig_inode
->
i_blkbits
,
*
len
,
donor_inode
->
i_size
-
orig_start
,
donor_inode
->
i_size
,
*
len
,
(
donor_inode
->
i_size
>>
orig_inode
->
i_blkbits
)
-
orig_start
,
orig_inode
->
i_ino
,
donor_inode
->
i_ino
);
orig_inode
->
i_ino
,
donor_inode
->
i_ino
);
*
len
=
donor_inode
->
i_size
-
orig_start
;
*
len
=
(
donor_inode
->
i_size
>>
orig_inode
->
i_blkbits
)
-
orig_start
;
}
}
}
else
{
}
else
{
if
(
orig_start
>=
orig_inode
->
i_size
)
{
if
(
orig_start
<<
orig_inode
->
i_blkbits
>=
orig_inode
->
i_size
)
{
ext4_debug
(
"ext4 move extent: start offset [%llu] "
ext4_debug
(
"ext4 move extent: start offset [%llu] "
"should be less than original file size "
"should be less than original file size "
"[%lld] [inode:orig %lu, donor %lu]
\n
"
,
"[%lld] [inode:orig %lu, donor %lu]
\n
"
,
orig_start
,
orig_inode
->
i_size
,
orig_start
<<
orig_inode
->
i_blkbits
,
orig_inode
->
i_ino
,
donor_inode
->
i_ino
);
orig_inode
->
i_size
,
orig_inode
->
i_ino
,
donor_inode
->
i_ino
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
if
((
orig_start
+
*
len
)
<<
orig_inode
->
i_blkbits
>
if
(
orig_start
+
*
len
>
orig_inode
->
i_size
)
{
orig_inode
->
i_size
)
{
ext4_debug
(
"ext4 move extent: Adjust length "
ext4_debug
(
"ext4 move extent: Adjust length "
"from %llu to %lld. Because it should be "
"from %llu to %lld. Because it should be "
"less than original file size "
"less than original file size "
"[ino:orig %lu, donor %lu]
\n
"
,
"[ino:orig %lu, donor %lu]
\n
"
,
*
len
,
orig_inode
->
i_size
-
orig_start
,
*
len
,
(
orig_inode
->
i_size
>>
orig_inode
->
i_blkbits
)
-
orig_start
,
orig_inode
->
i_ino
,
donor_inode
->
i_ino
);
orig_inode
->
i_ino
,
donor_inode
->
i_ino
);
*
len
=
orig_inode
->
i_size
-
orig_start
;
*
len
=
(
orig_inode
->
i_size
>>
orig_inode
->
i_blkbits
)
-
orig_start
;
}
}
}
}
...
@@ -1258,7 +1268,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
...
@@ -1258,7 +1268,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
while
(
orig_page_offset
<=
seq_end_page
)
{
while
(
orig_page_offset
<=
seq_end_page
)
{
/* Swap original branches with new branches */
/* Swap original branches with new branches */
ret
=
move_extent_p
a
r_page
(
o_filp
,
donor_inode
,
ret
=
move_extent_p
e
r_page
(
o_filp
,
donor_inode
,
orig_page_offset
,
orig_page_offset
,
data_offset_in_page
,
data_offset_in_page
,
block_len_in_page
,
uninit
);
block_len_in_page
,
uninit
);
...
@@ -1313,8 +1323,5 @@ out2:
...
@@ -1313,8 +1323,5 @@ out2:
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
/* All of the specified blocks must be exchanged in succeed */
BUG_ON
(
*
moved_len
!=
len
);
return
0
;
return
0
;
}
}
fs/ext4/namei.c
View file @
e93117ef
...
@@ -1518,8 +1518,12 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
...
@@ -1518,8 +1518,12 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
return
retval
;
return
retval
;
if
(
blocks
==
1
&&
!
dx_fallback
&&
if
(
blocks
==
1
&&
!
dx_fallback
&&
EXT4_HAS_COMPAT_FEATURE
(
sb
,
EXT4_FEATURE_COMPAT_DIR_INDEX
))
EXT4_HAS_COMPAT_FEATURE
(
sb
,
EXT4_FEATURE_COMPAT_DIR_INDEX
))
{
return
make_indexed_dir
(
handle
,
dentry
,
inode
,
bh
);
retval
=
make_indexed_dir
(
handle
,
dentry
,
inode
,
bh
);
if
(
retval
==
-
ENOSPC
)
brelse
(
bh
);
return
retval
;
}
brelse
(
bh
);
brelse
(
bh
);
}
}
bh
=
ext4_append
(
handle
,
dir
,
&
block
,
&
retval
);
bh
=
ext4_append
(
handle
,
dir
,
&
block
,
&
retval
);
...
@@ -1528,7 +1532,10 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
...
@@ -1528,7 +1532,10 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
de
=
(
struct
ext4_dir_entry_2
*
)
bh
->
b_data
;
de
=
(
struct
ext4_dir_entry_2
*
)
bh
->
b_data
;
de
->
inode
=
0
;
de
->
inode
=
0
;
de
->
rec_len
=
ext4_rec_len_to_disk
(
blocksize
,
blocksize
);
de
->
rec_len
=
ext4_rec_len_to_disk
(
blocksize
,
blocksize
);
return
add_dirent_to_buf
(
handle
,
dentry
,
inode
,
de
,
bh
);
retval
=
add_dirent_to_buf
(
handle
,
dentry
,
inode
,
de
,
bh
);
if
(
retval
==
-
ENOSPC
)
brelse
(
bh
);
return
retval
;
}
}
/*
/*
...
@@ -1590,9 +1597,9 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
...
@@ -1590,9 +1597,9 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
goto
cleanup
;
goto
cleanup
;
node2
=
(
struct
dx_node
*
)(
bh2
->
b_data
);
node2
=
(
struct
dx_node
*
)(
bh2
->
b_data
);
entries2
=
node2
->
entries
;
entries2
=
node2
->
entries
;
memset
(
&
node2
->
fake
,
0
,
sizeof
(
struct
fake_dirent
));
node2
->
fake
.
rec_len
=
ext4_rec_len_to_disk
(
sb
->
s_blocksize
,
node2
->
fake
.
rec_len
=
ext4_rec_len_to_disk
(
sb
->
s_blocksize
,
sb
->
s_blocksize
);
sb
->
s_blocksize
);
node2
->
fake
.
inode
=
0
;
BUFFER_TRACE
(
frame
->
bh
,
"get_write_access"
);
BUFFER_TRACE
(
frame
->
bh
,
"get_write_access"
);
err
=
ext4_journal_get_write_access
(
handle
,
frame
->
bh
);
err
=
ext4_journal_get_write_access
(
handle
,
frame
->
bh
);
if
(
err
)
if
(
err
)
...
@@ -1657,7 +1664,8 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
...
@@ -1657,7 +1664,8 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
if
(
!
de
)
if
(
!
de
)
goto
cleanup
;
goto
cleanup
;
err
=
add_dirent_to_buf
(
handle
,
dentry
,
inode
,
de
,
bh
);
err
=
add_dirent_to_buf
(
handle
,
dentry
,
inode
,
de
,
bh
);
bh
=
NULL
;
if
(
err
!=
-
ENOSPC
)
bh
=
NULL
;
goto
cleanup
;
goto
cleanup
;
journal_error:
journal_error:
...
@@ -2310,7 +2318,7 @@ static int ext4_link(struct dentry *old_dentry,
...
@@ -2310,7 +2318,7 @@ static int ext4_link(struct dentry *old_dentry,
struct
inode
*
inode
=
old_dentry
->
d_inode
;
struct
inode
*
inode
=
old_dentry
->
d_inode
;
int
err
,
retries
=
0
;
int
err
,
retries
=
0
;
if
(
EXT4_DIR_LINK_MAX
(
inode
)
)
if
(
inode
->
i_nlink
>=
EXT4_LINK_MAX
)
return
-
EMLINK
;
return
-
EMLINK
;
/*
/*
...
@@ -2413,7 +2421,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
...
@@ -2413,7 +2421,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
goto
end_rename
;
goto
end_rename
;
retval
=
-
EMLINK
;
retval
=
-
EMLINK
;
if
(
!
new_inode
&&
new_dir
!=
old_dir
&&
if
(
!
new_inode
&&
new_dir
!=
old_dir
&&
new_dir
->
i_nlink
>=
EXT4_LINK_MAX
)
EXT4_DIR_LINK_MAX
(
new_dir
)
)
goto
end_rename
;
goto
end_rename
;
}
}
if
(
!
new_bh
)
{
if
(
!
new_bh
)
{
...
...
fs/ext4/resize.c
View file @
e93117ef
...
@@ -746,7 +746,6 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
...
@@ -746,7 +746,6 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
struct
inode
*
inode
=
NULL
;
struct
inode
*
inode
=
NULL
;
handle_t
*
handle
;
handle_t
*
handle
;
int
gdb_off
,
gdb_num
;
int
gdb_off
,
gdb_num
;
int
num_grp_locked
=
0
;
int
err
,
err2
;
int
err
,
err2
;
gdb_num
=
input
->
group
/
EXT4_DESC_PER_BLOCK
(
sb
);
gdb_num
=
input
->
group
/
EXT4_DESC_PER_BLOCK
(
sb
);
...
@@ -856,7 +855,6 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
...
@@ -856,7 +855,6 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
* using the new disk blocks.
* using the new disk blocks.
*/
*/
num_grp_locked
=
ext4_mb_get_buddy_cache_lock
(
sb
,
input
->
group
);
/* Update group descriptor block for new group */
/* Update group descriptor block for new group */
gdp
=
(
struct
ext4_group_desc
*
)((
char
*
)
primary
->
b_data
+
gdp
=
(
struct
ext4_group_desc
*
)((
char
*
)
primary
->
b_data
+
gdb_off
*
EXT4_DESC_SIZE
(
sb
));
gdb_off
*
EXT4_DESC_SIZE
(
sb
));
...
@@ -875,10 +873,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
...
@@ -875,10 +873,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
* descriptor
* descriptor
*/
*/
err
=
ext4_mb_add_groupinfo
(
sb
,
input
->
group
,
gdp
);
err
=
ext4_mb_add_groupinfo
(
sb
,
input
->
group
,
gdp
);
if
(
err
)
{
if
(
err
)
ext4_mb_put_buddy_cache_lock
(
sb
,
input
->
group
,
num_grp_locked
);
goto
exit_journal
;
goto
exit_journal
;
}
/*
/*
* Make the new blocks and inodes valid next. We do this before
* Make the new blocks and inodes valid next. We do this before
...
@@ -920,7 +916,6 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
...
@@ -920,7 +916,6 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
/* Update the global fs size fields */
/* Update the global fs size fields */
sbi
->
s_groups_count
++
;
sbi
->
s_groups_count
++
;
ext4_mb_put_buddy_cache_lock
(
sb
,
input
->
group
,
num_grp_locked
);
ext4_handle_dirty_metadata
(
handle
,
NULL
,
primary
);
ext4_handle_dirty_metadata
(
handle
,
NULL
,
primary
);
...
...
fs/ext4/super.c
View file @
e93117ef
...
@@ -344,7 +344,8 @@ static const char *ext4_decode_error(struct super_block *sb, int errno,
...
@@ -344,7 +344,8 @@ static const char *ext4_decode_error(struct super_block *sb, int errno,
errstr
=
"Out of memory"
;
errstr
=
"Out of memory"
;
break
;
break
;
case
-
EROFS
:
case
-
EROFS
:
if
(
!
sb
||
EXT4_SB
(
sb
)
->
s_journal
->
j_flags
&
JBD2_ABORT
)
if
(
!
sb
||
(
EXT4_SB
(
sb
)
->
s_journal
&&
EXT4_SB
(
sb
)
->
s_journal
->
j_flags
&
JBD2_ABORT
))
errstr
=
"Journal has aborted"
;
errstr
=
"Journal has aborted"
;
else
else
errstr
=
"Readonly filesystem"
;
errstr
=
"Readonly filesystem"
;
...
@@ -1279,11 +1280,9 @@ static int parse_options(char *options, struct super_block *sb,
...
@@ -1279,11 +1280,9 @@ static int parse_options(char *options, struct super_block *sb,
*
journal_devnum
=
option
;
*
journal_devnum
=
option
;
break
;
break
;
case
Opt_journal_checksum
:
case
Opt_journal_checksum
:
set_opt
(
sbi
->
s_mount_opt
,
JOURNAL_CHECKSUM
);
break
;
/* Kept for backwards compatibility */
break
;
case
Opt_journal_async_commit
:
case
Opt_journal_async_commit
:
set_opt
(
sbi
->
s_mount_opt
,
JOURNAL_ASYNC_COMMIT
);
set_opt
(
sbi
->
s_mount_opt
,
JOURNAL_ASYNC_COMMIT
);
set_opt
(
sbi
->
s_mount_opt
,
JOURNAL_CHECKSUM
);
break
;
break
;
case
Opt_noload
:
case
Opt_noload
:
set_opt
(
sbi
->
s_mount_opt
,
NOLOAD
);
set_opt
(
sbi
->
s_mount_opt
,
NOLOAD
);
...
@@ -1695,12 +1694,12 @@ static int ext4_fill_flex_info(struct super_block *sb)
...
@@ -1695,12 +1694,12 @@ static int ext4_fill_flex_info(struct super_block *sb)
gdp
=
ext4_get_group_desc
(
sb
,
i
,
NULL
);
gdp
=
ext4_get_group_desc
(
sb
,
i
,
NULL
);
flex_group
=
ext4_flex_group
(
sbi
,
i
);
flex_group
=
ext4_flex_group
(
sbi
,
i
);
atomic_
set
(
&
sbi
->
s_flex_groups
[
flex_group
].
free_inodes
,
atomic_
add
(
ext4_free_inodes_count
(
sb
,
gdp
)
,
ext4_free_inodes_count
(
sb
,
gdp
)
);
&
sbi
->
s_flex_groups
[
flex_group
].
free_inodes
);
atomic_
set
(
&
sbi
->
s_flex_groups
[
flex_group
].
free_blocks
,
atomic_
add
(
ext4_free_blks_count
(
sb
,
gdp
)
,
ext4_free_blks_count
(
sb
,
gdp
)
);
&
sbi
->
s_flex_groups
[
flex_group
].
free_blocks
);
atomic_
set
(
&
sbi
->
s_flex_groups
[
flex_group
].
used_dirs
,
atomic_
add
(
ext4_used_dirs_count
(
sb
,
gdp
)
,
ext4_used_dirs_count
(
sb
,
gdp
)
);
&
sbi
->
s_flex_groups
[
flex_group
].
used_dirs
);
}
}
return
1
;
return
1
;
...
@@ -2253,6 +2252,49 @@ static struct kobj_type ext4_ktype = {
...
@@ -2253,6 +2252,49 @@ static struct kobj_type ext4_ktype = {
.
release
=
ext4_sb_release
,
.
release
=
ext4_sb_release
,
};
};
/*
* Check whether this filesystem can be mounted based on
* the features present and the RDONLY/RDWR mount requested.
* Returns 1 if this filesystem can be mounted as requested,
* 0 if it cannot be.
*/
static
int
ext4_feature_set_ok
(
struct
super_block
*
sb
,
int
readonly
)
{
if
(
EXT4_HAS_INCOMPAT_FEATURE
(
sb
,
~
EXT4_FEATURE_INCOMPAT_SUPP
))
{
ext4_msg
(
sb
,
KERN_ERR
,
"Couldn't mount because of "
"unsupported optional features (%x)"
,
(
le32_to_cpu
(
EXT4_SB
(
sb
)
->
s_es
->
s_feature_incompat
)
&
~
EXT4_FEATURE_INCOMPAT_SUPP
));
return
0
;
}
if
(
readonly
)
return
1
;
/* Check that feature set is OK for a read-write mount */
if
(
EXT4_HAS_RO_COMPAT_FEATURE
(
sb
,
~
EXT4_FEATURE_RO_COMPAT_SUPP
))
{
ext4_msg
(
sb
,
KERN_ERR
,
"couldn't mount RDWR because of "
"unsupported optional features (%x)"
,
(
le32_to_cpu
(
EXT4_SB
(
sb
)
->
s_es
->
s_feature_ro_compat
)
&
~
EXT4_FEATURE_RO_COMPAT_SUPP
));
return
0
;
}
/*
* Large file size enabled file system can only be mounted
* read-write on 32-bit systems if kernel is built with CONFIG_LBDAF
*/
if
(
EXT4_HAS_RO_COMPAT_FEATURE
(
sb
,
EXT4_FEATURE_RO_COMPAT_HUGE_FILE
))
{
if
(
sizeof
(
blkcnt_t
)
<
sizeof
(
u64
))
{
ext4_msg
(
sb
,
KERN_ERR
,
"Filesystem with huge files "
"cannot be mounted RDWR without "
"CONFIG_LBDAF"
);
return
0
;
}
}
return
1
;
}
static
int
ext4_fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
silent
)
static
int
ext4_fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
silent
)
__releases
(
kernel_lock
)
__releases
(
kernel_lock
)
__acquires
(
kernel_lock
)
__acquires
(
kernel_lock
)
...
@@ -2274,7 +2316,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -2274,7 +2316,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
unsigned
int
db_count
;
unsigned
int
db_count
;
unsigned
int
i
;
unsigned
int
i
;
int
needs_recovery
,
has_huge_files
;
int
needs_recovery
,
has_huge_files
;
int
features
;
__u64
blocks_count
;
__u64
blocks_count
;
int
err
;
int
err
;
unsigned
int
journal_ioprio
=
DEFAULT_JOURNAL_IOPRIO
;
unsigned
int
journal_ioprio
=
DEFAULT_JOURNAL_IOPRIO
;
...
@@ -2401,39 +2442,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -2401,39 +2442,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
* previously didn't change the revision level when setting the flags,
* previously didn't change the revision level when setting the flags,
* so there is a chance incompat flags are set on a rev 0 filesystem.
* so there is a chance incompat flags are set on a rev 0 filesystem.
*/
*/
features
=
EXT4_HAS_INCOMPAT_FEATURE
(
sb
,
~
EXT4_FEATURE_INCOMPAT_SUPP
);
if
(
!
ext4_feature_set_ok
(
sb
,
(
sb
->
s_flags
&
MS_RDONLY
)))
if
(
features
)
{
ext4_msg
(
sb
,
KERN_ERR
,
"Couldn't mount because of "
"unsupported optional features (%x)"
,
(
le32_to_cpu
(
EXT4_SB
(
sb
)
->
s_es
->
s_feature_incompat
)
&
~
EXT4_FEATURE_INCOMPAT_SUPP
));
goto
failed_mount
;
}
features
=
EXT4_HAS_RO_COMPAT_FEATURE
(
sb
,
~
EXT4_FEATURE_RO_COMPAT_SUPP
);
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
)
&&
features
)
{
ext4_msg
(
sb
,
KERN_ERR
,
"Couldn't mount RDWR because of "
"unsupported optional features (%x)"
,
(
le32_to_cpu
(
EXT4_SB
(
sb
)
->
s_es
->
s_feature_ro_compat
)
&
~
EXT4_FEATURE_RO_COMPAT_SUPP
));
goto
failed_mount
;
goto
failed_mount
;
}
has_huge_files
=
EXT4_HAS_RO_COMPAT_FEATURE
(
sb
,
EXT4_FEATURE_RO_COMPAT_HUGE_FILE
);
if
(
has_huge_files
)
{
/*
* Large file size enabled file system can only be
* mount if kernel is build with CONFIG_LBDAF
*/
if
(
sizeof
(
root
->
i_blocks
)
<
sizeof
(
u64
)
&&
!
(
sb
->
s_flags
&
MS_RDONLY
))
{
ext4_msg
(
sb
,
KERN_ERR
,
"Filesystem with huge "
"files cannot be mounted read-write "
"without CONFIG_LBDAF"
);
goto
failed_mount
;
}
}
blocksize
=
BLOCK_SIZE
<<
le32_to_cpu
(
es
->
s_log_block_size
);
blocksize
=
BLOCK_SIZE
<<
le32_to_cpu
(
es
->
s_log_block_size
);
if
(
blocksize
<
EXT4_MIN_BLOCK_SIZE
||
if
(
blocksize
<
EXT4_MIN_BLOCK_SIZE
||
...
@@ -2469,6 +2480,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -2469,6 +2480,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
}
}
}
}
has_huge_files
=
EXT4_HAS_RO_COMPAT_FEATURE
(
sb
,
EXT4_FEATURE_RO_COMPAT_HUGE_FILE
);
sbi
->
s_bitmap_maxbytes
=
ext4_max_bitmap_size
(
sb
->
s_blocksize_bits
,
sbi
->
s_bitmap_maxbytes
=
ext4_max_bitmap_size
(
sb
->
s_blocksize_bits
,
has_huge_files
);
has_huge_files
);
sb
->
s_maxbytes
=
ext4_max_size
(
sb
->
s_blocksize_bits
,
has_huge_files
);
sb
->
s_maxbytes
=
ext4_max_size
(
sb
->
s_blocksize_bits
,
has_huge_files
);
...
@@ -2549,12 +2562,19 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -2549,12 +2562,19 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
goto
failed_mount
;
goto
failed_mount
;
}
}
if
(
ext4_blocks_count
(
es
)
>
/*
(
sector_t
)(
~
0ULL
)
>>
(
sb
->
s_blocksize_bits
-
9
))
{
* Test whether we have more sectors than will fit in sector_t,
* and whether the max offset is addressable by the page cache.
*/
if
((
ext4_blocks_count
(
es
)
>
(
sector_t
)(
~
0ULL
)
>>
(
sb
->
s_blocksize_bits
-
9
))
||
(
ext4_blocks_count
(
es
)
>
(
pgoff_t
)(
~
0ULL
)
>>
(
PAGE_CACHE_SHIFT
-
sb
->
s_blocksize_bits
)))
{
ext4_msg
(
sb
,
KERN_ERR
,
"filesystem"
ext4_msg
(
sb
,
KERN_ERR
,
"filesystem"
" too large to mount safely
"
);
" too large to mount safely on this system
"
);
if
(
sizeof
(
sector_t
)
<
8
)
if
(
sizeof
(
sector_t
)
<
8
)
ext4_msg
(
sb
,
KERN_WARNING
,
"CONFIG_LBDAF not enabled"
);
ext4_msg
(
sb
,
KERN_WARNING
,
"CONFIG_LBDAF not enabled"
);
ret
=
-
EFBIG
;
goto
failed_mount
;
goto
failed_mount
;
}
}
...
@@ -2729,20 +2749,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -2729,20 +2749,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
goto
failed_mount4
;
goto
failed_mount4
;
}
}
if
(
test_opt
(
sb
,
JOURNAL_ASYNC_COMMIT
))
{
jbd2_journal_set_features
(
sbi
->
s_journal
,
jbd2_journal_set_features
(
sbi
->
s_journal
,
JBD2_FEATURE_COMPAT_CHECKSUM
,
0
,
0
);
JBD2_FEATURE_COMPAT_CHECKSUM
,
0
,
if
(
test_opt
(
sb
,
JOURNAL_ASYNC_COMMIT
))
jbd2_journal_set_features
(
sbi
->
s_journal
,
0
,
0
,
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
);
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
);
}
else
if
(
test_opt
(
sb
,
JOURNAL_CHECKSUM
))
{
else
jbd2_journal_set_features
(
sbi
->
s_journal
,
JBD2_FEATURE_COMPAT_CHECKSUM
,
0
,
0
);
jbd2_journal_clear_features
(
sbi
->
s_journal
,
0
,
0
,
jbd2_journal_clear_features
(
sbi
->
s_journal
,
0
,
0
,
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
);
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
);
}
else
{
jbd2_journal_clear_features
(
sbi
->
s_journal
,
JBD2_FEATURE_COMPAT_CHECKSUM
,
0
,
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
);
}
/* We have now updated the journal if required, so we can
/* We have now updated the journal if required, so we can
* validate the data journaling mode. */
* validate the data journaling mode. */
...
@@ -3208,7 +3222,18 @@ static int ext4_commit_super(struct super_block *sb, int sync)
...
@@ -3208,7 +3222,18 @@ static int ext4_commit_super(struct super_block *sb, int sync)
clear_buffer_write_io_error
(
sbh
);
clear_buffer_write_io_error
(
sbh
);
set_buffer_uptodate
(
sbh
);
set_buffer_uptodate
(
sbh
);
}
}
es
->
s_wtime
=
cpu_to_le32
(
get_seconds
());
/*
* If the file system is mounted read-only, don't update the
* superblock write time. This avoids updating the superblock
* write time when we are mounting the root file system
* read/only but we need to replay the journal; at that point,
* for people who are east of GMT and who make their clock
* tick in localtime for Windows bug-for-bug compatibility,
* the clock is set in the future, and this will cause e2fsck
* to complain and force a full file system check.
*/
if
(
!
(
sb
->
s_flags
&
MS_RDONLY
))
es
->
s_wtime
=
cpu_to_le32
(
get_seconds
());
es
->
s_kbytes_written
=
es
->
s_kbytes_written
=
cpu_to_le64
(
EXT4_SB
(
sb
)
->
s_kbytes_written
+
cpu_to_le64
(
EXT4_SB
(
sb
)
->
s_kbytes_written
+
((
part_stat_read
(
sb
->
s_bdev
->
bd_part
,
sectors
[
1
])
-
((
part_stat_read
(
sb
->
s_bdev
->
bd_part
,
sectors
[
1
])
-
...
@@ -3477,18 +3502,11 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
...
@@ -3477,18 +3502,11 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
if
(
sbi
->
s_journal
)
if
(
sbi
->
s_journal
)
ext4_mark_recovery_complete
(
sb
,
es
);
ext4_mark_recovery_complete
(
sb
,
es
);
}
else
{
}
else
{
int
ret
;
/* Make sure we can mount this feature set readwrite */
if
((
ret
=
EXT4_HAS_RO_COMPAT_FEATURE
(
sb
,
if
(
!
ext4_feature_set_ok
(
sb
,
0
))
{
~
EXT4_FEATURE_RO_COMPAT_SUPP
)))
{
ext4_msg
(
sb
,
KERN_WARNING
,
"couldn't "
"remount RDWR because of unsupported "
"optional features (%x)"
,
(
le32_to_cpu
(
sbi
->
s_es
->
s_feature_ro_compat
)
&
~
EXT4_FEATURE_RO_COMPAT_SUPP
));
err
=
-
EROFS
;
err
=
-
EROFS
;
goto
restore_opts
;
goto
restore_opts
;
}
}
/*
/*
* Make sure the group descriptor checksums
* Make sure the group descriptor checksums
* are sane. If they aren't, refuse to remount r/w.
* are sane. If they aren't, refuse to remount r/w.
...
...
fs/jbd2/commit.c
View file @
e93117ef
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <linux/writeback.h>
#include <linux/writeback.h>
#include <linux/backing-dev.h>
#include <linux/backing-dev.h>
#include <linux/bio.h>
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <trace/events/jbd2.h>
#include <trace/events/jbd2.h>
/*
/*
...
@@ -133,8 +134,8 @@ static int journal_submit_commit_record(journal_t *journal,
...
@@ -133,8 +134,8 @@ static int journal_submit_commit_record(journal_t *journal,
bh
->
b_end_io
=
journal_end_buffer_io_sync
;
bh
->
b_end_io
=
journal_end_buffer_io_sync
;
if
(
journal
->
j_flags
&
JBD2_BARRIER
&&
if
(
journal
->
j_flags
&
JBD2_BARRIER
&&
!
JBD2_HAS_INCOMPAT_FEATURE
(
journal
,
!
JBD2_HAS_INCOMPAT_FEATURE
(
journal
,
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
))
{
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
))
{
set_buffer_ordered
(
bh
);
set_buffer_ordered
(
bh
);
barrier_done
=
1
;
barrier_done
=
1
;
}
}
...
@@ -707,11 +708,13 @@ start_journal_io:
...
@@ -707,11 +708,13 @@ start_journal_io:
/* Done it all: now write the commit record asynchronously. */
/* Done it all: now write the commit record asynchronously. */
if
(
JBD2_HAS_INCOMPAT_FEATURE
(
journal
,
if
(
JBD2_HAS_INCOMPAT_FEATURE
(
journal
,
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
))
{
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
))
{
err
=
journal_submit_commit_record
(
journal
,
commit_transaction
,
err
=
journal_submit_commit_record
(
journal
,
commit_transaction
,
&
cbh
,
crc32_sum
);
&
cbh
,
crc32_sum
);
if
(
err
)
if
(
err
)
__jbd2_journal_abort_hard
(
journal
);
__jbd2_journal_abort_hard
(
journal
);
if
(
journal
->
j_flags
&
JBD2_BARRIER
)
blkdev_issue_flush
(
journal
->
j_dev
,
NULL
);
}
}
/*
/*
...
@@ -834,7 +837,7 @@ wait_for_iobuf:
...
@@ -834,7 +837,7 @@ wait_for_iobuf:
jbd_debug
(
3
,
"JBD: commit phase 5
\n
"
);
jbd_debug
(
3
,
"JBD: commit phase 5
\n
"
);
if
(
!
JBD2_HAS_INCOMPAT_FEATURE
(
journal
,
if
(
!
JBD2_HAS_INCOMPAT_FEATURE
(
journal
,
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
))
{
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT
))
{
err
=
journal_submit_commit_record
(
journal
,
commit_transaction
,
err
=
journal_submit_commit_record
(
journal
,
commit_transaction
,
&
cbh
,
crc32_sum
);
&
cbh
,
crc32_sum
);
if
(
err
)
if
(
err
)
...
...
fs/jbd2/journal.c
View file @
e93117ef
...
@@ -1187,6 +1187,12 @@ static int journal_reset(journal_t *journal)
...
@@ -1187,6 +1187,12 @@ static int journal_reset(journal_t *journal)
first
=
be32_to_cpu
(
sb
->
s_first
);
first
=
be32_to_cpu
(
sb
->
s_first
);
last
=
be32_to_cpu
(
sb
->
s_maxlen
);
last
=
be32_to_cpu
(
sb
->
s_maxlen
);
if
(
first
+
JBD2_MIN_JOURNAL_BLOCKS
>
last
+
1
)
{
printk
(
KERN_ERR
"JBD: Journal too short (blocks %llu-%llu).
\n
"
,
first
,
last
);
journal_fail_superblock
(
journal
);
return
-
EINVAL
;
}
journal
->
j_first
=
first
;
journal
->
j_first
=
first
;
journal
->
j_last
=
last
;
journal
->
j_last
=
last
;
...
...
fs/jbd2/transaction.c
View file @
e93117ef
...
@@ -57,7 +57,7 @@ jbd2_get_transaction(journal_t *journal, transaction_t *transaction)
...
@@ -57,7 +57,7 @@ jbd2_get_transaction(journal_t *journal, transaction_t *transaction)
INIT_LIST_HEAD
(
&
transaction
->
t_private_list
);
INIT_LIST_HEAD
(
&
transaction
->
t_private_list
);
/* Set up the commit timer for the new transaction. */
/* Set up the commit timer for the new transaction. */
journal
->
j_commit_timer
.
expires
=
round_jiffies
(
transaction
->
t_expires
);
journal
->
j_commit_timer
.
expires
=
round_jiffies
_up
(
transaction
->
t_expires
);
add_timer
(
&
journal
->
j_commit_timer
);
add_timer
(
&
journal
->
j_commit_timer
);
J_ASSERT
(
journal
->
j_running_transaction
==
NULL
);
J_ASSERT
(
journal
->
j_running_transaction
==
NULL
);
...
@@ -238,6 +238,8 @@ repeat_locked:
...
@@ -238,6 +238,8 @@ repeat_locked:
__jbd2_log_space_left
(
journal
));
__jbd2_log_space_left
(
journal
));
spin_unlock
(
&
transaction
->
t_handle_lock
);
spin_unlock
(
&
transaction
->
t_handle_lock
);
spin_unlock
(
&
journal
->
j_state_lock
);
spin_unlock
(
&
journal
->
j_state_lock
);
lock_map_acquire
(
&
handle
->
h_lockdep_map
);
out:
out:
if
(
unlikely
(
new_transaction
))
/* It's usually NULL */
if
(
unlikely
(
new_transaction
))
/* It's usually NULL */
kfree
(
new_transaction
);
kfree
(
new_transaction
);
...
@@ -303,8 +305,6 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
...
@@ -303,8 +305,6 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
handle
=
ERR_PTR
(
err
);
handle
=
ERR_PTR
(
err
);
goto
out
;
goto
out
;
}
}
lock_map_acquire
(
&
handle
->
h_lockdep_map
);
out:
out:
return
handle
;
return
handle
;
}
}
...
@@ -426,6 +426,7 @@ int jbd2_journal_restart(handle_t *handle, int nblocks)
...
@@ -426,6 +426,7 @@ int jbd2_journal_restart(handle_t *handle, int nblocks)
__jbd2_log_start_commit
(
journal
,
transaction
->
t_tid
);
__jbd2_log_start_commit
(
journal
,
transaction
->
t_tid
);
spin_unlock
(
&
journal
->
j_state_lock
);
spin_unlock
(
&
journal
->
j_state_lock
);
lock_map_release
(
&
handle
->
h_lockdep_map
);
handle
->
h_buffer_credits
=
nblocks
;
handle
->
h_buffer_credits
=
nblocks
;
ret
=
start_this_handle
(
journal
,
handle
);
ret
=
start_this_handle
(
journal
,
handle
);
return
ret
;
return
ret
;
...
...
include/linux/jbd2.h
View file @
e93117ef
...
@@ -652,7 +652,7 @@ struct transaction_s
...
@@ -652,7 +652,7 @@ struct transaction_s
* This transaction is being forced and some process is
* This transaction is being forced and some process is
* waiting for it to finish.
* waiting for it to finish.
*/
*/
int
t_synchronous_commit
:
1
;
unsigned
int
t_synchronous_commit
:
1
;
/*
/*
* For use by the filesystem to store fs-specific data
* For use by the filesystem to store fs-specific data
...
...
include/trace/events/ext4.h
View file @
e93117ef
...
@@ -33,8 +33,8 @@ TRACE_EVENT(ext4_free_inode,
...
@@ -33,8 +33,8 @@ TRACE_EVENT(ext4_free_inode,
),
),
TP_printk
(
"dev %s ino %lu mode %d uid %u gid %u blocks %llu"
,
TP_printk
(
"dev %s ino %lu mode %d uid %u gid %u blocks %llu"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
mode
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
uid
,
__entry
->
gid
,
__entry
->
mode
,
__entry
->
uid
,
__entry
->
gid
,
(
unsigned
long
long
)
__entry
->
blocks
)
(
unsigned
long
long
)
__entry
->
blocks
)
);
);
...
@@ -56,7 +56,8 @@ TRACE_EVENT(ext4_request_inode,
...
@@ -56,7 +56,8 @@ TRACE_EVENT(ext4_request_inode,
),
),
TP_printk
(
"dev %s dir %lu mode %d"
,
TP_printk
(
"dev %s dir %lu mode %d"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
dir
,
__entry
->
mode
)
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
dir
,
__entry
->
mode
)
);
);
TRACE_EVENT
(
ext4_allocate_inode
,
TRACE_EVENT
(
ext4_allocate_inode
,
...
@@ -79,7 +80,8 @@ TRACE_EVENT(ext4_allocate_inode,
...
@@ -79,7 +80,8 @@ TRACE_EVENT(ext4_allocate_inode,
),
),
TP_printk
(
"dev %s ino %lu dir %lu mode %d"
,
TP_printk
(
"dev %s ino %lu dir %lu mode %d"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
dir
,
__entry
->
mode
)
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
(
unsigned
long
)
__entry
->
dir
,
__entry
->
mode
)
);
);
TRACE_EVENT
(
ext4_write_begin
,
TRACE_EVENT
(
ext4_write_begin
,
...
@@ -106,8 +108,8 @@ TRACE_EVENT(ext4_write_begin,
...
@@ -106,8 +108,8 @@ TRACE_EVENT(ext4_write_begin,
),
),
TP_printk
(
"dev %s ino %lu pos %llu len %u flags %u"
,
TP_printk
(
"dev %s ino %lu pos %llu len %u flags %u"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
pos
,
__entry
->
len
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
flags
)
__entry
->
pos
,
__entry
->
len
,
__entry
->
flags
)
);
);
TRACE_EVENT
(
ext4_ordered_write_end
,
TRACE_EVENT
(
ext4_ordered_write_end
,
...
@@ -133,8 +135,8 @@ TRACE_EVENT(ext4_ordered_write_end,
...
@@ -133,8 +135,8 @@ TRACE_EVENT(ext4_ordered_write_end,
),
),
TP_printk
(
"dev %s ino %lu pos %llu len %u copied %u"
,
TP_printk
(
"dev %s ino %lu pos %llu len %u copied %u"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
pos
,
__entry
->
len
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
copied
)
__entry
->
pos
,
__entry
->
len
,
__entry
->
copied
)
);
);
TRACE_EVENT
(
ext4_writeback_write_end
,
TRACE_EVENT
(
ext4_writeback_write_end
,
...
@@ -160,8 +162,8 @@ TRACE_EVENT(ext4_writeback_write_end,
...
@@ -160,8 +162,8 @@ TRACE_EVENT(ext4_writeback_write_end,
),
),
TP_printk
(
"dev %s ino %lu pos %llu len %u copied %u"
,
TP_printk
(
"dev %s ino %lu pos %llu len %u copied %u"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
pos
,
__entry
->
len
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
copied
)
__entry
->
pos
,
__entry
->
len
,
__entry
->
copied
)
);
);
TRACE_EVENT
(
ext4_journalled_write_end
,
TRACE_EVENT
(
ext4_journalled_write_end
,
...
@@ -186,8 +188,8 @@ TRACE_EVENT(ext4_journalled_write_end,
...
@@ -186,8 +188,8 @@ TRACE_EVENT(ext4_journalled_write_end,
),
),
TP_printk
(
"dev %s ino %lu pos %llu len %u copied %u"
,
TP_printk
(
"dev %s ino %lu pos %llu len %u copied %u"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
pos
,
__entry
->
len
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
copied
)
__entry
->
pos
,
__entry
->
len
,
__entry
->
copied
)
);
);
TRACE_EVENT
(
ext4_writepage
,
TRACE_EVENT
(
ext4_writepage
,
...
@@ -209,7 +211,8 @@ TRACE_EVENT(ext4_writepage,
...
@@ -209,7 +211,8 @@ TRACE_EVENT(ext4_writepage,
),
),
TP_printk
(
"dev %s ino %lu page_index %lu"
,
TP_printk
(
"dev %s ino %lu page_index %lu"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
index
)
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
index
)
);
);
TRACE_EVENT
(
ext4_da_writepages
,
TRACE_EVENT
(
ext4_da_writepages
,
...
@@ -245,14 +248,49 @@ TRACE_EVENT(ext4_da_writepages,
...
@@ -245,14 +248,49 @@ TRACE_EVENT(ext4_da_writepages,
__entry
->
range_cyclic
=
wbc
->
range_cyclic
;
__entry
->
range_cyclic
=
wbc
->
range_cyclic
;
),
),
TP_printk
(
"dev %s ino %lu nr_t_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d for_writepages %d range_cyclic %d"
,
TP_printk
(
"dev %s ino %lu nr_to_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d for_writepages %d range_cyclic %d"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
nr_to_write
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
nr_to_write
,
__entry
->
pages_skipped
,
__entry
->
range_start
,
__entry
->
pages_skipped
,
__entry
->
range_start
,
__entry
->
range_end
,
__entry
->
nonblocking
,
__entry
->
range_end
,
__entry
->
nonblocking
,
__entry
->
for_kupdate
,
__entry
->
for_reclaim
,
__entry
->
for_kupdate
,
__entry
->
for_reclaim
,
__entry
->
for_writepages
,
__entry
->
range_cyclic
)
__entry
->
for_writepages
,
__entry
->
range_cyclic
)
);
);
TRACE_EVENT
(
ext4_da_write_pages
,
TP_PROTO
(
struct
inode
*
inode
,
struct
mpage_da_data
*
mpd
),
TP_ARGS
(
inode
,
mpd
),
TP_STRUCT__entry
(
__field
(
dev_t
,
dev
)
__field
(
ino_t
,
ino
)
__field
(
__u64
,
b_blocknr
)
__field
(
__u32
,
b_size
)
__field
(
__u32
,
b_state
)
__field
(
unsigned
long
,
first_page
)
__field
(
int
,
io_done
)
__field
(
int
,
pages_written
)
),
TP_fast_assign
(
__entry
->
dev
=
inode
->
i_sb
->
s_dev
;
__entry
->
ino
=
inode
->
i_ino
;
__entry
->
b_blocknr
=
mpd
->
b_blocknr
;
__entry
->
b_size
=
mpd
->
b_size
;
__entry
->
b_state
=
mpd
->
b_state
;
__entry
->
first_page
=
mpd
->
first_page
;
__entry
->
io_done
=
mpd
->
io_done
;
__entry
->
pages_written
=
mpd
->
pages_written
;
),
TP_printk
(
"dev %s ino %lu b_blocknr %llu b_size %u b_state 0x%04x first_page %lu io_done %d pages_written %d"
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
b_blocknr
,
__entry
->
b_size
,
__entry
->
b_state
,
__entry
->
first_page
,
__entry
->
io_done
,
__entry
->
pages_written
)
);
TRACE_EVENT
(
ext4_da_writepages_result
,
TRACE_EVENT
(
ext4_da_writepages_result
,
TP_PROTO
(
struct
inode
*
inode
,
struct
writeback_control
*
wbc
,
TP_PROTO
(
struct
inode
*
inode
,
struct
writeback_control
*
wbc
,
int
ret
,
int
pages_written
),
int
ret
,
int
pages_written
),
...
@@ -282,7 +320,8 @@ TRACE_EVENT(ext4_da_writepages_result,
...
@@ -282,7 +320,8 @@ TRACE_EVENT(ext4_da_writepages_result,
),
),
TP_printk
(
"dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d"
,
TP_printk
(
"dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
ret
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
ret
,
__entry
->
pages_written
,
__entry
->
pages_skipped
,
__entry
->
pages_written
,
__entry
->
pages_skipped
,
__entry
->
encountered_congestion
,
__entry
->
more_io
,
__entry
->
encountered_congestion
,
__entry
->
more_io
,
__entry
->
no_nrwrite_index_update
)
__entry
->
no_nrwrite_index_update
)
...
@@ -311,8 +350,8 @@ TRACE_EVENT(ext4_da_write_begin,
...
@@ -311,8 +350,8 @@ TRACE_EVENT(ext4_da_write_begin,
),
),
TP_printk
(
"dev %s ino %lu pos %llu len %u flags %u"
,
TP_printk
(
"dev %s ino %lu pos %llu len %u flags %u"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
pos
,
__entry
->
len
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
flags
)
__entry
->
pos
,
__entry
->
len
,
__entry
->
flags
)
);
);
TRACE_EVENT
(
ext4_da_write_end
,
TRACE_EVENT
(
ext4_da_write_end
,
...
@@ -338,8 +377,8 @@ TRACE_EVENT(ext4_da_write_end,
...
@@ -338,8 +377,8 @@ TRACE_EVENT(ext4_da_write_end,
),
),
TP_printk
(
"dev %s ino %lu pos %llu len %u copied %u"
,
TP_printk
(
"dev %s ino %lu pos %llu len %u copied %u"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
pos
,
__entry
->
len
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
copied
)
__entry
->
pos
,
__entry
->
len
,
__entry
->
copied
)
);
);
TRACE_EVENT
(
ext4_discard_blocks
,
TRACE_EVENT
(
ext4_discard_blocks
,
...
@@ -389,8 +428,8 @@ TRACE_EVENT(ext4_mb_new_inode_pa,
...
@@ -389,8 +428,8 @@ TRACE_EVENT(ext4_mb_new_inode_pa,
),
),
TP_printk
(
"dev %s ino %lu pstart %llu len %u lstart %llu"
,
TP_printk
(
"dev %s ino %lu pstart %llu len %u lstart %llu"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
pa_pstart
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
pa_len
,
__entry
->
pa_lstart
)
__entry
->
pa_
pstart
,
__entry
->
pa_
len
,
__entry
->
pa_lstart
)
);
);
TRACE_EVENT
(
ext4_mb_new_group_pa
,
TRACE_EVENT
(
ext4_mb_new_group_pa
,
...
@@ -417,8 +456,8 @@ TRACE_EVENT(ext4_mb_new_group_pa,
...
@@ -417,8 +456,8 @@ TRACE_EVENT(ext4_mb_new_group_pa,
),
),
TP_printk
(
"dev %s ino %lu pstart %llu len %u lstart %llu"
,
TP_printk
(
"dev %s ino %lu pstart %llu len %u lstart %llu"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
pa_pstart
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
pa_len
,
__entry
->
pa_lstart
)
__entry
->
pa_
pstart
,
__entry
->
pa_
len
,
__entry
->
pa_lstart
)
);
);
TRACE_EVENT
(
ext4_mb_release_inode_pa
,
TRACE_EVENT
(
ext4_mb_release_inode_pa
,
...
@@ -444,8 +483,8 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
...
@@ -444,8 +483,8 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
),
),
TP_printk
(
"dev %s ino %lu block %llu count %u"
,
TP_printk
(
"dev %s ino %lu block %llu count %u"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
block
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
count
)
__entry
->
block
,
__entry
->
count
)
);
);
TRACE_EVENT
(
ext4_mb_release_group_pa
,
TRACE_EVENT
(
ext4_mb_release_group_pa
,
...
@@ -490,7 +529,7 @@ TRACE_EVENT(ext4_discard_preallocations,
...
@@ -490,7 +529,7 @@ TRACE_EVENT(ext4_discard_preallocations,
),
),
TP_printk
(
"dev %s ino %lu"
,
TP_printk
(
"dev %s ino %lu"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
)
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
)
);
);
TRACE_EVENT
(
ext4_mb_discard_preallocations
,
TRACE_EVENT
(
ext4_mb_discard_preallocations
,
...
@@ -545,8 +584,8 @@ TRACE_EVENT(ext4_request_blocks,
...
@@ -545,8 +584,8 @@ TRACE_EVENT(ext4_request_blocks,
),
),
TP_printk
(
"dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu "
,
TP_printk
(
"dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu "
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
flags
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
len
,
__entry
->
flags
,
__entry
->
len
,
(
unsigned
long
long
)
__entry
->
logical
,
(
unsigned
long
long
)
__entry
->
logical
,
(
unsigned
long
long
)
__entry
->
goal
,
(
unsigned
long
long
)
__entry
->
goal
,
(
unsigned
long
long
)
__entry
->
lleft
,
(
unsigned
long
long
)
__entry
->
lleft
,
...
@@ -589,8 +628,8 @@ TRACE_EVENT(ext4_allocate_blocks,
...
@@ -589,8 +628,8 @@ TRACE_EVENT(ext4_allocate_blocks,
),
),
TP_printk
(
"dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu "
,
TP_printk
(
"dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu "
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
flags
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
len
,
__entry
->
block
,
__entry
->
flags
,
__entry
->
len
,
__entry
->
block
,
(
unsigned
long
long
)
__entry
->
logical
,
(
unsigned
long
long
)
__entry
->
logical
,
(
unsigned
long
long
)
__entry
->
goal
,
(
unsigned
long
long
)
__entry
->
goal
,
(
unsigned
long
long
)
__entry
->
lleft
,
(
unsigned
long
long
)
__entry
->
lleft
,
...
@@ -623,8 +662,8 @@ TRACE_EVENT(ext4_free_blocks,
...
@@ -623,8 +662,8 @@ TRACE_EVENT(ext4_free_blocks,
),
),
TP_printk
(
"dev %s ino %lu block %llu count %lu metadata %d"
,
TP_printk
(
"dev %s ino %lu block %llu count %lu metadata %d"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
block
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
count
,
__entry
->
metadata
)
__entry
->
block
,
__entry
->
count
,
__entry
->
metadata
)
);
);
TRACE_EVENT
(
ext4_sync_file
,
TRACE_EVENT
(
ext4_sync_file
,
...
@@ -647,8 +686,8 @@ TRACE_EVENT(ext4_sync_file,
...
@@ -647,8 +686,8 @@ TRACE_EVENT(ext4_sync_file,
),
),
TP_printk
(
"dev %s ino %ld parent %ld datasync %d "
,
TP_printk
(
"dev %s ino %ld parent %ld datasync %d "
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
,
__entry
->
parent
,
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
,
__entry
->
datasync
)
(
unsigned
long
)
__entry
->
parent
,
__entry
->
datasync
)
);
);
TRACE_EVENT
(
ext4_sync_fs
,
TRACE_EVENT
(
ext4_sync_fs
,
...
...
include/trace/events/jbd2.h
View file @
e93117ef
...
@@ -159,7 +159,7 @@ TRACE_EVENT(jbd2_submit_inode_data,
...
@@ -159,7 +159,7 @@ TRACE_EVENT(jbd2_submit_inode_data,
),
),
TP_printk
(
"dev %s ino %lu"
,
TP_printk
(
"dev %s ino %lu"
,
jbd2_dev_to_name
(
__entry
->
dev
),
__entry
->
ino
)
jbd2_dev_to_name
(
__entry
->
dev
),
(
unsigned
long
)
__entry
->
ino
)
);
);
#endif
/* _TRACE_JBD2_H */
#endif
/* _TRACE_JBD2_H */
...
...
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