dm-crypt: use __bio_add_page to add single page to clone bio
[linux-block.git] / fs / xfs / xfs_bmap_util.c
index a09dd2606479270d107c63da7ab030447431e8ca..fbb675563208db12a05b7f825bc1d02c681a4d59 100644 (file)
@@ -314,15 +314,13 @@ xfs_getbmap_report_one(
        if (isnullstartblock(got->br_startblock) ||
            got->br_startblock == DELAYSTARTBLOCK) {
                /*
-                * Delalloc extents that start beyond EOF can occur due to
-                * speculative EOF allocation when the delalloc extent is larger
-                * than the largest freespace extent at conversion time.  These
-                * extents cannot be converted by data writeback, so can exist
-                * here even if we are not supposed to be finding delalloc
-                * extents.
+                * Take the flush completion as being a point-in-time snapshot
+                * where there are no delalloc extents, and if any new ones
+                * have been created racily, just skip them as being 'after'
+                * the flush and so don't get reported.
                 */
-               if (got->br_startoff < XFS_B_TO_FSB(ip->i_mount, XFS_ISIZE(ip)))
-                       ASSERT((bmv->bmv_iflags & BMV_IF_DELALLOC) != 0);
+               if (!(bmv->bmv_iflags & BMV_IF_DELALLOC))
+                       return 0;
 
                p->bmv_oflags |= BMV_OF_DELALLOC;
                p->bmv_block = -2;
@@ -560,7 +558,9 @@ xfs_getbmap(
                if (!xfs_iext_next_extent(ifp, &icur, &got)) {
                        xfs_fileoff_t   end = XFS_B_TO_FSB(mp, XFS_ISIZE(ip));
 
-                       out[bmv->bmv_entries - 1].bmv_oflags |= BMV_OF_LAST;
+                       if (bmv->bmv_entries > 0)
+                               out[bmv->bmv_entries - 1].bmv_oflags |=
+                                                               BMV_OF_LAST;
 
                        if (whichfork != XFS_ATTR_FORK && bno < end &&
                            !xfs_getbmap_full(bmv)) {