aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode_fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode_fork.c')
-rw-r--r--fs/xfs/xfs_inode_fork.c40
1 files changed, 12 insertions, 28 deletions
diff --git a/fs/xfs/xfs_inode_fork.c b/fs/xfs/xfs_inode_fork.c
index 02f1083955bb..cfee14a83cfe 100644
--- a/fs/xfs/xfs_inode_fork.c
+++ b/fs/xfs/xfs_inode_fork.c
@@ -20,31 +20,21 @@
20#include "xfs.h" 20#include "xfs.h"
21#include "xfs_fs.h" 21#include "xfs_fs.h"
22#include "xfs_format.h" 22#include "xfs_format.h"
23#include "xfs_log.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h"
24#include "xfs_inum.h" 25#include "xfs_inum.h"
25#include "xfs_trans.h"
26#include "xfs_trans_priv.h"
27#include "xfs_sb.h" 26#include "xfs_sb.h"
28#include "xfs_ag.h" 27#include "xfs_ag.h"
29#include "xfs_mount.h" 28#include "xfs_mount.h"
30#include "xfs_bmap_btree.h"
31#include "xfs_alloc_btree.h"
32#include "xfs_ialloc_btree.h"
33#include "xfs_attr_sf.h"
34#include "xfs_dinode.h"
35#include "xfs_inode.h" 29#include "xfs_inode.h"
36#include "xfs_buf_item.h" 30#include "xfs_trans.h"
37#include "xfs_inode_item.h" 31#include "xfs_inode_item.h"
38#include "xfs_btree.h" 32#include "xfs_bmap_btree.h"
39#include "xfs_alloc.h"
40#include "xfs_ialloc.h"
41#include "xfs_bmap.h" 33#include "xfs_bmap.h"
42#include "xfs_error.h" 34#include "xfs_error.h"
43#include "xfs_quota.h"
44#include "xfs_filestream.h"
45#include "xfs_cksum.h"
46#include "xfs_trace.h" 35#include "xfs_trace.h"
47#include "xfs_icache.h" 36#include "xfs_attr_sf.h"
37#include "xfs_dinode.h"
48 38
49kmem_zone_t *xfs_ifork_zone; 39kmem_zone_t *xfs_ifork_zone;
50 40
@@ -1031,15 +1021,14 @@ xfs_iext_add(
1031 * the next index needed in the indirection array. 1021 * the next index needed in the indirection array.
1032 */ 1022 */
1033 else { 1023 else {
1034 int count = ext_diff; 1024 uint count = ext_diff;
1035 1025
1036 while (count) { 1026 while (count) {
1037 erp = xfs_iext_irec_new(ifp, erp_idx); 1027 erp = xfs_iext_irec_new(ifp, erp_idx);
1038 erp->er_extcount = count; 1028 erp->er_extcount = min(count, XFS_LINEAR_EXTS);
1039 count -= MIN(count, (int)XFS_LINEAR_EXTS); 1029 count -= erp->er_extcount;
1040 if (count) { 1030 if (count)
1041 erp_idx++; 1031 erp_idx++;
1042 }
1043 } 1032 }
1044 } 1033 }
1045 } 1034 }
@@ -1359,7 +1348,7 @@ xfs_iext_remove_indirect(
1359void 1348void
1360xfs_iext_realloc_direct( 1349xfs_iext_realloc_direct(
1361 xfs_ifork_t *ifp, /* inode fork pointer */ 1350 xfs_ifork_t *ifp, /* inode fork pointer */
1362 int new_size) /* new size of extents */ 1351 int new_size) /* new size of extents after adding */
1363{ 1352{
1364 int rnew_size; /* real new size of extents */ 1353 int rnew_size; /* real new size of extents */
1365 1354
@@ -1397,13 +1386,8 @@ xfs_iext_realloc_direct(
1397 rnew_size - ifp->if_real_bytes); 1386 rnew_size - ifp->if_real_bytes);
1398 } 1387 }
1399 } 1388 }
1400 /* 1389 /* Switch from the inline extent buffer to a direct extent list */
1401 * Switch from the inline extent buffer to a direct
1402 * extent list. Be sure to include the inline extent
1403 * bytes in new_size.
1404 */
1405 else { 1390 else {
1406 new_size += ifp->if_bytes;
1407 if (!is_power_of_2(new_size)) { 1391 if (!is_power_of_2(new_size)) {
1408 rnew_size = roundup_pow_of_two(new_size); 1392 rnew_size = roundup_pow_of_two(new_size);
1409 } 1393 }