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
d622f167
Commit
d622f167
authored
Jun 16, 2015
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ufs: switch ufs_evict_inode() to trimmed-down variant of ufs_truncate()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
f3e0f3da
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
27 deletions
+44
-27
fs/ufs/inode.c
fs/ufs/inode.c
+2
-7
fs/ufs/truncate.c
fs/ufs/truncate.c
+41
-19
fs/ufs/ufs.h
fs/ufs/ufs.h
+1
-1
No files found.
fs/ufs/inode.c
View file @
d622f167
...
...
@@ -884,14 +884,9 @@ void ufs_evict_inode(struct inode * inode)
truncate_inode_pages_final
(
&
inode
->
i_data
);
if
(
want_delete
)
{
loff_t
old_i_size
;
/*UFS_I(inode)->i_dtime = CURRENT_TIME;*/
mark_inode_dirty
(
inode
);
ufs_update_inode
(
inode
,
IS_SYNC
(
inode
));
old_i_size
=
inode
->
i_size
;
inode
->
i_size
=
0
;
if
(
inode
->
i_blocks
&&
ufs_truncate
(
inode
,
old_i_size
)
)
ufs_
warning
(
inode
->
i_sb
,
__func__
,
"ufs_truncate failed
\n
"
);
if
(
inode
->
i_blocks
)
ufs_
truncate_blocks
(
inode
);
}
invalidate_inode_buffers
(
inode
);
...
...
fs/ufs/truncate.c
View file @
d622f167
...
...
@@ -440,12 +440,36 @@ static int ufs_alloc_lastblock(struct inode *inode)
return
err
;
}
int
ufs_truncate
(
struct
inode
*
inode
,
loff_t
old_i_siz
e
)
static
void
__ufs_truncate_blocks
(
struct
inode
*
inod
e
)
{
struct
ufs_inode_info
*
ufsi
=
UFS_I
(
inode
);
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
ufs_sb_private_info
*
uspi
=
UFS_SB
(
sb
)
->
s_uspi
;
int
retry
,
err
=
0
;
int
retry
;
while
(
1
)
{
retry
=
ufs_trunc_direct
(
inode
);
retry
|=
ufs_trunc_indirect
(
inode
,
UFS_IND_BLOCK
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_IND_BLOCK
));
retry
|=
ufs_trunc_dindirect
(
inode
,
UFS_IND_BLOCK
+
uspi
->
s_apb
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_DIND_BLOCK
));
retry
|=
ufs_trunc_tindirect
(
inode
);
if
(
!
retry
)
break
;
if
(
IS_SYNC
(
inode
)
&&
(
inode
->
i_state
&
I_DIRTY
))
ufs_sync_inode
(
inode
);
yield
();
}
ufsi
->
i_lastfrag
=
DIRECT_FRAGMENT
;
}
int
ufs_truncate
(
struct
inode
*
inode
,
loff_t
old_i_size
)
{
struct
super_block
*
sb
=
inode
->
i_sb
;
int
err
=
0
;
UFSD
(
"ENTER: ino %lu, i_size: %llu, old_i_size: %llu
\n
"
,
inode
->
i_ino
,
(
unsigned
long
long
)
i_size_read
(
inode
),
...
...
@@ -467,24 +491,8 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
block_truncate_page
(
inode
->
i_mapping
,
inode
->
i_size
,
ufs_getfrag_block
);
while
(
1
)
{
retry
=
ufs_trunc_direct
(
inode
);
retry
|=
ufs_trunc_indirect
(
inode
,
UFS_IND_BLOCK
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_IND_BLOCK
));
retry
|=
ufs_trunc_dindirect
(
inode
,
UFS_IND_BLOCK
+
uspi
->
s_apb
,
ufs_get_direct_data_ptr
(
uspi
,
ufsi
,
UFS_DIND_BLOCK
));
retry
|=
ufs_trunc_tindirect
(
inode
);
if
(
!
retry
)
break
;
if
(
IS_SYNC
(
inode
)
&&
(
inode
->
i_state
&
I_DIRTY
))
ufs_sync_inode
(
inode
);
yield
();
}
__ufs_truncate_blocks
(
inode
);
inode
->
i_mtime
=
inode
->
i_ctime
=
CURRENT_TIME_SEC
;
ufsi
->
i_lastfrag
=
DIRECT_FRAGMENT
;
mark_inode_dirty
(
inode
);
out:
unlock_ufs
(
sb
);
...
...
@@ -492,6 +500,20 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
return
err
;
}
void
ufs_truncate_blocks
(
struct
inode
*
inode
)
{
struct
super_block
*
sb
=
inode
->
i_sb
;
if
(
!
(
S_ISREG
(
inode
->
i_mode
)
||
S_ISDIR
(
inode
->
i_mode
)
||
S_ISLNK
(
inode
->
i_mode
)))
return
;
if
(
IS_APPEND
(
inode
)
||
IS_IMMUTABLE
(
inode
))
return
;
lock_ufs
(
sb
);
__ufs_truncate_blocks
(
inode
);
unlock_ufs
(
sb
);
}
int
ufs_setattr
(
struct
dentry
*
dentry
,
struct
iattr
*
attr
)
{
struct
inode
*
inode
=
d_inode
(
dentry
);
...
...
fs/ufs/ufs.h
View file @
d622f167
...
...
@@ -141,7 +141,7 @@ extern const struct inode_operations ufs_fast_symlink_inode_operations;
extern
const
struct
inode_operations
ufs_symlink_inode_operations
;
/* truncate.c */
extern
int
ufs_truncate
(
struct
inode
*
,
loff_t
);
extern
void
ufs_truncate_blocks
(
struct
inode
*
);
extern
int
ufs_setattr
(
struct
dentry
*
dentry
,
struct
iattr
*
attr
);
static
inline
struct
ufs_sb_info
*
UFS_SB
(
struct
super_block
*
sb
)
...
...
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