Re: [PATCH] fstests: btrfs/002: fix the OOM caused by too large block size

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]





在 2024/10/22 21:54, Anand Jain 写道:

looks good.
Nits:

For 64K sector size, the BLKS is 512, and BLKS is 128 (one 64K sector).
                                             ^^ NBLKS

$FALLOC is the correct value of 64K (10K rounded up to 64K).


Not sure what you meant here. More below.

I just mean the old $FALLOC value is 64K, which is correct.

I didn't see anything confusing here, I was explaining each variable involved.



diff --git a/tests/btrfs/002 b/tests/btrfs/002
index f223cc60..0c231b89 100755
--- a/tests/btrfs/002
+++ b/tests/btrfs/002
@@ -70,19 +70,14 @@ _read_modify_write()
  _fill_blk()
  {
      local FSIZE
-    local BLKS
-    local NBLK
-    local FALLOC
-    local WS
+    local NEWSIZE
      for i in `find /$1 -type f`
      do
          FSIZE=`stat -t $i | cut -d" " -f2`
-        BLKS=`stat -c "%B" $i`
-        NBLK=`stat -c "%b" $i`
-        FALLOC=$(($BLKS * $NBLK))
-        WS=$(($FALLOC - $FSIZE))
-        _ddt of=$i oseek=$FSIZE obs=$WS count=1 status=noxfer 2>/dev/ null &


+        NEWSIZE=$(( ($FSIZE + $blksize -1 ) / $blksize * $blksize ))


Please add extra ( ) otherwise it is very confusing.

    NEWSIZE=$(( (($FSIZE + $blksize -1 ) / $blksize) * $blksize ))

I didn't see how it's confusing.

It's the very basic round down, and I didn't see any kernel code doing extra () just for round down.

Thanks,
Qu



+
+        $XFS_IO_PROG -c "pwrite -i /dev/urandom $FSIZE $(( $NEWSIZE - $FSIZE ))" $i > /dev/null &



Reviewed-by: Anand Jain <anand.jain@xxxxxxxxxx>


Thanks, Anand





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux