tree:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
btree-private-unions
head: 30d91fbcef11ed07350f943fd3f695e0fb0635dd
commit: 35137236b91e958ca683fd4a045a29c0b5310938 [52/72] xfs: don't crash with
assfail
config: s390-randconfig-a001-20200312 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.2.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 35137236b91e958ca683fd4a045a29c0b5310938
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=s390
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
fs///xfs/libxfs/xfs_bmap.c: In function 'xfs_bmap_del_extent_real':
> fs///xfs/libxfs/xfs_bmap.c:5091:17: warning: variable
'bno' set but not used [-Wunused-but-set-variable]
5091 |
xfs_fsblock_t bno;
| ^~~
> fs///xfs/libxfs/xfs_bmap.c:5279:58: error: suggest braces around
empty body in an 'if' statement [-Werror=empty-body]
5279 |
xfs_trans_mod_dquot_byino(tp, ip, qfield, (long)-nblks);
| ^
cc1: all warnings being treated as errors
--
fs///xfs/xfs_ioctl.c: In function 'xfs_ioctl_setattr':
> fs///xfs/xfs_ioctl.c:1519:20: warning: variable
'olddquot' set but not used [-Wunused-but-set-variable]
1519 | struct
xfs_dquot *olddquot = NULL;
| ^~~~~~~~
--
fs///xfs/xfs_iops.c: In function 'xfs_setattr_nonsize':
> fs///xfs/xfs_iops.c:664:39: warning: variable 'olddquot2'
set but not used [-Wunused-but-set-variable]
664 | struct xfs_dquot *olddquot1
= NULL, *olddquot2 = NULL;
| ^~~~~~~~~
> fs///xfs/xfs_iops.c:664:20: warning: variable 'olddquot1'
set but not used [-Wunused-but-set-variable]
664 | struct xfs_dquot *olddquot1
= NULL, *olddquot2 = NULL;
| ^~~~~~~~~
--
fs///xfs/xfs_super.c: In function 'xfs_fs_statfs':
> fs///xfs/xfs_super.c:781:28: error: suggest braces around empty
body in an 'if' statement [-Werror=empty-body]
781 |
xfs_qm_statvfs(ip, statp);
| ^
cc1: all warnings being treated as errors
vim +/if +5279 fs///xfs/libxfs/xfs_bmap.c
fa5c836ca8eb5ba fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2016-10-20 5027
3bacbcd8830f89f fs/xfs/xfs_bmap.c Vlad Apostolov 2007-08-16 5028 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5029 * Called by
xfs_bmapi to update file extent records and the btree
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5030 * after
removing space.
3bacbcd8830f89f fs/xfs/xfs_bmap.c Vlad Apostolov 2007-08-16 5031 */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5032 STATIC
int /* error */
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5033
xfs_bmap_del_extent_real(
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5034
xfs_inode_t *ip, /* incore inode pointer */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5035
xfs_trans_t *tp, /* current transaction pointer */
b2b1712a640824e fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5036 struct
xfs_iext_cursor *icur,
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5037
xfs_btree_cur_t *cur, /* if null, not a btree */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5038
xfs_bmbt_irec_t *del, /* data to remove from extents */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5039
int *logflagsp, /* inode logging flags */
4847acf868bb426 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-10-03 5040
int whichfork, /* data or attr fork */
4847acf868bb426 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-10-03 5041
int bflags) /* bmapi flags */
3bacbcd8830f89f fs/xfs/xfs_bmap.c Vlad Apostolov 2007-08-16 5042 {
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5043
xfs_fsblock_t del_endblock=0; /* first block past del */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5044
xfs_fileoff_t del_endoff; /* first offset past del */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5045
int do_fx; /* free extent at end of routine */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5046
int error; /* error return value */
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5047 int flags
= 0;/* inode logging flags */
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5048 struct
xfs_bmbt_irec got; /* current extent entry */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5049
xfs_fileoff_t got_endoff; /* first offset past got */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5050 int i; /*
temp state */
3ba738df25239f8 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2018-07-17 5051 struct
xfs_ifork *ifp; /* inode fork pointer */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5052
xfs_mount_t *mp; /* mount structure */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5053
xfs_filblks_t nblks; /* quota/sb block count */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5054
xfs_bmbt_irec_t new; /* new record to be inserted */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5055 /*
REFERENCED */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5056
uint qfield; /* quota field to update */
060ea65b39409f3 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-19 5057 int state
= xfs_bmap_fork_to_state(whichfork);
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5058 struct
xfs_bmbt_irec old;
3bacbcd8830f89f fs/xfs/xfs_bmap.c Vlad Apostolov 2007-08-16 5059
ff6d6af2351caea fs/xfs/libxfs/xfs_bmap.c Bill O'Donnell 2015-10-12 5060 mp =
ip->i_mount;
ff6d6af2351caea fs/xfs/libxfs/xfs_bmap.c Bill O'Donnell 2015-10-12 5061
XFS_STATS_INC(mp, xs_del_exlist);
3bacbcd8830f89f fs/xfs/xfs_bmap.c Vlad Apostolov 2007-08-16 5062
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5063 ifp =
XFS_IFORK_PTR(ip, whichfork);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5064
ASSERT(del->br_blockcount > 0);
b2b1712a640824e fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5065
xfs_iext_get_extent(ifp, icur, &got);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5066
ASSERT(got.br_startoff <= del->br_startoff);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5067 del_endoff =
del->br_startoff + del->br_blockcount;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5068 got_endoff =
got.br_startoff + got.br_blockcount;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5069
ASSERT(got_endoff >= del_endoff);
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5070
ASSERT(!isnullstartblock(got.br_startblock));
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5071 qfield = 0;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5072 error = 0;
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5073
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5074 /*
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5075 * If
it's the case where the directory code is running with no block
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5076 *
reservation, and the deleted block is in the middle of its extent,
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5077 * and the
resulting insert of an extent would cause transformation to
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5078 * btree
format, then reject it. The calling code will then swap blocks
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5079 * around
instead. We have to do this now, rather than waiting for the
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5080 *
conversion to btree format, since the transaction will be dirty then.
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5081 */
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5082 if
(tp->t_blk_res == 0 &&
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5083
XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS &&
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5084
XFS_IFORK_NEXTENTS(ip, whichfork) >=
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5085
XFS_IFORK_MAXEXT(ip, whichfork) &&
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5086
del->br_startoff > got.br_startoff && del_endoff < got_endoff)
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5087 return
-ENOSPC;
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5088
1b24b633aafe472 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5089 flags =
XFS_ILOG_CORE;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5090 if
(whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) {
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 @5091
xfs_fsblock_t bno;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5092
xfs_filblks_t len;
0703a8e1c17e2cb fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2018-06-08 5093
xfs_extlen_t mod;
0703a8e1c17e2cb fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2018-06-08 5094
0703a8e1c17e2cb fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2018-06-08 5095 bno =
div_u64_rem(del->br_startblock, mp->m_sb.sb_rextsize,
0703a8e1c17e2cb fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2018-06-08 5096
&mod);
0703a8e1c17e2cb fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2018-06-08 5097 ASSERT(mod
== 0);
0703a8e1c17e2cb fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2018-06-08 5098 len =
div_u64_rem(del->br_blockcount, mp->m_sb.sb_rextsize,
0703a8e1c17e2cb fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2018-06-08 5099
&mod);
0703a8e1c17e2cb fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2018-06-08 5100 ASSERT(mod
== 0);
6321e3ed2acf3ee fs/xfs/xfs_bmap.c Christoph Hellwig 2009-02-24 5101
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5102 error =
xfs_rtfree_extent(tp, bno, (xfs_extlen_t)len);
4be4a00fb55879e fs/xfs/xfs_bmap.c Christoph Hellwig 2009-04-29 5103 if (error)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5104 goto
done;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5105 do_fx = 0;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5106 nblks = len
* mp->m_sb.sb_rextsize;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5107 qfield =
XFS_TRANS_DQ_RTBCOUNT;
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5108 } else {
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5109 do_fx = 1;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5110 nblks =
del->br_blockcount;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5111 qfield =
XFS_TRANS_DQ_BCOUNT;
4be4a00fb55879e fs/xfs/xfs_bmap.c Christoph Hellwig 2009-04-29 5112 }
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5113
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5114 del_endblock
= del->br_startblock + del->br_blockcount;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5115 if (cur) {
e16cf9b03cee4d2 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5116 error =
xfs_bmbt_lookup_eq(cur, &got, &i);
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5117 if (error)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5118 goto
done;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5119 if
(XFS_IS_CORRUPT(mp, i != 1)) {
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5120 error =
-EFSCORRUPTED;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5121 goto
done;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5122 }
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5123 }
340785cca16246f fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-08-03 5124
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5125 if
(got.br_startoff == del->br_startoff)
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5126 state |=
BMAP_LEFT_FILLING;
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5127 if
(got_endoff == del_endoff)
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5128 state |=
BMAP_RIGHT_FILLING;
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5129
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5130 switch
(state & (BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING)) {
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5131 case
BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING:
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5132 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5133 * Matches
the whole extent. Delete the entry.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5134 */
c38ccf599022e74 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5135
xfs_iext_remove(ip, icur, state);
b2b1712a640824e fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5136
xfs_iext_prev(ifp, icur);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5137
XFS_IFORK_NEXT_SET(ip, whichfork,
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5138
XFS_IFORK_NEXTENTS(ip, whichfork) - 1);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5139 flags |=
XFS_ILOG_CORE;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5140 if (!cur)
{
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5141 flags |=
xfs_ilog_fext(whichfork);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5142 break;
5af317c942aebc9 fs/xfs/xfs_bmap.c Eric Sandeen 2008-11-28 5143 }
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5144 if ((error
= xfs_btree_delete(cur, &i)))
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5145 goto
done;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5146 if
(XFS_IS_CORRUPT(mp, i != 1)) {
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5147 error =
-EFSCORRUPTED;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5148 goto
done;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5149 }
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5150 break;
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5151 case
BMAP_LEFT_FILLING:
58e20770646932f fs/xfs/xfs_bmap.c Dave Chinner 2012-04-29 5152 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5153 * Deleting
the first part of the extent.
58e20770646932f fs/xfs/xfs_bmap.c Dave Chinner 2012-04-29 5154 */
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5155
got.br_startoff = del_endoff;
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5156
got.br_startblock = del_endblock;
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5157
got.br_blockcount -= del->br_blockcount;
b2b1712a640824e fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5158
xfs_iext_update_extent(ip, state, icur, &got);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5159 if (!cur)
{
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5160 flags |=
xfs_ilog_fext(whichfork);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5161 break;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5162 }
a67d00a55507dc3 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5163 error =
xfs_bmbt_update(cur, &got);
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5164 if (error)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5165 goto
done;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5166 break;
491f6f8abfa7a91 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5167 case
BMAP_RIGHT_FILLING:
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5168 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5169 * Deleting
the last part of the extent.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5170 */
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5171
got.br_blockcount -= del->br_blockcount;
b2b1712a640824e fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5172
xfs_iext_update_extent(ip, state, icur, &got);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5173 if (!cur)
{
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5174 flags |=
xfs_ilog_fext(whichfork);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5175 break;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5176 }
a67d00a55507dc3 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5177 error =
xfs_bmbt_update(cur, &got);
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5178 if (error)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5179 goto
done;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5180 break;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5181 case 0:
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5182 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5183 * Deleting
the middle of the extent.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5184 */
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5185 old = got;
ca5d8e5b7b90300 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-19 5186
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5187
got.br_blockcount = del->br_startoff - got.br_startoff;
b2b1712a640824e fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5188
xfs_iext_update_extent(ip, state, icur, &got);
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5189
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5190
new.br_startoff = del_endoff;
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5191
new.br_blockcount = got_endoff - del_endoff;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5192
new.br_state = got.br_state;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5193
new.br_startblock = del_endblock;
48fd52b16d74b93 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5194
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5195 flags |=
XFS_ILOG_CORE;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5196 if (cur) {
a67d00a55507dc3 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5197 error =
xfs_bmbt_update(cur, &got);
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5198 if
(error)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5199 goto
done;
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5200 error =
xfs_btree_increment(cur, 0, &i);
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5201 if
(error)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5202 goto
done;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5203
cur->bc_rec.b = new;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5204 error =
xfs_btree_insert(cur, &i);
2451337dd043901 fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2014-06-25 5205 if (error
&& error != -ENOSPC)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5206 goto
done;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5207 /*
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5208 * If get
no-space back from btree insert, it tried a
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5209 * split,
and we have a zero block reservation. Fix up
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5210 * our
state and return the error.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5211 */
2451337dd043901 fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2014-06-25 5212 if (error
== -ENOSPC) {
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5213 /*
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5214 * Reset
the cursor, don't trust it after any
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5215 * insert
operation.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5216 */
e16cf9b03cee4d2 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5217 error =
xfs_bmbt_lookup_eq(cur, &got, &i);
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5218 if
(error)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5219 goto
done;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5220 if
(XFS_IS_CORRUPT(mp, i != 1)) {
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5221 error =
-EFSCORRUPTED;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5222 goto
done;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5223 }
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5224 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5225 * Update
the btree record back
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5226 * to the
original value.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5227 */
a67d00a55507dc3 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5228 error =
xfs_bmbt_update(cur, &old);
e1d7553faf3979d fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-10-17 5229 if
(error)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5230 goto
done;
9af25465081480a fs/xfs/xfs_bmap.c Tao Ma 2010-08-30 5231 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5232 * Reset
the extent record back
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5233 * to the
original value.
9af25465081480a fs/xfs/xfs_bmap.c Tao Ma 2010-08-30 5234 */
b2b1712a640824e fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5235
xfs_iext_update_extent(ip, state, icur, &old);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5236 flags =
0;
2451337dd043901 fs/xfs/libxfs/xfs_bmap.c Dave Chinner 2014-06-25 5237 error =
-ENOSPC;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5238 goto
done;
9af25465081480a fs/xfs/xfs_bmap.c Tao Ma 2010-08-30 5239 }
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5240 if
(XFS_IS_CORRUPT(mp, i != 1)) {
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5241 error =
-EFSCORRUPTED;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5242 goto
done;
f9e0370648b9f99 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-11-11 5243 }
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5244 } else
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5245 flags |=
xfs_ilog_fext(whichfork);
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5246
XFS_IFORK_NEXT_SET(ip, whichfork,
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5247
XFS_IFORK_NEXTENTS(ip, whichfork) + 1);
b2b1712a640824e fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5248
xfs_iext_next(ifp, icur);
0254c2f253d6fe1 fs/xfs/libxfs/xfs_bmap.c Christoph Hellwig 2017-11-03 5249
xfs_iext_insert(ip, icur, &new, state);
6321e3ed2acf3ee fs/xfs/xfs_bmap.c Christoph Hellwig 2009-02-24 5250 break;
6321e3ed2acf3ee fs/xfs/xfs_bmap.c Christoph Hellwig 2009-02-24 5251 }
9c19464469556a0 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-08-03 5252
9c19464469556a0 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-08-03 5253 /* remove
reverse mapping */
bc46ac64713f11c fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-08-26 5254
xfs_rmap_unmap_extent(tp, ip, whichfork, del);
9c19464469556a0 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-08-03 5255
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5256 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5257 * If we
need to, add to list of extents to delete.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5258 */
4847acf868bb426 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-10-03 5259 if (do_fx
&& !(bflags & XFS_BMAPI_REMAP)) {
62aab20f08758b1 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-10-03 5260 if
(xfs_is_reflink_inode(ip) && whichfork == XFS_DATA_FORK) {
74b4c5d4a9c0731 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2019-08-26 5261
xfs_refcount_decrease_extent(tp, del);
fcb762f5de2e534 fs/xfs/libxfs/xfs_bmap.c Brian Foster 2018-05-09 5262 } else {
0f37d1780c3d864 fs/xfs/libxfs/xfs_bmap.c Brian Foster 2018-08-01 5263
__xfs_bmap_add_free(tp, del->br_startblock,
4e529339af15226 fs/xfs/libxfs/xfs_bmap.c Brian Foster 2018-05-10 5264
del->br_blockcount, NULL,
4e529339af15226 fs/xfs/libxfs/xfs_bmap.c Brian Foster 2018-05-10 5265 (bflags
& XFS_BMAPI_NODISCARD) ||
4e529339af15226 fs/xfs/libxfs/xfs_bmap.c Brian Foster 2018-05-10 5266
del->br_state == XFS_EXT_UNWRITTEN);
fcb762f5de2e534 fs/xfs/libxfs/xfs_bmap.c Brian Foster 2018-05-09 5267 }
fcb762f5de2e534 fs/xfs/libxfs/xfs_bmap.c Brian Foster 2018-05-09 5268 }
62aab20f08758b1 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-10-03 5269
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5270 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5271 * Adjust
inode # blocks in the file.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5272 */
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5273 if (nblks)
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5274
ip->i_d.di_nblocks -= nblks;
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5275 /*
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5276 * Adjust
quota data.
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5277 */
4847acf868bb426 fs/xfs/libxfs/xfs_bmap.c Darrick J. Wong 2016-10-03 5278 if (qfield
&& !(bflags & XFS_BMAPI_REMAP))
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 @5279
xfs_trans_mod_dquot_byino(tp, ip, qfield, (long)-nblks);
6321e3ed2acf3ee fs/xfs/xfs_bmap.c Christoph Hellwig 2009-02-24 5280
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5281 done:
9e5987a7792194e fs/xfs/xfs_bmap.c Dave Chinner 2013-02-25 5282 *logflagsp =
flags;
^1da177e4c3f415 fs/xfs/xfs_bmap.c Linus Torvalds 2005-04-16 5283 return
error;
^1da177e4c3f415 fs/xfs/xfs_bmap.c Linus Torvalds 2005-04-16 5284 }
^1da177e4c3f415 fs/xfs/xfs_bmap.c Linus Torvalds 2005-04-16 5285
:::::: The code at line 5279 was first introduced by commit
:::::: 9e5987a7792194ec338f53643237150c0db5f5e0 xfs: rearrange some code in xfs_bmap for
better locality
:::::: TO: Dave Chinner <dchinner(a)redhat.com>
:::::: CC: Ben Myers <bpm(a)sgi.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org