]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
libxfs: straighten out libxfs_writebuf naming confusion
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 1 Mar 2020 17:34:11 +0000 (12:34 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Sun, 1 Mar 2020 17:34:11 +0000 (12:34 -0500)
libxfs_writebuf is not a well named function -- it marks the buffer
dirty and then releases the caller's reference.  The actual write comes
when the cache is flushed, either because someone explicitly told the
cache to flush or because we started buffer reclaim.

Make the buffer release explicit in the callers and rename the function
to say what it actually does -- it marks the buffer dirty outside of
transaction context.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
15 files changed:
libxfs/libxfs_io.h
libxfs/rdwr.c
libxfs/trans.c
mkfs/proto.c
mkfs/xfs_mkfs.c
repair/attr_repair.c
repair/da_util.c
repair/dino_chunks.c
repair/dinode.c
repair/dir2.c
repair/phase3.c
repair/phase5.c
repair/rmap.c
repair/scan.c
repair/xfs_repair.c

index 1d30039ab2dd49ae04260c8f166399a332ea0055..51b1dc15818f6af807fb3d98db21eed21ac4ec09 100644 (file)
@@ -136,8 +136,8 @@ extern struct cache_operations      libxfs_bcache_operations;
 #define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \
        libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \
                            (dev), (map), (nmaps), (flags), (ops))
-#define libxfs_writebuf(buf, flags) \
-       libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \
+#define libxfs_buf_mark_dirty(buf, flags) \
+       libxfs_trace_dirtybuf(__FUNCTION__, __FILE__, __LINE__, \
                              (buf), (flags))
 #define libxfs_buf_get(dev, daddr, len) \
        libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \
@@ -157,8 +157,8 @@ struct xfs_buf *libxfs_trace_readbuf(const char *func, const char *file,
 extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int,
                        struct xfs_buftarg *, struct xfs_buf_map *, int, int,
                        const struct xfs_buf_ops *);
-extern int     libxfs_trace_writebuf(const char *, const char *, int,
-                       xfs_buf_t *, int);
+void libxfs_trace_dirtybuf(const char *func, const char *file, int line,
+                       struct xfs_buf *bp, int flags);
 struct xfs_buf *libxfs_trace_getbuf(const char *func, const char *file,
                        int line, struct xfs_buftarg *btp, xfs_daddr_t daddr,
                        size_t len);
@@ -173,7 +173,7 @@ extern void libxfs_trace_putbuf (const char *, const char *, int,
 
 extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_map *,
                        int, int, const struct xfs_buf_ops *);
-extern int     libxfs_writebuf(xfs_buf_t *, int);
+void libxfs_buf_mark_dirty(struct xfs_buf *bp, int flags);
 extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *,
                        struct xfs_buf_map *, int, int);
 extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t,
index 958f6c2c5d746d3c99a038470c599d612a5451c7..192e3586bcfb140237fb6891c1f12f17cb5e847c 100644 (file)
@@ -196,11 +196,16 @@ libxfs_trace_readbuf(
        return bp;
 }
 
-int
-libxfs_trace_writebuf(const char *func, const char *file, int line, xfs_buf_t *bp, int flags)
+void
+libxfs_trace_dirtybuf(
+       const char              *func,
+       const char              *file,
+       int                     line,
+       struct xfs_buf          *bp,
+       int                     flags)
 {
        __add_trace(bp, func, file, line);
-       return libxfs_writebuf(bp, flags);
+       libxfs_buf_mark_dirty(bp, flags);
 }
 
 struct xfs_buf *
@@ -995,8 +1000,14 @@ libxfs_writebuf_int(xfs_buf_t *bp, int flags)
        return 0;
 }
 
