All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [djwong-xfs:realtime-reflink 221/233] fs/xfs/libxfs/xfs_refcount.c:1883:40: warning: suggest braces around empty body in an 'else' statement
Date: Mon, 02 Nov 2020 18:40:18 +0800	[thread overview]
Message-ID: <202011021815.pZPTRfyJ-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 5424 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git realtime-reflink
head:   c886b4656afe488e5b52a406279b69c0ee4c0c48
commit: 1e4106cac5b992a3ae6e175ae211632810f92129 [221/233] xfs: refcover CoW leftovers in the realtime volume
config: mips-randconfig-r026-20201030 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=1e4106cac5b992a3ae6e175ae211632810f92129
        git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
        git fetch --no-tags djwong-xfs realtime-reflink
        git checkout 1e4106cac5b992a3ae6e175ae211632810f92129
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   fs/xfs/libxfs/xfs_refcount.c: In function 'xfs_refcount_recover_cow_leftovers':
>> fs/xfs/libxfs/xfs_refcount.c:1883:40: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
    1883 |   xfs_rtunlock(mp, XFS_RTLOCK_REFCOUNT);
         |                                        ^

vim +/else +1883 fs/xfs/libxfs/xfs_refcount.c

  1820	
  1821	/* Find and remove leftover CoW reservations. */
  1822	int
  1823	xfs_refcount_recover_cow_leftovers(
  1824		struct xfs_mount		*mp,
  1825		xfs_agnumber_t			agno)
  1826	{
  1827		struct xfs_trans		*tp;
  1828		struct xfs_btree_cur		*cur;
  1829		struct xfs_buf			*agbp = NULL;
  1830		struct xfs_refcount_recovery	*rr, *n;
  1831		struct list_head		debris;
  1832		union xfs_btree_irec		low;
  1833		union xfs_btree_irec		high;
  1834		xfs_fsblock_t			fsb;
  1835		xfs_fsblock_t			bno;
  1836		xfs_fsblock_t			cow_start;
  1837		bool				is_rt = agno == NULLAGNUMBER;
  1838		int				error;
  1839	
  1840		if (!is_rt && mp->m_sb.sb_agblocks >= XFS_REFC_COW_START)
  1841			return -EOPNOTSUPP;
  1842		if (is_rt && mp->m_sb.sb_rextents >= XFS_RTREFC_COW_START)
  1843			return -EOPNOTSUPP;
  1844	
  1845		INIT_LIST_HEAD(&debris);
  1846	
  1847		/*
  1848		 * In this first part, we use an empty transaction to gather up
  1849		 * all the leftover CoW extents so that we can subsequently
  1850		 * delete them.  The empty transaction is used to avoid
  1851		 * a buffer lock deadlock if there happens to be a loop in the
  1852		 * refcountbt because we're allowed to re-grab a buffer that is
  1853		 * already attached to our transaction.  When we're done
  1854		 * recording the CoW debris we cancel the (empty) transaction
  1855		 * and everything goes away cleanly.
  1856		 */
  1857		error = xfs_trans_alloc_empty(mp, &tp);
  1858		if (error)
  1859			return error;
  1860	
  1861		if (is_rt) {
  1862			xfs_rtlock(NULL, mp, XFS_RTLOCK_REFCOUNT);
  1863			cur = xfs_rtrefcountbt_init_cursor(mp, tp, mp->m_rrefcountip);
  1864		} else {
  1865			error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
  1866			if (error)
  1867				goto out_trans;
  1868			cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
  1869		}
  1870		cow_start = xrefc_cow_start(cur);
  1871	
  1872		/* Find all the leftover CoW staging extents. */
  1873		memset(&low, 0, sizeof(low));
  1874		memset(&high, 0, sizeof(high));
  1875		low.rc.rc_startblock = cow_start;
  1876		high.rc.rc_startblock = -1ULL;
  1877		error = xfs_btree_query_range(cur, &low, &high,
  1878				xfs_refcount_recover_extent, &debris);
  1879		xfs_btree_del_cursor(cur, error);
  1880		if (agbp)
  1881			xfs_trans_brelse(tp, agbp);
  1882		else
> 1883			xfs_rtunlock(mp, XFS_RTLOCK_REFCOUNT);
  1884		xfs_trans_cancel(tp);
  1885		if (error)
  1886			goto out_free;
  1887	
  1888		/* Now iterate the list to free the leftovers */
  1889		list_for_each_entry_safe(rr, n, &debris, rr_list) {
  1890			/* Set up transaction. */
  1891			error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, 0, 0, 0, &tp);
  1892			if (error)
  1893				goto out_free;
  1894	
  1895			trace_xfs_refcount_recover_extent(mp, agno, &rr->rr_rrec);
  1896	
  1897			/* Free the orphan record */
  1898			bno = rr->rr_rrec.rc_startblock - cow_start;
  1899			fsb = is_rt ? bno : XFS_AGB_TO_FSB(mp, agno, bno);
  1900			xfs_refcount_free_cow_extent(tp, fsb,
  1901					rr->rr_rrec.rc_blockcount, is_rt);
  1902	
  1903			/* Free the block. */
  1904			xfs_bmap_add_free(tp, fsb, rr->rr_rrec.rc_blockcount, NULL,
  1905					is_rt);
  1906	
  1907			error = xfs_trans_commit(tp);
  1908			if (error)
  1909				goto out_free;
  1910	
  1911			list_del(&rr->rr_list);
  1912			kmem_free(rr);
  1913		}
  1914	
  1915		return error;
  1916	out_trans:
  1917		xfs_trans_cancel(tp);
  1918	out_free:
  1919		/* Free the leftover list */
  1920		list_for_each_entry_safe(rr, n, &debris, rr_list) {
  1921			list_del(&rr->rr_list);
  1922			kmem_free(rr);
  1923		}
  1924		return error;
  1925	}
  1926	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33696 bytes --]

                 reply	other threads:[~2020-11-02 10:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202011021815.pZPTRfyJ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.