diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index f4f81d893e8c..893ea899a0a8 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -1619,12 +1619,14 @@ xlog_write_iclog( if (iclog->ic_flags & XLOG_ICL_NEED_FLUSH) { if (xlog_flush_data_caches(log)) goto shutdown; - iclog->ic_bio.bi_opf |= REQ_PREFLUSH; } + if (iclog->ic_flags & (XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FLUSH_LOG)) + iclog->ic_bio.bi_opf |= REQ_PREFLUSH; if (iclog->ic_flags & XLOG_ICL_NEED_FUA) iclog->ic_bio.bi_opf |= REQ_FUA; - iclog->ic_flags &= ~(XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FUA); + iclog->ic_flags &= ~(XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FLUSH_LOG | + XLOG_ICL_NEED_FUA); if (is_vmalloc_addr(iclog->ic_header)) { if (!bio_add_vmalloc(&iclog->ic_bio, iclog->ic_header, count)) diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c index 9446ac44ba88..b54a421cab63 100644 --- a/fs/xfs/xfs_log_cil.c +++ b/fs/xfs/xfs_log_cil.c @@ -1562,10 +1562,13 @@ xlog_cil_push_work( } /* - * We need to issue a pre-flush so that the ordering for this - * checkpoint is correctly preserved down to stable storage. + * We need to issue a pre-flush on the device containing the log + * so that the ordering for this checkpoint is correctly + * preserved down to stable storage. + * There is no need for an extra flush on devices that only + * contain data or non-log metadata. */ - ctx->commit_iclog->ic_flags |= XLOG_ICL_NEED_FLUSH; + ctx->commit_iclog->ic_flags |= XLOG_ICL_NEED_FLUSH_LOG; } /* diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index 6d9673c41cdf..529720a4984b 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h @@ -71,12 +71,14 @@ enum xlog_iclog_state { /* * In core log flags */ -#define XLOG_ICL_NEED_FLUSH (1u << 0) /* iclog needs REQ_PREFLUSH */ -#define XLOG_ICL_NEED_FUA (1u << 1) /* iclog needs REQ_FUA */ +#define XLOG_ICL_NEED_FLUSH (1u << 0) /* all devs need REQ_PREFLUSH */ +#define XLOG_ICL_NEED_FLUSH_LOG (1u << 1) /* logdev needs REQ_PREFLUSH */ +#define XLOG_ICL_NEED_FUA (1u << 2) /* iclog needs REQ_FUA */ #define XLOG_ICL_STRINGS \ - { XLOG_ICL_NEED_FLUSH, "XLOG_ICL_NEED_FLUSH" }, \ - { XLOG_ICL_NEED_FUA, "XLOG_ICL_NEED_FUA" } + { XLOG_ICL_NEED_FLUSH, "XLOG_ICL_NEED_FLUSH" }, \ + { XLOG_ICL_NEED_FLUSH_LOG, "XLOG_ICL_NEED_FLUSH_LOG" }, \ + { XLOG_ICL_NEED_FUA, "XLOG_ICL_NEED_FUA" } /*