Re: online resizing of devices/filesystems (2.6)

From: Andrew Morton
Date: Fri Oct 17 2003 - 15:07:29 EST


Kevin Corry <kevcorry@xxxxxxxxxx> wrote:
>
> On August 21, 2003, Joe Thornber wrote:
> > Hi,
> >
> > Should genhd.h:set_capacity() find and update the i_size field of the
> > inode for the device ?
> >
> > The BLKGETSIZE and BLKGETSIZE64 ioctls report the size in the devices
> > inode:
> >
> > case BLKGETSIZE:
> > if ((bdev->bd_inode->i_size >> 9) > ~0UL)
> > return -EFBIG;
> > return put_ulong(arg, bdev->bd_inode->i_size >> 9);
> > case BLKGETSIZE64:
> > return put_u64(arg, bdev->bd_inode->i_size);
> >
> > Currently people have to close and reopen the device in order for a
> > size change to take effect. This is a problem if people want to do
> > online resizing of a filesystem (supported by xfs and resier).
>
> Has anyone had any thoughts about this issue?

Resizing a blockdev while someone has a filesystem mounted on it is a bit
rude, but I guess that as long as it is being expanded, not much can go
wrong.

bd_set_size() isn't quite what you want because it fiddles with the
blocksize as well.

So one approach would be to do what NBD does, and just write i_size directly.

You could create a little helper library function which takes i_sem and
then writes i_size. But the VFS tends to avoid taking i_sem on blockdevs
because it doesn't expect i_size to change ;)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/