-int
-libxfs_writebuf(xfs_buf_t *bp, int flags)
+/*
+ * Mark a buffer dirty.  The dirty data will be written out when the cache
+ * is flushed (or at release time if the buffer is uncached).
+ */
+void
+libxfs_buf_mark_dirty(
+       struct xfs_buf  *bp,
+       int             flags)
 {
 #ifdef IO_DEBUG
        printf("%lx: %s: dirty blkno=%llu(%llu)\n",
@@ -1011,8 +1022,6 @@ libxfs_writebuf(xfs_buf_t *bp, int flags)
        bp->b_error = 0;
        bp->b_flags &= ~LIBXFS_B_STALE;
        bp->b_flags |= (LIBXFS_B_DIRTY | flags);
-       libxfs_buf_relse(bp);
-       return 0;
 }
 
 void
@@ -1413,8 +1422,10 @@ libxfs_log_clear(
        }
        libxfs_log_header(ptr, fs_uuid, version, sunit, fmt, lsn, tail_lsn,
                          next, bp);
-       if (bp)
-               libxfs_writebuf(bp, 0);
+       if (bp) {
+               libxfs_buf_mark_dirty(bp, 0);
+               libxfs_buf_relse(bp);
+       }
 
        /*
         * There's nothing else to do if this is a log reset. The kernel detects
@@ -1463,8 +1474,10 @@ libxfs_log_clear(
                 */
                libxfs_log_header(ptr, fs_uuid, version, BBTOB(len), fmt, lsn,
                                  tail_lsn, next, bp);
-               if (bp)
-                       libxfs_writebuf(bp, 0);
+               if (bp) {
+                       libxfs_buf_mark_dirty(bp, 0);
+                       libxfs_buf_relse(bp);
+               }
 
                blk += len;
                if (dptr)
index 59cb897f306b793ea594a39724c6553379e20bca..91001a93639a180140b77924e02bb7f1a99ab43c 100644 (file)
@@ -843,7 +843,8 @@ inode_item_done(
                goto free;
        }
 
-       libxfs_writebuf(bp, 0);
+       libxfs_buf_mark_dirty(bp, 0);
+       libxfs_buf_relse(bp);
 free:
        xfs_inode_item_put(iip);
 }
index c3813ea2efc7d971c83dfaac1dea0588e34de8da..7de76ca45d5657defdf6a9e6a53c83e9c2cd5108 100644 (file)
@@ -261,8 +261,10 @@ newfile(
                        memset((char *)bp->b_addr + len, 0, bp->b_bcount - len);
                if (logit)
                        libxfs_trans_log_buf(tp, bp, 0, bp->b_bcount - 1);
-               else
-                       libxfs_writebuf(bp, 0);
+               else {
+                       libxfs_buf_mark_dirty(bp, 0);
+                       libxfs_buf_relse(bp);
+               }
        }
        ip->i_d.di_size = len;
        return flags;
index d9675bf1e686dc118fc875a3f9c96b475e57dc01..1c7e29613a9d63c8b64760bc9c8ef3f06e5f72d1 100644 (file)
@@ -3417,7 +3417,8 @@ prepare_devices(
        buf = alloc_write_buf(mp->m_ddev_targp, (xi->dsize - whack_blks),
                        whack_blks);
        memset(buf->b_addr, 0, WHACK_SIZE);
-       libxfs_writebuf(buf, 0);
+       libxfs_buf_mark_dirty(buf, 0);
+       libxfs_buf_relse(buf);
 
        /*
         * Now zero out the beginning of the device, to obliterate any old
@@ -3427,7 +3428,8 @@ prepare_devices(
         */
        buf = alloc_write_buf(mp->m_ddev_targp, 0, whack_blks);
        memset(buf->b_addr, 0, WHACK_SIZE);
-       libxfs_writebuf(buf, 0);
+       libxfs_buf_mark_dirty(buf, 0);
+       libxfs_buf_relse(buf);
 
        /* OK, now write the superblock... */
        buf = alloc_write_buf(mp->m_ddev_targp, XFS_SB_DADDR,
@@ -3435,7 +3437,8 @@ prepare_devices(
        buf->b_ops = &xfs_sb_buf_ops;
        memset(buf->b_addr, 0, cfg->sectorsize);
        libxfs_sb_to_disk(buf->b_addr, sbp);
-       libxfs_writebuf(buf, 0);
+       libxfs_buf_mark_dirty(buf, 0);
+       libxfs_buf_relse(buf);
 
        /* ...and zero the log.... */
        lsunit = sbp->sb_logsunit;
@@ -3454,7 +3457,8 @@ prepare_devices(
                                XFS_FSB_TO_BB(mp, cfg->rtblocks - 1LL),
                                BTOBB(cfg->blocksize));
                memset(buf->b_addr, 0, cfg->blocksize);
-               libxfs_writebuf(buf, 0);
+               libxfs_buf_mark_dirty(buf, 0);
+               libxfs_buf_relse(buf);
        }
 
 }
@@ -3550,7 +3554,8 @@ rewrite_secondary_superblocks(
                exit(1);
        }
        XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino);
