Content-Type: multipart/mixed; boundary="===============7978654178045785546==" MIME-Version: 1.0 From: Darrick J. Wong To: kbuild-all@lists.01.org Subject: Re: [PATCH V4 06/16] xfs: Promote xfs_extnum_t and xfs_aextnum_t to 64 and 32-bits respectively Date: Thu, 06 Jan 2022 12:31:32 -0800 Message-ID: <20220106203132.GQ656707@magnolia> In-Reply-To: <87r19lwdky.fsf@debian-BULLSEYE-live-builder-AMD64> List-Id: --===============7978654178045785546== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, Jan 06, 2022 at 12:33:25PM +0530, Chandan Babu R wrote: > On 05 Jan 2022 at 22:51, Darrick J. Wong wrote: > > On Wed, Jan 05, 2022 at 07:44:23PM +0530, Chandan Babu R wrote: > >> On 05 Jan 2022 at 05:24, Darrick J. Wong wrote: > >> > On Wed, Dec 15, 2021 at 02:49:48PM +0530, Chandan Babu R wrote: > >> >> On 14 Dec 2021 at 20:45, kernel test robot wrote: > >> >> > Hi Chandan, > >> >> > > >> >> > Thank you for the patch! Yet something to improve: > >> >> > > >> >> > [auto build test ERROR on xfs-linux/for-next] > >> >> > [also build test ERROR on v5.16-rc5] > >> >> > [If your patch is applied to the wrong git tree, kindly drop us a= note. > >> >> > And when submitting patch, we suggest to use '--base' as document= ed in > >> >> > https://git-scm.com/docs/git-format-patch] > >> >> > > >> >> > url: https://github.com/0day-ci/linux/commits/Chandan-Babu-R/x= fs-Extend-per-inode-extent-counters/20211214-164920 > >> >> > base: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-n= ext > >> >> > config: microblaze-randconfig-r016-20211214 (https://download.01.= org/0day-ci/archive/20211214/202112142335.O3Nu0vQI-lkp(a)intel.com/config) > >> >> > compiler: microblaze-linux-gcc (GCC) 11.2.0 > >> >> > reproduce (this is a W=3D1 build): > >> >> > wget https://raw.githubusercontent.com/intel/lkp-tests/ma= ster/sbin/make.cross -O ~/bin/make.cross > >> >> > chmod +x ~/bin/make.cross > >> >> > # https://github.com/0day-ci/linux/commit/db28da144803c42= 62c0d8622d736a7d20952ef6b > >> >> > git remote add linux-review https://github.com/0day-ci/li= nux > >> >> > git fetch --no-tags linux-review Chandan-Babu-R/xfs-Exten= d-per-inode-extent-counters/20211214-164920 > >> >> > git checkout db28da144803c4262c0d8622d736a7d20952ef6b > >> >> > # save the config file to linux build tree > >> >> > mkdir build_dir > >> >> > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 = make.cross O=3Dbuild_dir ARCH=3Dmicroblaze SHELL=3D/bin/bash > >> >> > > >> >> > If you fix the issue, kindly add following tag as appropriate > >> >> > Reported-by: kernel test robot > >> >> > > >> >> > All errors (new ones prefixed by >>): > >> >> > > >> >> > microblaze-linux-ld: fs/xfs/libxfs/xfs_bmap.o: in function `xf= s_bmap_compute_maxlevels': > >> >> >>> (.text+0x10cc0): undefined reference to `__udivdi3' > >> >> > > >> >> = > >> >> The fix for the compilation error on 32-bit systems involved invoki= ng do_div() > >> >> instead of using the regular division operator. I will include the = fix in the > >> >> next version of the patchset. > >> > > >> > So, uh, how did you resolve this in the end? > >> > > >> > maxblocks =3D roundup_64(maxleafents, minleafrecs); > >> > > >> > and > >> > > >> > maxblocks =3D roundup_64(maxblocks, minnodrecs); > >> > > >> > ? > >> = > >> I had made the following changes, > >> = > >> maxblocks =3D maxleafents + minleafrecs - 1; > >> do_div(maxblocks, minleafrecs); > >> = > >> and > >> maxblocks +=3D minnoderecs - 1; > >> do_div(maxblocks, minnoderecs); > >> = > >> roundup_64() would cause maxleafents to have a value >=3D its previous= value > >> right? > = > Sorry, I meant to say "The result of roundup_64(maxleafents, minleafrecs)= will > be >=3D than maxleafents". > = > The original statement was, > maxblocks =3D (maxleafents + minleafrecs - 1) / minleafrecs; > i.e. maxblocks would contain the number of leaf blocks required to hold > maxleafents number of records. > = > With maxleafents =3D 2^48, minleafrecs =3D minnoderecs =3D 125, > "maxblocks =3D (maxleafents + minleafrecs - 1) / minleafrecs" would resul= t in, > maxblocks =3D (2^48 + 125 - 1) / 125 > =3D ~2^41 > = > > > > roundup_64 doesn't alter its parameters, if I'm not mistaken: > > > > static inline uint64_t roundup_64(uint64_t x, uint32_t y) > > { > > x +=3D y - 1; > > do_div(x, y); > > return x * y; > > } > > > = > A call to roundup_64(maxleafents, minleafrecs) would result in, > x =3D 2^48 + 125 - 1 > x =3D do_div((2^48 + 125 - 1), 125) =3D ~2^41 > x =3D 2^41 * 125 =3D ~2^48 > = > i.e. maxblocks will not have the number of required leaf blocks. Arrrgh. I meant to say "howmany_64", not "roundup_64". Sorry for wasting everybody's time. :( static inline uint64_t howmany_64(uint64_t x, uint32_t y) { x +=3D y - 1; do_div(x, y); return x; // <-- we don't multiply by (y) } --D > -- = > chandan --===============7978654178045785546==--