linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [bug report] xfs: mark speculative prealloc CoW fork extents unwritten
Date: Mon, 13 Feb 2017 22:03:43 +0300	[thread overview]
Message-ID: <20170213190343.GA11256@mwanda> (raw)

Hello Darrick J. Wong,

The patch 5eda43000064: "xfs: mark speculative prealloc CoW fork
extents unwritten" from Feb 2, 2017, leads to the following static
checker warning:

	fs/xfs/xfs_reflink.c:381 xfs_reflink_convert_cow()
	error: uninitialized symbol 'error'.

fs/xfs/xfs_reflink.c
   350  /* Convert all of the unwritten CoW extents in a file's range to real ones. */
   351  int
   352  xfs_reflink_convert_cow(
   353          struct xfs_inode        *ip,
   354          xfs_off_t               offset,
   355          xfs_off_t               count)
   356  {
   357          struct xfs_bmbt_irec    got;
   358          struct xfs_defer_ops    dfops;
   359          struct xfs_mount        *mp = ip->i_mount;
   360          struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
   361          xfs_fileoff_t           offset_fsb = XFS_B_TO_FSBT(mp, offset);
   362          xfs_fileoff_t           end_fsb = XFS_B_TO_FSB(mp, offset + count);
   363          xfs_extnum_t            idx;
   364          bool                    found;
   365          int                     error;
                                        ^^^^^
   366  
   367          xfs_ilock(ip, XFS_ILOCK_EXCL);
   368  
   369          /* Convert all the extents to real from unwritten. */
   370          for (found = xfs_iext_lookup_extent(ip, ifp, offset_fsb, &idx, &got);
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What if found fails on the first iteration through the loop?

   371               found && got.br_startoff < end_fsb;
   372               found = xfs_iext_get_extent(ifp, ++idx, &got)) {
   373                  error = xfs_reflink_convert_cow_extent(ip, &got, offset_fsb,
   374                                  end_fsb - offset_fsb, &dfops);
   375                  if (error)
   376                          break;
   377          }
   378  
   379          /* Finish up. */
   380          xfs_iunlock(ip, XFS_ILOCK_EXCL);
   381          return error;
                ^^^^^^^^^^^^
   382  }

regards,
dan carpenter

             reply	other threads:[~2017-02-13 19:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 19:03 Dan Carpenter [this message]
2017-02-14  6:54 ` [bug report] xfs: mark speculative prealloc CoW fork extents unwritten Darrick J. Wong

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=20170213190343.GA11256@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).