-       libxfs_writebuf(buf, 0);
+       libxfs_buf_mark_dirty(buf, 0);
+       libxfs_buf_relse(buf);
 
        /* and one in the middle for luck if there's enough AGs for that */
        if (mp->m_sb.sb_agcount <= 2)
@@ -3566,7 +3571,8 @@ rewrite_secondary_superblocks(
                exit(1);
        }
        XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino);
-       libxfs_writebuf(buf, 0);
+       libxfs_buf_mark_dirty(buf, 0);
+       libxfs_buf_relse(buf);
 }
 
 static void
@@ -3913,7 +3919,8 @@ main(
        if (!buf || buf->b_error)
                exit(1);
        (XFS_BUF_TO_SBP(buf))->sb_inprogress = 0;
-       libxfs_writebuf(buf, 0);
+       libxfs_buf_mark_dirty(buf, 0);
+       libxfs_buf_relse(buf);
 
        /* Exit w/ failure if anything failed to get written to our new fs. */
        error = -libxfs_umount(mp);
index 7edf54adcdc976bff3bf2b4d7bca5a6e7b220d86..e9423aa14818962ecd02835714c882462e7545a6 100644 (file)
@@ -835,8 +835,10 @@ process_leaf_attr_level(xfs_mount_t        *mp,
                if (!no_modify && bp->b_error == -EFSBADCRC)
                        repair++;
 
-               if (repair && !no_modify)
-                       libxfs_writebuf(bp, 0);
+               if (repair && !no_modify) {
+                       libxfs_buf_mark_dirty(bp, 0);
+                       libxfs_buf_relse(bp);
+               }
                else
                        libxfs_buf_relse(bp);
        } while (da_bno != 0);
@@ -999,9 +1001,8 @@ _("would clear forw/back pointers in block 0 for attributes in inode %" PRIu64 "
        *repair = *repair || repairlinks;
 
        if (*repair && !no_modify)
-               libxfs_writebuf(bp, 0);
-       else
-               libxfs_buf_relse(bp);
+               libxfs_buf_mark_dirty(bp, 0);
+       libxfs_buf_relse(bp);
 
        return 0;
 }
@@ -1043,9 +1044,9 @@ _("would clear forw/back pointers in block 0 for attributes in inode %" PRIu64 "
        /* must do this now, to release block 0 before the traversal */
        if ((*repair || repairlinks) && !no_modify) {
                *repair = 1;
-               libxfs_writebuf(bp, 0);
-       } else
-               libxfs_buf_relse(bp);
+               libxfs_buf_mark_dirty(bp, 0);
+       }
+       libxfs_buf_relse(bp);
        error = process_node_attr(mp, ino, dip, blkmap); /* + repair */
        if (error)
                *repair = 0;
index c02d621c728d8534d946ee32fdf3800bf9bf3f3d..6a0e28a3f34d8489c0336518d021dbb0443c0972 100644 (file)
@@ -403,8 +403,10 @@ _("would correct bad hashval in non-leaf %s block\n"
        ASSERT(cursor->level[this_level].dirty == 0 ||
                (cursor->level[this_level].dirty && !no_modify));
 
-       if (cursor->level[this_level].dirty && !no_modify)
-               libxfs_writebuf(cursor->level[this_level].bp, 0);
+       if (cursor->level[this_level].dirty && !no_modify) {
+               libxfs_buf_mark_dirty(cursor->level[this_level].bp, 0);
+               libxfs_buf_relse(cursor->level[this_level].bp);
+       }
        else
                libxfs_buf_relse(cursor->level[this_level].bp);
 
@@ -619,8 +621,10 @@ _("bad level %d in %s block %u for inode %" PRIu64 "\n"),
                    cursor->level[this_level].bp->b_error == -EFSBADCRC)
                        cursor->level[this_level].dirty = 1;
 
-               if (cursor->level[this_level].dirty && !no_modify)
-                       libxfs_writebuf(cursor->level[this_level].bp, 0);
+               if (cursor->level[this_level].dirty && !no_modify) {
+                       libxfs_buf_mark_dirty(cursor->level[this_level].bp, 0);
+                       libxfs_buf_relse(cursor->level[this_level].bp);
+               }
                else
                        libxfs_buf_relse(cursor->level[this_level].bp);
 
index 76e9f773fc920d452972276fbe1ffa6fe3d95346..5b6f7fcac62b65f92275dd9d3ece108906a45964 100644 (file)
@@ -939,8 +939,11 @@ process_next:
                                        bplist[bp_index], (long long)
                                        XFS_BUF_ADDR(bplist[bp_index]), agno);
 
