File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -212,6 +212,10 @@ xfs_rmap_check_irec(
212212 const struct xfs_rmap_irec * irec )
213213{
214214 struct xfs_mount * mp = cur -> bc_mp ;
215+ bool is_inode ;
216+ bool is_unwritten ;
217+ bool is_bmbt ;
218+ bool is_attr ;
215219
216220 if (irec -> rm_blockcount == 0 )
217221 return __this_address ;
@@ -232,6 +236,24 @@ xfs_rmap_check_irec(
232236 irec -> rm_owner >= XFS_RMAP_OWN_MIN )))
233237 return __this_address ;
234238
239+ /* Check flags. */
240+ is_inode = !XFS_RMAP_NON_INODE_OWNER (irec -> rm_owner );
241+ is_bmbt = irec -> rm_flags & XFS_RMAP_BMBT_BLOCK ;
242+ is_attr = irec -> rm_flags & XFS_RMAP_ATTR_FORK ;
243+ is_unwritten = irec -> rm_flags & XFS_RMAP_UNWRITTEN ;
244+
245+ if (is_bmbt && irec -> rm_offset != 0 )
246+ return __this_address ;
247+
248+ if (!is_inode && irec -> rm_offset != 0 )
249+ return __this_address ;
250+
251+ if (is_unwritten && (is_bmbt || !is_inode || is_attr ))
252+ return __this_address ;
253+
254+ if (!is_inode && (is_bmbt || is_unwritten || is_attr ))
255+ return __this_address ;
256+
235257 return NULL ;
236258}
237259
Original file line number Diff line number Diff line change @@ -94,35 +94,13 @@ xchk_rmapbt_rec(
9494 const union xfs_btree_rec * rec )
9595{
9696 struct xfs_rmap_irec irec ;
97- bool non_inode ;
98- bool is_unwritten ;
99- bool is_bmbt ;
100- bool is_attr ;
10197
10298 if (xfs_rmap_btrec_to_irec (rec , & irec ) != NULL ||
10399 xfs_rmap_check_irec (bs -> cur , & irec ) != NULL ) {
104100 xchk_btree_set_corrupt (bs -> sc , bs -> cur , 0 );
105101 return 0 ;
106102 }
107103
108- /* Check flags. */
109- non_inode = XFS_RMAP_NON_INODE_OWNER (irec .rm_owner );
110- is_bmbt = irec .rm_flags & XFS_RMAP_BMBT_BLOCK ;
111- is_attr = irec .rm_flags & XFS_RMAP_ATTR_FORK ;
112- is_unwritten = irec .rm_flags & XFS_RMAP_UNWRITTEN ;
113-
114- if (is_bmbt && irec .rm_offset != 0 )
115- xchk_btree_set_corrupt (bs -> sc , bs -> cur , 0 );
116-
117- if (non_inode && irec .rm_offset != 0 )
118- xchk_btree_set_corrupt (bs -> sc , bs -> cur , 0 );
119-
120- if (is_unwritten && (is_bmbt || non_inode || is_attr ))
121- xchk_btree_set_corrupt (bs -> sc , bs -> cur , 0 );
122-
123- if (non_inode && (is_bmbt || is_unwritten || is_attr ))
124- xchk_btree_set_corrupt (bs -> sc , bs -> cur , 0 );
125-
126104 xchk_rmapbt_xref (bs -> sc , & irec );
127105 return 0 ;
128106}
You can’t perform that action at this time.
0 commit comments