Просмотр исходного кода

xfs: RT bitmap and summary buffers need verifiers

Buffers without verifiers issue runtime warnings on XFS. We don't
have anything we can actually verify in the RT buffers (no CRCs, not
magic numbers, etc), but we still need verifiers to avoid the
warnings.

Add a set of dummy verifier operations for the realtime buffers and
apply them in the appropriate places.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Dave Chinner 10 лет назад
Родитель
Сommit
bf85e0998a
3 измененных файлов с 29 добавлено и 3 удалено
  1. 26 1
      fs/xfs/libxfs/xfs_rtbitmap.c
  2. 1 0
      fs/xfs/libxfs/xfs_shared.h
  3. 2 2
      fs/xfs/xfs_log_recover.c

+ 26 - 1
fs/xfs/libxfs/xfs_rtbitmap.c

@@ -41,6 +41,31 @@
  * Realtime allocator bitmap functions shared with userspace.
  * Realtime allocator bitmap functions shared with userspace.
  */
  */
 
 
+/*
+ * Real time buffers need verifiers to avoid runtime warnings during IO.
+ * We don't have anything to verify, however, so these are just dummy
+ * operations.
+ */
+static void
+xfs_rtbuf_verify_read(
+	struct xfs_buf	*bp)
+{
+	return;
+}
+
+static void
+xfs_rtbuf_verify_write(
+	struct xfs_buf	*bp)
+{
+	return;
+}
+
+const struct xfs_buf_ops xfs_rtbuf_ops = {
+	.name = "rtbuf",
+	.verify_read = xfs_rtbuf_verify_read,
+	.verify_write = xfs_rtbuf_verify_write,
+};
+
 /*
 /*
  * Get a buffer for the bitmap or summary file block specified.
  * Get a buffer for the bitmap or summary file block specified.
  * The buffer is returned read and locked.
  * The buffer is returned read and locked.
@@ -68,7 +93,7 @@ xfs_rtbuf_get(
 	ASSERT(map.br_startblock != NULLFSBLOCK);
 	ASSERT(map.br_startblock != NULLFSBLOCK);
 	error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
 	error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
 				   XFS_FSB_TO_DADDR(mp, map.br_startblock),
 				   XFS_FSB_TO_DADDR(mp, map.br_startblock),
-				   mp->m_bsize, 0, &bp, NULL);
+				   mp->m_bsize, 0, &bp, &xfs_rtbuf_ops);
 	if (error)
 	if (error)
 		return error;
 		return error;
 
 

+ 1 - 0
fs/xfs/libxfs/xfs_shared.h

@@ -53,6 +53,7 @@ extern const struct xfs_buf_ops xfs_dquot_buf_ra_ops;
 extern const struct xfs_buf_ops xfs_sb_buf_ops;
 extern const struct xfs_buf_ops xfs_sb_buf_ops;
 extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops;
 extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops;
 extern const struct xfs_buf_ops xfs_symlink_buf_ops;
 extern const struct xfs_buf_ops xfs_symlink_buf_ops;
+extern const struct xfs_buf_ops xfs_rtbuf_ops;
 
 
 /*
 /*
  * Transaction types.  Used to distinguish types of buffers. These never reach
  * Transaction types.  Used to distinguish types of buffers. These never reach

+ 2 - 2
fs/xfs/xfs_log_recover.c

@@ -2476,8 +2476,8 @@ xlog_recover_validate_buf_type(
 #ifdef CONFIG_XFS_RT
 #ifdef CONFIG_XFS_RT
 	case XFS_BLFT_RTBITMAP_BUF:
 	case XFS_BLFT_RTBITMAP_BUF:
 	case XFS_BLFT_RTSUMMARY_BUF:
 	case XFS_BLFT_RTSUMMARY_BUF:
-		/* no verification of RT buffers is done */
-		bp->b_ops = NULL;
+		/* no magic numbers for verification of RT buffers */
+		bp->b_ops = &xfs_rtbuf_ops;
 		break;
 		break;
 #endif /* CONFIG_XFS_RT */
 #endif /* CONFIG_XFS_RT */
 	default:
 	default: