@@ -967,12 +967,15 @@ static int do_writepage(struct page *page, int len)
967
967
* the page locked, and it locks @ui_mutex. However, write-back does take inode
968
968
* @i_mutex, which means other VFS operations may be run on this inode at the
969
969
* same time. And the problematic one is truncation to smaller size, from where
970
- * we have to call 'vmtruncate ()', which first changes @inode->i_size, then
970
+ * we have to call 'simple_setsize ()', which first changes @inode->i_size, then
971
971
* drops the truncated pages. And while dropping the pages, it takes the page
972
- * lock. This means that 'do_truncation()' cannot call 'vmtruncate ()' with
972
+ * lock. This means that 'do_truncation()' cannot call 'simple_setsize ()' with
973
973
* @ui_mutex locked, because it would deadlock with 'ubifs_writepage()'. This
974
974
* means that @inode->i_size is changed while @ui_mutex is unlocked.
975
975
*
976
+ * XXX: with the new truncate the above is not true anymore, the simple_setsize
977
+ * calls can be replaced with the individual components.
978
+ *
976
979
* But in 'ubifs_writepage()' we have to guarantee that we do not write beyond
977
980
* inode size. How do we do this if @inode->i_size may became smaller while we
978
981
* are in the middle of 'ubifs_writepage()'? The UBIFS solution is the
@@ -1125,7 +1128,7 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode,
1125
1128
budgeted = 0 ;
1126
1129
}
1127
1130
1128
- err = vmtruncate (inode , new_size );
1131
+ err = simple_setsize (inode , new_size );
1129
1132
if (err )
1130
1133
goto out_budg ;
1131
1134
@@ -1214,7 +1217,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
1214
1217
1215
1218
if (attr -> ia_valid & ATTR_SIZE ) {
1216
1219
dbg_gen ("size %lld -> %lld" , inode -> i_size , new_size );
1217
- err = vmtruncate (inode , new_size );
1220
+ err = simple_setsize (inode , new_size );
1218
1221
if (err )
1219
1222
goto out ;
1220
1223
}
@@ -1223,7 +1226,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
1223
1226
if (attr -> ia_valid & ATTR_SIZE ) {
1224
1227
/* Truncation changes inode [mc]time */
1225
1228
inode -> i_mtime = inode -> i_ctime = ubifs_current_time (inode );
1226
- /* 'vmtruncate ()' changed @i_size, update @ui_size */
1229
+ /* 'simple_setsize ()' changed @i_size, update @ui_size */
1227
1230
ui -> ui_size = inode -> i_size ;
1228
1231
}
1229
1232
0 commit comments