Message ID | 20210309050124.23797-3-chandanrlinux@gmail.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | xfs: Tests to verify inode fork extent count overflow detection | expand |
On Tue, Mar 09, 2021 at 10:31:13AM +0530, Chandan Babu R wrote: > This commit adds the helper _scratch_get_iext_count() which returns an > inode fork's extent count. > > Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com> Looks good now, Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > --- > common/xfs | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/common/xfs b/common/xfs > index 41dd8676..26ae21b9 100644 > --- a/common/xfs > +++ b/common/xfs > @@ -924,6 +924,26 @@ _scratch_get_bmx_prefix() { > return 1 > } > > +_scratch_get_iext_count() > +{ > + local ino=$1 > + local whichfork=$2 > + local field="" > + > + case $whichfork in > + "attr") > + field=core.naextents > + ;; > + "data") > + field=core.nextents > + ;; > + *) > + return 1 > + esac > + > + _scratch_xfs_get_metadata_field $field "inode $ino" > +} > + > # > # Ensures that we don't pass any mount options incompatible with XFS v4 > # > -- > 2.29.2 >
On 3/8/21 10:01 PM, Chandan Babu R wrote: > This commit adds the helper _scratch_get_iext_count() which returns an > inode fork's extent count. > > Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com> Looks ok Reviewed-by: Allison Henderson <allison.henderson@oracle.com> > --- > common/xfs | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/common/xfs b/common/xfs > index 41dd8676..26ae21b9 100644 > --- a/common/xfs > +++ b/common/xfs > @@ -924,6 +924,26 @@ _scratch_get_bmx_prefix() { > return 1 > } > > +_scratch_get_iext_count() > +{ > + local ino=$1 > + local whichfork=$2 > + local field="" > + > + case $whichfork in > + "attr") > + field=core.naextents > + ;; > + "data") > + field=core.nextents > + ;; > + *) > + return 1 > + esac > + > + _scratch_xfs_get_metadata_field $field "inode $ino" > +} > + > # > # Ensures that we don't pass any mount options incompatible with XFS v4 > # >
diff --git a/common/xfs b/common/xfs index 41dd8676..26ae21b9 100644 --- a/common/xfs +++ b/common/xfs @@ -924,6 +924,26 @@ _scratch_get_bmx_prefix() { return 1 } +_scratch_get_iext_count() +{ + local ino=$1 + local whichfork=$2 + local field="" + + case $whichfork in + "attr") + field=core.naextents + ;; + "data") + field=core.nextents + ;; + *) + return 1 + esac + + _scratch_xfs_get_metadata_field $field "inode $ino" +} + # # Ensures that we don't pass any mount options incompatible with XFS v4 #
This commit adds the helper _scratch_get_iext_count() which returns an inode fork's extent count. Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com> --- common/xfs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)