> > xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count); > > xfs_filblks_t count_fsb = end_fsb - offset_fsb; > > - struct xfs_bmbt_irec imap; > > - int nimaps = 1, error = 0; > > + int error; > > > > ASSERT(count != 0); > > > > xfs_ilock(ip, XFS_ILOCK_EXCL); > > - error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb, > > - XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT | > > - XFS_BMAPI_CONVERT_ONLY, 0, &imap, &nimaps); > > + error = xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb); > > At this point you might as well convert the one remaining caller of > xfs_reflink_convert_cow to take and drop the ILOCK around the > reflink_convert_cow call... I looked at it - the ilock is not the issue, but moving the bytes to fsb conversion into the only caller makes it look worse than keeping a helper for that one helper.