attached is a patch adding a function pg_current_xlog_flush_location(), which proved quite useful when investigating the ext4 data loss bug. It's mostly what was already sent to that thread, except for docs that were missing in the initial version.
/*
+ * Get latest WAL flush pointer
+ */
+XLogRecPtr
+GetXLogFlushRecPtr(void)
+{
+SpinLockAcquire(&XLogCtl->info_lck);
+LogwrtResult = XLogCtl->LogwrtResult;
+SpinLockRelease(&XLogCtl->info_lck);
+
+return LogwrtResult.Flush;
+}
+
Is there a reason why you can't use existing function