public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: loop device broken in 2.4.6-pre5
@ 2001-06-26 10:41 Andries.Brouwer
  2001-06-26 10:52 ` Rogier Wolff
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Andries.Brouwer @ 2001-06-26 10:41 UTC (permalink / raw)
  To: jari.ruusu, torvalds; +Cc: Andries.Brouwer, R.E.Wolff, axboe, linux-kernel

    From jari.ruusu@pp.inet.fi Tue Jun 26 10:20:51 2001

    This patch fixes the problem. Please consider applying.

    --- linux-2.4.6-pre5/drivers/block/loop.c    Sat Jun 23 07:52:39 2001
    +++ linux/drivers/block/loop.c    Tue Jun 26 09:21:47 2001
    @@ -653,7 +653,7 @@
         bs = 0;
         if (blksize_size[MAJOR(lo_device)])
             bs = blksize_size[MAJOR(lo_device)][MINOR(lo_device)];
    -    if (!bs)
    +    if (!bs || S_ISREG(inode->i_mode))
             bs = BLOCK_SIZE;
     
         set_blocksize(dev, bs);

But why 1024? Next week your neighbour comes and has a file-backed
loop device with an odd number of 512-byte sectors.
If you want a guarantee, then I suppose one should pick 512.
(Or make the set blocksize ioctl also work on loop devices.)

Andries

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: loop device broken in 2.4.6-pre5
@ 2001-06-26 13:31 Andries.Brouwer
  0 siblings, 0 replies; 11+ messages in thread
From: Andries.Brouwer @ 2001-06-26 13:31 UTC (permalink / raw)
  To: Andries.Brouwer, R.E.Wolff; +Cc: axboe, jari.ruusu, linux-kernel, torvalds

Rogier Wolff writes:

>> But why 1024?
>> (Or make the set blocksize ioctl also work on loop devices.)

> I thought the change was a "quick hack" that would make stuff work
> (page cache?) near the end of the file. That would mean that this kind
> of "quick hack" won't work. 

I am not sure I can parse your sentence.
But:

# blockdev --getbsz /dev/loop1
0
# dd if=/dev/zero of=tenbl bs=1024 count=10
10+0 records in
10+0 records out
# losetup /dev/loop1 tenbl
# blockdev --getbsz /dev/loop1
4096
# dd if=/dev/zero of=/dev/loop1 bs=1024 count=10
dd: writing `/dev/loop1': No space left on device
9+0 records in
8+0 records out
# blockdev --setbsz 2048 /dev/loop1
# blockdev --getbsz /dev/loop1
2048
# dd if=/dev/zero of=/dev/loop1 bs=1024 count=10
10+0 records in
10+0 records out
#

Andries

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: loop device broken in 2.4.6-pre5
@ 2001-06-21 22:58 Andries.Brouwer
  2001-06-22 13:59 ` Jari Ruusu
  2001-06-25 16:31 ` Rogier Wolff
  0 siblings, 2 replies; 11+ messages in thread
From: Andries.Brouwer @ 2001-06-21 22:58 UTC (permalink / raw)
  To: jari.ruusu, torvalds; +Cc: axboe, linux-kernel

    From: Jari Ruusu <jari.ruusu@pp.inet.fi>

    File backed loop device on 4k block size ext2 filesystem:

    # dd if=/dev/zero of=file1 bs=1024 count=10
    10+0 records in
    10+0 records out
    # losetup /dev/loop0 file1
    # dd if=/dev/zero of=/dev/loop0 bs=1024 count=10 conv=notrunc
    dd: /dev/loop0: No space left on device
    9+0 records in
    8+0 records out
    # tune2fs -l /dev/hda1 2>&1| grep "Block size"
    Block size:               4096
    # uname -a
    Linux debian 2.4.6-pre5 #1 Thu Jun 21 14:27:25 EEST 2001 i686 unknown

    Stock 2.4.5 and 2.4.5-ac15 don't have this problem.

I am not sure there is an error here.

The default block size of a loop device is that of the underlying device.
There was a kernel bug that was recently fixed, where the block size
of a file backed loop device could be essentially random.
So, earlier you happened to get blocksize 1024, and you had room for
10 blocks of size 1024.
Now you have blocksize 4096, and you have room for 2 blocks of size 4096.
There are no fractional blocks at the end of a block device.

Andries

^ permalink raw reply	[flat|nested] 11+ messages in thread
* loop device broken in 2.4.6-pre5
@ 2001-06-21 16:43 Jari Ruusu
  0 siblings, 0 replies; 11+ messages in thread
From: Jari Ruusu @ 2001-06-21 16:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jens Axboe, linux-kernel

File backed loop device on 4k block size ext2 filesystem:

debian:/root # dd if=/dev/zero of=file1 bs=1024 count=10
10+0 records in
10+0 records out
debian:/root # losetup /dev/loop0 file1
debian:/root # dd if=/dev/zero of=/dev/loop0 bs=1024 count=10 conv=notrunc
dd: /dev/loop0: No space left on device                   <=====ERROR=====
9+0 records in
8+0 records out
debian:/root # tune2fs -l /dev/hda1 2>&1| grep "Block size"
Block size:               4096
debian:/root # uname -a
Linux debian 2.4.6-pre5 #1 Thu Jun 21 14:27:25 EEST 2001 i686 unknown

Stock 2.4.5 and 2.4.5-ac15 don't have this problem.

Regards,
Jari Ruusu <jari.ruusu@pp.inet.fi>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-06-27 11:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-26 10:41 loop device broken in 2.4.6-pre5 Andries.Brouwer
2001-06-26 10:52 ` Rogier Wolff
2001-06-26 17:59 ` Jari Ruusu
2001-06-26 19:14 ` Anton Altaparmakov
2001-06-27 11:54   ` Jari Ruusu
  -- strict thread matches above, loose matches on Subject: below --
2001-06-26 13:31 Andries.Brouwer
2001-06-21 22:58 Andries.Brouwer
2001-06-22 13:59 ` Jari Ruusu
2001-06-26  8:18   ` Jari Ruusu
2001-06-25 16:31 ` Rogier Wolff
2001-06-21 16:43 Jari Ruusu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox