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
f6d31f4b
Commit
f6d31f4b
authored
Sep 23, 2014
by
Dave Chinner
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xfs-shift-extents-rework' into for-next
parents
a4241aeb
8b5279e3
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
289 additions
and
153 deletions
+289
-153
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_bmap.c
+241
-124
fs/xfs/libxfs/xfs_bmap.h
fs/xfs/libxfs/xfs_bmap.h
+3
-4
fs/xfs/xfs_aops.c
fs/xfs/xfs_aops.c
+14
-2
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_bmap_util.c
+31
-23
No files found.
fs/xfs/libxfs/xfs_bmap.c
View file @
f6d31f4b
This diff is collapsed.
Click to expand it.
fs/xfs/libxfs/xfs_bmap.h
View file @
f6d31f4b
...
...
@@ -178,9 +178,8 @@ int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx,
xfs_extnum_t
num
);
uint
xfs_default_attroffset
(
struct
xfs_inode
*
ip
);
int
xfs_bmap_shift_extents
(
struct
xfs_trans
*
tp
,
struct
xfs_inode
*
ip
,
int
*
done
,
xfs_fileoff_t
start_fsb
,
xfs_fileoff_t
offset_shift_fsb
,
xfs_extnum_t
*
current_ext
,
xfs_fsblock_t
*
firstblock
,
struct
xfs_bmap_free
*
flist
,
int
num_exts
);
xfs_fileoff_t
start_fsb
,
xfs_fileoff_t
offset_shift_fsb
,
int
*
done
,
xfs_fileoff_t
*
next_fsb
,
xfs_fsblock_t
*
firstblock
,
struct
xfs_bmap_free
*
flist
,
int
num_exts
);
#endif
/* __XFS_BMAP_H__ */
fs/xfs/xfs_aops.c
View file @
f6d31f4b
...
...
@@ -434,10 +434,22 @@ xfs_start_page_writeback(
{
ASSERT
(
PageLocked
(
page
));
ASSERT
(
!
PageWriteback
(
page
));
if
(
clear_dirty
)
/*
* if the page was not fully cleaned, we need to ensure that the higher
* layers come back to it correctly. That means we need to keep the page
* dirty, and for WB_SYNC_ALL writeback we need to ensure the
* PAGECACHE_TAG_TOWRITE index mark is not removed so another attempt to
* write this page in this writeback sweep will be made.
*/
if
(
clear_dirty
)
{
clear_page_dirty_for_io
(
page
);
set_page_writeback
(
page
);
}
else
set_page_writeback_keepwrite
(
page
);
unlock_page
(
page
);
/* If no buffers on the page are to be written, finish it here */
if
(
!
buffers
)
end_page_writeback
(
page
);
...
...
fs/xfs/xfs_bmap_util.c
View file @
f6d31f4b
...
...
@@ -1205,6 +1205,7 @@ xfs_free_file_space(
xfs_bmap_free_t
free_list
;
xfs_bmbt_irec_t
imap
;
xfs_off_t
ioffset
;
xfs_off_t
iendoffset
;
xfs_extlen_t
mod
=
0
;
xfs_mount_t
*
mp
;
int
nimap
;
...
...
@@ -1233,12 +1234,13 @@ xfs_free_file_space(
inode_dio_wait
(
VFS_I
(
ip
));
rounding
=
max_t
(
xfs_off_t
,
1
<<
mp
->
m_sb
.
sb_blocklog
,
PAGE_CACHE_SIZE
);
ioffset
=
offset
&
~
(
rounding
-
1
);
error
=
filemap_write_and_wait_range
(
VFS_I
(
ip
)
->
i_mapping
,
ioffset
,
-
1
);
ioffset
=
round_down
(
offset
,
rounding
);
iendoffset
=
round_up
(
offset
+
len
,
rounding
)
-
1
;
error
=
filemap_write_and_wait_range
(
VFS_I
(
ip
)
->
i_mapping
,
ioffset
,
iendoffset
);
if
(
error
)
goto
out
;
truncate_pagecache_range
(
VFS_I
(
ip
),
ioffset
,
-
1
);
truncate_pagecache_range
(
VFS_I
(
ip
),
ioffset
,
iendoffset
);
/*
* Need to zero the stuff we're not freeing, on disk.
...
...
@@ -1456,41 +1458,47 @@ xfs_collapse_file_space(
struct
xfs_mount
*
mp
=
ip
->
i_mount
;
struct
xfs_trans
*
tp
;
int
error
;
xfs_extnum_t
current_ext
=
0
;
struct
xfs_bmap_free
free_list
;
xfs_fsblock_t
first_block
;
int
committed
;
xfs_fileoff_t
start_fsb
;
xfs_fileoff_t
next_fsb
;
xfs_fileoff_t
shift_fsb
;
ASSERT
(
xfs_isilocked
(
ip
,
XFS_IOLOCK_EXCL
));
trace_xfs_collapse_file_space
(
ip
);
star
t_fsb
=
XFS_B_TO_FSB
(
mp
,
offset
+
len
);
nex
t_fsb
=
XFS_B_TO_FSB
(
mp
,
offset
+
len
);
shift_fsb
=
XFS_B_TO_FSB
(
mp
,
len
);
/*
* Writeback the entire file and force remove any post-eof blocks. The
* writeback prevents changes to the extent list via concurrent
* writeback and the eofblocks trim prevents the extent shift algorithm
* from running into a post-eof delalloc extent.
*
* XXX: This is a temporary fix until the extent shift loop below is
* converted to use offsets and lookups within the ILOCK rather than
* carrying around the index into the extent list for the next
* iteration.
*/
error
=
filemap_write_and_wait
(
VFS_I
(
ip
)
->
i_mapping
);
error
=
xfs_free_file_space
(
ip
,
offset
,
len
);
if
(
error
)
return
error
;
/*
* Trim eofblocks to avoid shifting uninitialized post-eof preallocation
* into the accessible region of the file.
*/
if
(
xfs_can_free_eofblocks
(
ip
,
true
))
{
error
=
xfs_free_eofblocks
(
mp
,
ip
,
false
);
if
(
error
)
return
error
;
}
error
=
xfs_free_file_space
(
ip
,
offset
,
len
);
/*
* Writeback and invalidate cache for the remainder of the file as we're
* about to shift down every extent from the collapse range to EOF. The
* free of the collapse range above might have already done some of
* this, but we shouldn't rely on it to do anything outside of the range
* that was freed.
*/
error
=
filemap_write_and_wait_range
(
VFS_I
(
ip
)
->
i_mapping
,
offset
+
len
,
-
1
);
if
(
error
)
return
error
;
error
=
invalidate_inode_pages2_range
(
VFS_I
(
ip
)
->
i_mapping
,
(
offset
+
len
)
>>
PAGE_CACHE_SHIFT
,
-
1
);
if
(
error
)
return
error
;
...
...
@@ -1525,9 +1533,9 @@ xfs_collapse_file_space(
* We are using the write transaction in which max 2 bmbt
* updates are allowed
*/
error
=
xfs_bmap_shift_extents
(
tp
,
ip
,
&
done
,
start_fsb
,
shift_fsb
,
&
current_ext
,
&
first_block
,
&
free_list
,
start_fsb
=
next_fsb
;
error
=
xfs_bmap_shift_extents
(
tp
,
ip
,
start_fsb
,
shift_fsb
,
&
done
,
&
next_fsb
,
&
first_block
,
&
free_list
,
XFS_BMAP_MAX_SHIFT_EXTENTS
);
if
(
error
)
goto
out
;
...
...
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