-                               if (dirty && !no_modify)
-                                       libxfs_writebuf(bplist[bp_index], 0);
+                               if (dirty && !no_modify) {
+                                       libxfs_buf_mark_dirty(bplist[bp_index],
+                                                       0);
+                                       libxfs_buf_relse(bplist[bp_index]);
+                               }
                                else
                                        libxfs_buf_relse(bplist[bp_index]);
                        }
index aa7d479a555cd3b11c32ae4c6f83f5e99f5a4bae..502114f8b28365747310cb611dfae594fd3daff5 100644 (file)
@@ -1231,8 +1231,10 @@ bad:
                        }
                }
 
-               if (writebuf && !no_modify)
-                       libxfs_writebuf(bp, 0);
+               if (writebuf && !no_modify) {
+                       libxfs_buf_mark_dirty(bp, 0);
+                       libxfs_buf_relse(bp);
+               }
                else
                        libxfs_buf_relse(bp);
        }
@@ -1328,8 +1330,10 @@ _("bad symlink header ino %" PRIu64 ", file block %d, disk block %" PRIu64 "\n")
                offset += byte_cnt;
                i++;
 
-               if (badcrc && !no_modify)
-                       libxfs_writebuf(bp, 0);
+               if (badcrc && !no_modify) {
+                       libxfs_buf_mark_dirty(bp, 0);
+                       libxfs_buf_relse(bp);
+               }
                else
                        libxfs_buf_relse(bp);
        }
index 769e341c684d0bf211f90387d4a2b3ee08d2fede..1384011b4cb032961b527fa9c2f0311b47ba3eb1 100644 (file)
@@ -1010,7 +1010,8 @@ _("bad directory block magic # %#x in block %u for directory inode %" PRIu64 "\n
                dirty = 1;
        if (dirty && !no_modify) {
                *repair = 1;
-               libxfs_writebuf(bp, 0);
+               libxfs_buf_mark_dirty(bp, 0);
+               libxfs_buf_relse(bp);
        } else
                libxfs_buf_relse(bp);
        return rval;
@@ -1180,7 +1181,8 @@ _("bad sibling back pointer for block %u in directory inode %" PRIu64 "\n"),
                ASSERT(buf_dirty == 0 || (buf_dirty && !no_modify));
                if (buf_dirty && !no_modify) {
                        *repair = 1;
-                       libxfs_writebuf(bp, 0);
+                       libxfs_buf_mark_dirty(bp, 0);
+                       libxfs_buf_relse(bp);
                } else
                        libxfs_buf_relse(bp);
        } while (da_bno != 0);
@@ -1339,7 +1341,8 @@ _("bad directory block magic # %#x in block %" PRIu64 " for directory inode %" P
                }
                if (dirty && !no_modify) {
                        *repair = 1;
-                       libxfs_writebuf(bp, 0);
+                       libxfs_buf_mark_dirty(bp, 0);
+                       libxfs_buf_relse(bp);
                } else
                        libxfs_buf_relse(bp);
        }
index 886acd1f0841804d8c331bb4110ef029d6e6a6b8..4e7fe9645914eec5119c6dcb36490cf053a9774d 100644 (file)
@@ -46,8 +46,10 @@ process_agi_unlinked(
                }
        }
 
-       if (agi_dirty)
-               libxfs_writebuf(bp, 0);
+       if (agi_dirty) {
+               libxfs_buf_mark_dirty(bp, 0);
+               libxfs_buf_relse(bp);
+       }
        else
                libxfs_buf_relse(bp);
 }
index cdbf6697b11789dade999f0fc8e13119ef088999..e31dedca0cb879c112a92c6549c0d6241482e430 100644 (file)
@@ -321,9 +321,11 @@ write_cursor(bt_status_t *curs)
                        fprintf(stderr, "writing bt prev block %u\n",
                                                curs->level[i].prev_agbno);
 #endif
-                       libxfs_writebuf(curs->level[i].prev_buf_p, 0);
+                       libxfs_buf_mark_dirty(curs->level[i].prev_buf_p, 0);
+                       libxfs_buf_relse(curs->level[i].prev_buf_p);
                }
-               libxfs_writebuf(curs->level[i].buf_p, 0);
+               libxfs_buf_mark_dirty(curs->level[i].buf_p, 0);
+               libxfs_buf_relse(curs->level[i].buf_p);
        }
 }
 
@@ -681,7 +683,8 @@ prop_freespace_cursor(xfs_mount_t *mp, xfs_agnumber_t agno,
 #endif
                if (lptr->prev_agbno != NULLAGBLOCK) {
                        ASSERT(lptr->prev_buf_p != NULL);
-                       libxfs_writebuf(lptr->prev_buf_p, 0);
+                       libxfs_buf_mark_dirty(lptr->prev_buf_p, 0);
+                       libxfs_buf_relse(lptr->prev_buf_p);
                }
                lptr->prev_agbno = lptr->agbno;;
                lptr->prev_buf_p = lptr->buf_p;
@@ -870,7 +873,8 @@ build_freespace_tree(xfs_mount_t *mp, xfs_agnumber_t agno,
                                        lptr->prev_agbno);
 #endif
                                ASSERT(lptr->prev_agbno != NULLAGBLOCK);
-                               libxfs_writebuf(lptr->prev_buf_p, 0);
+                               libxfs_buf_mark_dirty(lptr->prev_buf_p, 0);
+                               libxfs_buf_relse(lptr->prev_buf_p);
                        }
                        lptr->prev_buf_p = lptr->buf_p;
                        lptr->prev_agbno = lptr->agbno;
@@ -1046,7 +1050,8 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
 #endif
                if (lptr->prev_agbno != NULLAGBLOCK)  {
                        ASSERT(lptr->prev_buf_p != NULL);
-                       libxfs_writebuf(lptr->prev_buf_p, 0);
+                       libxfs_buf_mark_dirty(lptr->prev_buf_p, 0);
+                       libxfs_buf_relse(lptr->prev_buf_p);
                }
                lptr->prev_agbno = lptr->agbno;;
                lptr->prev_buf_p = lptr->buf_p;
@@ -1137,7 +1142,8 @@ build_agi(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
                agi->agi_free_level = cpu_to_be32(finobt_curs->num_levels);
        }
 
-       libxfs_writebuf(agi_buf, 0);
+       libxfs_buf_mark_dirty(agi_buf, 0);
+       libxfs_buf_relse(agi_buf);
 }
 
 /*
@@ -1299,7 +1305,8 @@ nextrec:
                                        lptr->prev_agbno);
 #endif
                                ASSERT(lptr->prev_agbno != NULLAGBLOCK);
-                               libxfs_writebuf(lptr->prev_buf_p, 0);
+                               libxfs_buf_mark_dirty(lptr->prev_buf_p, 0);
+                               libxfs_buf_relse(lptr->prev_buf_p);
                        }
                        lptr->prev_buf_p = lptr->buf_p;
                        lptr->prev_agbno = lptr->agbno;
@@ -1451,7 +1458,8 @@ prop_rmap_cursor(
 #endif
                if (lptr->prev_agbno != NULLAGBLOCK)  {
                        ASSERT(lptr->prev_buf_p != NULL);
-                       libxfs_writebuf(lptr->prev_buf_p, 0);
+                       libxfs_buf_mark_dirty(lptr->prev_buf_p, 0);
+                       libxfs_buf_relse(lptr->prev_buf_p);
                }
                lptr->prev_agbno = lptr->agbno;
                lptr->prev_buf_p = lptr->buf_p;
@@ -1661,7 +1669,8 @@ _("Insufficient memory to construct reverse-map cursor."));
                                        lptr->prev_agbno);
 #endif
                                ASSERT(lptr->prev_agbno != NULLAGBLOCK);
-                               libxfs_writebuf(lptr->prev_buf_p, 0);
+                               libxfs_buf_mark_dirty(lptr->prev_buf_p, 0);
+                               libxfs_buf_relse(lptr->prev_buf_p);
                        }
                        lptr->prev_buf_p = lptr->buf_p;
                        lptr->prev_agbno = lptr->agbno;
@@ -1801,7 +1810,8 @@ prop_refc_cursor(
 #endif
                if (lptr->prev_agbno != NULLAGBLOCK)  {
                        ASSERT(lptr->prev_buf_p != NULL);
-                       libxfs_writebuf(lptr->prev_buf_p, 0);
+                       libxfs_buf_mark_dirty(lptr->prev_buf_p, 0);
+                       libxfs_buf_relse(lptr->prev_buf_p);
                }
                lptr->prev_agbno = lptr->agbno;
                lptr->prev_buf_p = lptr->buf_p;
@@ -1954,7 +1964,8 @@ _("Insufficient memory to construct refcount cursor."));
                                        lptr->prev_agbno);
 #endif
                                ASSERT(lptr->prev_agbno != NULLAGBLOCK);
-                               libxfs_writebuf(lptr->prev_buf_p, 0);
+                               libxfs_buf_mark_dirty(lptr->prev_buf_p, 0);
+                               libxfs_buf_relse(lptr->prev_buf_p);
                        }
                        lptr->prev_buf_p = lptr->buf_p;
                        lptr->prev_agbno = lptr->agbno;
@@ -2142,7 +2153,8 @@ _("Insufficient memory saving lost blocks.\n"));
                agf->agf_flcount = 0;
        }
 
-       libxfs_writebuf(agfl_buf, 0);
+       libxfs_buf_mark_dirty(agfl_buf, 0);
+       libxfs_buf_relse(agfl_buf);
 
        ext_ptr = findbiggest_bcnt_extent(agno);
        agf->agf_longest = cpu_to_be32((ext_ptr != NULL) ?
@@ -2155,7 +2167,8 @@ _("Insufficient memory saving lost blocks.\n"));
        ASSERT(be32_to_cpu(agf->agf_refcount_root) !=
                be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNTi]));
 
-       libxfs_writebuf(agf_buf, 0);
+       libxfs_buf_mark_dirty(agf_buf, 0);
+       libxfs_buf_relse(agf_buf);
 
        /*
         * now fix up the free list appropriately
@@ -2189,7 +2202,8 @@ sync_sb(xfs_mount_t *mp)
        update_sb_version(mp);
 
        libxfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb);
-       libxfs_writebuf(bp, 0);
+       libxfs_buf_mark_dirty(bp, 0);
+       libxfs_buf_relse(bp);
 }
 
 /*
index bc53e6c07cde6b9ff7465bef4bfeea8f140f58a1..b0b9874ed6fb4877b90a41e99dc7f2ecb6922bf7 100644 (file)
@@ -1231,7 +1231,8 @@ _("setting reflink flag on inode %"PRIu64"\n"),
        else
                dino->di_flags2 &= cpu_to_be64(~XFS_DIFLAG2_REFLINK);
        libxfs_dinode_calc_crc(mp, dino);
-       libxfs_writebuf(buf, 0);
+       libxfs_buf_mark_dirty(buf, 0);
+       libxfs_buf_relse(buf);
 
        return 0;
 }
index d89a3076650f14100ece6b62bed03dd5d81a36eb..b2749ae7fd584128a7a23ef5ab481b6421c5d1a6 100644 (file)
@@ -151,8 +151,10 @@ scan_lbtree(
 
        ASSERT(dirty == 0 || (dirty && !no_modify));
 
-       if ((dirty || badcrc) && !no_modify)
-               libxfs_writebuf(bp, 0);
+       if ((dirty || badcrc) && !no_modify) {
+               libxfs_buf_mark_dirty(bp, 0);
+               libxfs_buf_relse(bp);
+       }
        else
                libxfs_buf_relse(bp);
 
@@ -2425,13 +2427,17 @@ scan_ag(
                sb_dirty += (sbbuf->b_error == -EFSBADCRC);
        }
 
-       if (agi_dirty && !no_modify)
-               libxfs_writebuf(agibuf, 0);
+       if (agi_dirty && !no_modify) {
+               libxfs_buf_mark_dirty(agibuf, 0);
+               libxfs_buf_relse(agibuf);
+       }
        else
                libxfs_buf_relse(agibuf);
 
-       if (agf_dirty && !no_modify)
-               libxfs_writebuf(agfbuf, 0);
+       if (agf_dirty && !no_modify) {
+               libxfs_buf_mark_dirty(agfbuf, 0);
+               libxfs_buf_relse(agfbuf);
+       }
        else
                libxfs_buf_relse(agfbuf);
 
@@ -2439,7 +2445,8 @@ scan_ag(
                if (agno == 0)
                        memcpy(&mp->m_sb, sb, sizeof(xfs_sb_t));
                libxfs_sb_to_disk(XFS_BUF_TO_SBP(sbbuf), sb);
-               libxfs_writebuf(sbbuf, 0);
+               libxfs_buf_mark_dirty(sbbuf, 0);
+               libxfs_buf_relse(sbbuf);
        } else
                libxfs_buf_relse(sbbuf);
        free(sb);
index ebd631e719d6bacd8dd6914db5844b7193cdc87e..e297fe32614fd426b6e968c6eb7188054c649a8d 100644 (file)
@@ -1096,7 +1096,8 @@ _("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\
                        be32_to_cpu(dsb->sb_unit), be32_to_cpu(dsb->sb_width));
        }
 
-       libxfs_writebuf(sbp, 0);
+       libxfs_buf_mark_dirty(sbp, 0);
+       libxfs_buf_relse(sbp);
 
        /*
         * Done. Flush all cached buffers and inodes first to ensure all