*** ANNOUNCEMENT *** LVM 0.9.1 beta5 available at www.sistina.com
Hi all,
a tarball of the Linux Logical Volume Manager 0.9.1 Beta 5 is available now at
for download (Follow the "LVM download page" link).
This release fixes several bugs.
See the CHANGELOG file contained in the tarball for further information.
A change in the i/o protocoll version *forces* you to update the driver as well.
Follow instructions in PATCHES/README to achieve this please.
Please help us to stabilize for 0.9.1 ASAP and test is as much as possible! Feed back related information to <[email protected]>.
Thanks a lot for your support of LVM.
Signature · 12 lines
Regards,
Heinz -- The LVM Guy --
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Heinz Mauelshagen Sistina Software Inc.
Senior Consultant/Developer Am Sonnenhang 11
56242 Marienrachdorf
Germany
[email protected] +49 2626 141200
FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-Quoted 12 lines · Heinz Mauelshagen
Hi all,
a tarball of the Linux Logical Volume Manager 0.9.1 Beta 5 is available now at
<http://www.sistina.com/>for download (Follow the "LVM download page" link).
This release fixes several bugs.
See the CHANGELOG file contained in the tarball for further information.
Quoted 7 lines
A change in the i/o protocoll version *forces* you to update the driver as well.
Follow instructions in PATCHES/README to achieve this please.Please help us to stabilize for 0.9.1 ASAP and test is as much as possible! Feed back related information to <[email protected]>.
The bheads in the lv_t is the wrong way to go, I just wrote an alternate patch for rawio that keeps the bh inside the kiovec, not in the lv, this also imrproves rawio performance in general (such allocation deallocation flood was wasteful). No a single change is required at the lvm layer, all the changes lives in the kiobuf layer. It's tested and it works for me.
fs/buffer.c +30 -22
@@ -1240,6 +1240,29 @@wake_up (&buffer_wait); } +int alloc_kiobuf_bhs (struct kiobuf * kiobuf) +{ +int i, j; + +for (i =0 ; i <KIO_MAX_SECTORS ; i++) +if (!(kiobuf->bh[i] =get_unused_buffer_head (0 ))) { +for (j =0 ; j < i; j++) +put_unused_buffer_head (kiobuf->bh[j]); +wake_up (&buffer_wait); +return -ENOMEM ; + } +return 0 ; +} + +void free_kiobuf_bhs (struct kiobuf * kiobuf) +{ +int i; + +for (i =0 ; i <KIO_MAX_SECTORS ; i++) +put_unused_buffer_head (kiobuf->bh[i]); +wake_up (&buffer_wait); +} +static void end_buffer_io_async (struct buffer_head * bh,int uptodate) {unsigned long flags;
@@ -1333,10 +1356,8 @@ iosize =0 ; } -put_unused_buffer_head (tmp); iosize += size; } -wake_up (&buffer_wait);dprintk ("do_kio end %d %d\n" , iosize, err);
@@ -1390,7 +1411,7 @@int i;int bufind;int pageind; -int bhind; +int bhind, kiobuf_bh_nr;int offset;unsigned long blocknr;struct kiobuf * iobuf =NULL ;
@@ -1422,6 +1443,7 @@*/ bufind = bhind = transferred = err =0 ;for (i =0 ; i < nr; i++) { + kiobuf_bh_nr =0 ; iobuf = iovec[i]; err =setup_kiobuf_bounce_pages (iobuf,GFP_USER );if (err)
@@ -1444,12 +1466,8 @@while (length >0 ) { blocknr = b[bufind++]; - tmp =get_unused_buffer_head (0 ); -if (!tmp) { - err = -ENOMEM ; - goto error; - } - + tmp = iobuf->bh[kiobuf_bh_nr++]; + tmp->b_dev =B_FREE ; tmp->b_size = size; tmp->b_data = (char *) (page + offset);
@@ -1460,7 +1478,8 @@if (rw ==WRITE ) {set_bit (BH_Uptodate, &tmp->b_state);set_bit (BH_Dirty, &tmp->b_state); - } + }else +clear_bit (BH_Uptodate, &tmp->b_state);dprintk ("buffer %d (%d) at %p\n" , bhind, tmp->b_blocknr, tmp->b_data);
@@ -1478,7 +1497,7 @@ transferred += err; else goto finished; - bhind =0 ; + kiobuf_bh_nr = bhind =0 ; }if (offset >=PAGE_SIZE ) {
@@ -1506,17 +1525,6 @@if (transferred)return transferred;return err; - - error: -/* We got an error allocation the bh'es. Just free the current -buffer_heads and exit. */ -for (i =0 ; i < bhind; i++) -put_unused_buffer_head (bh[i]); -wake_up (&buffer_wait); - -clear_kiobuf_bounce_pages (iobuf); - - goto finished; }/*
fs/iobuf.c +6 -0
@@ -41,6 +41,11 @@ iobuf->pagelist = iobuf->page_array; iobuf->maplist = iobuf->map_array; iobuf->bouncelist = iobuf->bounce_array; +if (alloc_kiobuf_bhs (iobuf)) { +kmem_cache_free (kiobuf_cachep, iobuf); +free_kiovec (i, bufp); +return -ENOMEM ; + } *bufp++ = iobuf; }
@@ -73,6 +78,7 @@if (iobuf->array_len >KIO_STATIC_PAGES ) {kfree (iobuf->pagelist); } +free_kiobuf_bhs (iobuf);kmem_cache_free (kiobuf_cachep, bufp[i]); } }
include/linux/iobuf.h +3 -0
@@ -50,6 +50,7 @@unsigned long page_array[KIO_STATIC_PAGES ];struct page * map_array[KIO_STATIC_PAGES ];unsigned long bounce_array[KIO_STATIC_PAGES ]; +struct buffer_head *bh[KIO_MAX_SECTORS ]; };
@@ -67,6 +68,8 @@int setup_kiobuf_bounce_pages (struct kiobuf *,int gfp_mask);void clear_kiobuf_bounce_pages (struct kiobuf *);void kiobuf_copy_bounce (struct kiobuf *,int direction,int max); +extern int alloc_kiobuf_bhs (struct kiobuf *); +extern void free_kiobuf_bhs (struct kiobuf *);/* Direction codes for kiobuf_copy_bounce: */ enum {
I didn't had much time to look into beta5 yet but I can't see why you changed the protocol to 11. There's no breakage between beta4 and beta5 in the datastructures shared with userspace. I don't like gratuitous API breakage.
Just as reminer the hardsectsize fix isn't yet merged in beta5.
Andrea
Quoted 7 lines · Andrea
Quoted 2 lines · Heinz Mauelshagen
A change in the i/o protocoll version *forces* you to update the driver as well.
I didn't had much time to look into beta5 yet but I can't see why you changed the protocol to 11. There's no breakage between beta4 and beta5 in the datastructures shared with userspace. I don't like gratuitous API breakage.
The reason why the IOP was changed was because the VG_CREATE ioctl now depends on the vg_number in the supplied vg_t to determine which VG minor number to use. The old interface used the minor number of the opened device inode, but for devfs the device inodes don't exist until the VG is created... If you run an older kernel with new tools, you can only use the first VG.
I suggested reverting this change for the current release, and only fixing the LVM devfs code (which is probably still broken in other ways). Heinz decided to update the IOP instead. Note that with the new library build, it is possible to have multiple IOP tools installed at the same time, and the correct ones are chosen at runtime based on the kernel IOP.
Cheers, Andreas
Signature · 3 lines
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- DogbertQuoted 6 lines · Andreas Dilger
The reason why the IOP was changed was because the
VG_CREATEioctl now depends on thevg_numberin the suppliedvg_tto determine which VG minor number to use. The old interface used the minor number of the opened device inode, but for devfs the device inodes don't exist until the VG is created... If you run an older kernel with new tools, you can only use the first VG.
Ah, I was reading the patch incidentally against 2.2 patch where devfs support is not included, so I wasn't thinking the devfs way ;). Thanks for the explanation.
I assume it's not possible to mknod on top of devfs. So then we could use a temporary device in /var/tmp or whatever for that. However those workarounds tends to be ugly.
Probably the best way to preserve the IOP that I recommend for beta6 is to add a new ioctl to the VG chardevice. Rename VG_CREATE to VG_CREATE_OLD. VG_CREATE_OLD is a wrapper that calculates the minor number from the inode and then fallbacks into VG_CREATE, and the new VG_CREATE is the one that gets the minor of the vg from userspace.
Either ways we don't break backwards compatibilty across 0.9* cycle.
If there would been a strong reason and it would be a mess to provide backwards compatibilty I would of course agree to raise at IOP 11, but just to avoid a few lines of code for a wrapper or a temporary mknod on /tmp for a devfs-only fix, I think it worth to preserve IOP 10.
Andrea
Quoted 8 lines · Andrea Arcangeli
Quoted 6 lines · Andreas Dilger
The reason why the IOP was changed was because the
VG_CREATEioctl now depends on thevg_numberin the suppliedvg_tto determine which VG minor number to use. The old interface used the minor number of the opened device inode, but for devfs the device inodes don't exist until the VG is created... If you run an older kernel with new tools, you can only use the first VG.
Quoted 7 lines
Ah, I was reading the patch incidentally against 2.2 patch where devfs support is not included, so I wasn't thinking the devfs way ;). Thanks for the explanation.
I assume it's not possible to mknod on top of devfs. So then we could use a temporary device in
/var/tmpor whatever for that. However those workarounds tends to be ugly.
You definately can mknod(2) on devfs.
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Quoted 1 line · Richard Gooch
You definately can mknod(2) on devfs. [..]
So then why don't we simply create the VG ourself with the right minor number and use it as we do without devfs? We'll still have a global 256 VG limit this way but that's not a minor issue.
Andrea
[LVM list removed so I don't get the nastygram]
Quoted 6 lines · Andrea Arcangeli
Quoted 1 line · Richard Gooch
You definately can mknod(2) on devfs. [..]
So then why don't we simply create the VG ourself with the right minor number and use it as we do without devfs? We'll still have a global 256 VG limit this way but that's not a minor issue.
Erm, that's a good question. Since I don't know the background to this thread, can someone fill me in on what the problem/issue is?
Regards, Richard.... Permanent: [email protected] Current: [email protected]
Quoted 6 lines · In article <[email protected]> you wrote:
Quoted 1 line · Richard Gooch
You definately can mknod(2) on devfs. [..]
So then why don't we simply create the VG ourself with the right minor number and use it as we do without devfs? We'll still have a global 256 VG limit this way but that's not a minor issue.
Yes - that's how I did it in my inital LVM & devfs patches. It would be really good to have something devfs-like just for LVM in setups that don't use LVM, so we could avoid mounting root read/write for device-creation.
One of the stronger points for a per-driver devfs, IHMO.
Christoph
Signature · 1 line
Of course it doesn't work. We've performed a software upgrade.
[Christoph Hellwig]
Quoted 2 lines
It would be really good to have something devfs-like just for LVM in setups that don't use LVM, so we could avoid mounting root read/write
^^^devfs?
Quoted 1 line
for device-creation.
For most people, read/write access to /dev is rarely needed -- how often do you create new VGs or LVs? How often do you run MAKEDEV or vgscan? Sometimes you need to change tty inodes but that's what /dev/pts is for.
If you do need read-write access to /dev but not /, put it on a separate filesystem. Leave just a skeletal /dev in your root filesystem, enough to bootstrap.
Peter
Quoted 5 lines · Peter Samuelson
[Christoph Hellwig]
Quoted 2 lines
It would be really good to have something devfs-like just for LVM in setups that don't use LVM, so we could avoid mounting root read/write
^^^devfs?
Yes...
Quoted 5 lines
Quoted 1 line
for device-creation.
For most people, read/write access to /dev is rarely needed -- how often do you create new VGs or LVs? How often do you run MAKEDEV or vgscan?
On every bootup, _before_ doing mount -a
Christoph
Signature · 1 line
Of course it doesn't work. We've performed a software upgrade.
[Peter Samuelson]
Quoted 1 line
Quoted 1 line
How often do you run MAKEDEV or vgscan?
[Christoph Hellwig]
Quoted 1 line
On every bootup, _before_ doing mount -a
A mere 'vgchange -ay' works fine for *my* boot processes. Is there a particular reason to do 'vgscan' every time? (I'm not arguing -- just wondering.)
Peter
Quoted 10 lines · Peter Samuelson
[Peter Samuelson]
Quoted 1 line
Quoted 1 line
How often do you run MAKEDEV or vgscan?
[Christoph Hellwig]
Quoted 1 line
On every bootup, _before_ doing mount -a
A mere 'vgchange -ay' works fine for *my* boot processes. Is there a particular reason to do 'vgscan' every time? (I'm not arguing -- just wondering.)
It is that what is suggested by the LVM crew. I have also tried to use it without vgscan - it work then and whenn, but not 100% percent reliable.
Christoph
Signature · 2 lines
Of course it doesn't work. We've performed a software upgrade. Whip me. Beat me. Make me maintain AIX.
[linux-lvm] snapshot of Reiserfs
In reply to Heinz J. MauelshagenQuoted 3 lines · Heinz J. Mauelshagen
... Linux Logical Volume Manager 0.9.1 Beta 5 is available now ...
...
Please help us to stabilize for 0.9.1 ASAP and test is as much as possible!
I am using LVM 0.9.1 beta 5 on Linux 2.4.1 with Reiserfs. I have applied both of the following patches:
0.9.1_beta5/PATCHES/lvm-0.9.1_beta5-2.4.1.patch0.9.1_beta5/PATCHES/linux-2.4.1-VFS-lock.patch
Snapshots created when the filesystem is active cannot be mounted. If I `umount' the filesystem before creating the snapshot, all is well.
Larry
Re: [linux-lvm] snapshot of Reiserfs
Quoted 5 lines · On Tue, Feb 20, 2001 at 11:19:51PM -0500, [email protected] wrote:
Quoted 3 lines · Heinz J. Mauelshagen
... Linux Logical Volume Manager 0.9.1 Beta 5 is available now ...
...
Please help us to stabilize for 0.9.1 ASAP and test is as much as possible!
Quoted 8 lines
I am using LVM 0.9.1 beta 5 on Linux 2.4.1 with Reiserfs. I have applied both of the following patches:
0.9.1_beta5/PATCHES/lvm-0.9.1_beta5-2.4.1.patch0.9.1_beta5/PATCHES/linux-2.4.1-VFS-lock.patchSnapshots created when the filesystem is active cannot be mounted. If I `umount' the filesystem before creating the snapshot, all is well.
Did you remember to uncomment LVM_VFS_ENHANCEMENT in lvm.c ?
patrick
Re: [linux-lvm] snapshot of Reiserfs
Quoted 18 lines · Patrick Caulfield
From: Patrick Caulfield <[email protected]>
Sender: [email protected]
To: [email protected]
Subject: Re: [linux-lvm] snapshot of Reiserfs
Date: Wed, 21 Feb 2001 08:59:59 +0000Quoted 11 lines · On Tue, Feb 20, 2001 at 11:19:51PM -0500, [email protected] wrote:
Quoted 3 lines · Heinz J. Mauelshagen
... Linux Logical Volume Manager 0.9.1 Beta 5 is available now ...
...
Please help us to stabilize for 0.9.1 ASAP and test is as much as possible!I am using LVM 0.9.1 beta 5 on Linux 2.4.1 with Reiserfs. I have applied both of the following patches:
0.9.1_beta5/PATCHES/lvm-0.9.1_beta5-2.4.1.patch0.9.1_beta5/PATCHES/linux-2.4.1-VFS-lock.patch
Quoted 6 lines
Quoted 2 lines
Snapshots created when the filesystem is active cannot be mounted. If I `umount' the filesystem before creating the snapshot, all is well.
Did you remember to uncomment
LVM_VFS_ENHANCEMENTinlvm.c?patrick
Bingo! That was the problem! Many thanks!
Shouldn't that change be included in the VFS-lock patch?
In fact, why are these separate patches? Shouldn't they eventually be "the standard" and find their way into the stock kernel? It's arguably the correct behavior.
Larry
Re: [linux-lvm] snapshot of Reiserfs
Quoted 22 lines · On Wed, Feb 21, 2001 at 09:04:32AM -0500, [email protected] wrote:
Quoted 21 lines · Patrick Caulfield
From: Patrick Caulfield <[email protected]>
Sender: [email protected]
To: [email protected]
Subject: Re: [linux-lvm] snapshot of Reiserfs
Date: Wed, 21 Feb 2001 08:59:59 +0000Quoted 13 lines · On Tue, Feb 20, 2001 at 11:19:51PM -0500, [email protected] wrote:
Quoted 3 lines · Heinz J. Mauelshagen
... Linux Logical Volume Manager 0.9.1 Beta 5 is available now ...
...
Please help us to stabilize for 0.9.1 ASAP and test is as much as possible!I am using LVM 0.9.1 beta 5 on Linux 2.4.1 with Reiserfs. I have applied both of the following patches:
0.9.1_beta5/PATCHES/lvm-0.9.1_beta5-2.4.1.patch0.9.1_beta5/PATCHES/linux-2.4.1-VFS-lock.patchSnapshots created when the filesystem is active cannot be mounted. If I `umount' the filesystem before creating the snapshot, all is well.
Quoted 7 lines
Quoted 3 lines
Did you remember to uncomment
LVM_VFS_ENHANCEMENTinlvm.c?patrick
Bingo! That was the problem! Many thanks!
Shouldn't that change be included in the VFS-lock patch?
It complicates the order of applying them but it's a fair point.
Quoted 3 lines
In fact, why are these separate patches? Shouldn't they eventually be "the standard" and find their way into the stock kernel? It's arguably the correct behavior.
That is the intension. The patch is Chris Mason's and I beleive he is trying to get it into the kernel. Heinz emailed him about it recently, I don't know if he has had any reply yet.
Patrick
Re: [linux-lvm] snapshot of Reiserfs
On Wednesday, February 21, 2001 02:11:20 PM +0000 Patrick Caulfield <[email protected]> wrote:
[ non-intuitive snapshot patches for reiserfs ]
Quoted 9 lines
Quoted 4 lines
In fact, why are these separate patches? Shouldn't they eventually be "the standard" and find their way into the stock kernel? It's arguably the correct behavior.
That is the intension. The patch is Chris Mason's and I beleive he is trying to get it into the kernel. Heinz emailed him about it recently, I don't know if he has had any reply yet.
We can probably talk Alan into putting it in the ac series, but I'm not expecting Linus to take it yet. I'll send it along for 2.4.3preX though (once 2.4.2 comes out), maybe we'll get lucky ;-)
Do you want the patch I send to turn on the VFS_ENHANCEMENT #define in lvm.c?
-chris
Re: [linux-lvm] snapshot of Reiserfs
Quoted 1 line · Chris Mason
Do you want the patch I send to turn on the
VFS_ENHANCEMENT#define inlvm.c?
That seems to make sense. After all, the purpose of the patch is to add that support. Leaving it disabled after applying the patch is counterintuitive.
Larry
Re: [linux-lvm] snapshot of Reiserfs
In reply to Chris MasonQuoted 11 lines · Chris Mason
On Wednesday, February 21, 2001 02:11:20 PM +0000 Patrick Caulfield <[email protected]> wrote:
[ non-intuitive snapshot patches for reiserfs ]
Quoted 5 lines
Quoted 4 lines
In fact, why are these separate patches? Shouldn't they eventually be "the standard" and find their way into the stock kernel? It's arguably the correct behavior.
Quoted 8 lines
Quoted 4 lines
That is the intension. The patch is Chris Mason's and I beleive he is trying to get it into the kernel. Heinz emailed him about it recently, I don't know if he has had any reply yet.
We can probably talk Alan into putting it in the ac series, but I'm not expecting Linus to take it yet. I'll send it along for 2.4.3preX though (once 2.4.2 comes out), maybe we'll get lucky ;-)
That sounds reasonable. With reiserfs and LVM in the kerel I thing there's a good argument for making them work well together. :-)
Quoted 2 lines
Do you want the patch I send to turn on the
VFS_ENHANCEMENT#define inlvm.c?
I suppose it would be the easiest thing for users. Now LVM 0.9 is part of the standard kernel it means the patches can be applied in any order, which was my initial concern.
patrick
Re: [linux-lvm] snapshot of Reiserfs
In reply to Patrick CaulfieldQuoted 11 lines · Patrick
Quoted 8 lines · On Tue, Feb 20, 2001 at 11:19:51PM -0500, [email protected] wrote:
I am using LVM 0.9.1 beta 5 on Linux 2.4.1 with Reiserfs. I have applied both of the following patches:
0.9.1_beta5/PATCHES/lvm-0.9.1_beta5-2.4.1.patch0.9.1_beta5/PATCHES/linux-2.4.1-VFS-lock.patchSnapshots created when the filesystem is active cannot be mounted. If I `umount' the filesystem before creating the snapshot, all is well.
Did you remember to uncomment
LVM_VFS_ENHANCEMENTinlvm.c?
Given that the VFS support for the *unlockfs methods is included in 2.4.1, this should probably become something like:
/* lvm_do_lv_create calls fsync_dev_lockfs()/unlockfs() */ #if LINUX_KERNEL_VERSION >= KERNEL_VERSION(2,4,1)
#define LVM_VFS_ENHANCEMENT
#else
/* Need to apply a kernel patch to add lockfs/unlockfs VFS methods */
/* #define LVM_VFS_ENHANCEMENT */
#endif
Also, if the sync_supers_lockfs() method is changed to call write_super() if write_super_lockfs() doesn't exist, like:
lock_super(sb);
if (sb->s_dev && (!dev || dev == sb->s_dev))
- if (sb->s_op && sb->s_op->write_super_lockfs)
- sb->s_op->write_super_lockfs(sb);
+ if (sb->s_op) {
+ if (sb->s_op->write_super_lockfs)
+ sb->s_op->write_super_lockfs(sb);
+ else if (sb->s_op->write_super)
+ sb->s_op->write_super(sb);
+ }
unlock_super(sb); }
then in lvm_do_lv_create we only need to call either fsync_dev() OR fsync_dev_lockfs(), instead of calling both like is currently done.
#ifdef LVM_VFS_ENHANCEMENT /* VFS call to sync and lock the filesystem (if possible) */ fsync_dev_lockfs(org->lv_dev); #else /* sync the original logical volume */ fsync_dev(org->lv_dev);
#endif
Cheers, Andreas
Signature · 3 lines
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- DogbertRe: [linux-lvm] snapshot of Reiserfs
Quoted 11 lines · On Wednesday, February 21, 2001 09:44:39 AM -0700 Andreas Dilger…
Given that the VFS support for the *unlockfs methods is included in 2.4.1, this should probably become something like:
/*
lvm_do_lv_createcalls fsync_dev_lockfs()/unlockfs() */ #ifLINUX_KERNEL_VERSION>=KERNEL_VERSION(2,4,1)
#defineLVM_VFS_ENHANCEMENT
#else
/* Need to apply a kernel patch to add lockfs/unlockfs VFS methods */
/* #defineLVM_VFS_ENHANCEMENT*/
#endif
I like this idea.
Quoted 3 lines
Also, if the
sync_supers_lockfs()method is changed to callwrite_super()ifwrite_super_lockfs()doesn't exist, like:
The fsync_dev_lockfs call does this for us, if there is no write_super_lockfs provided, fsync_dev_lockfs is effectively the same as calling fsync_dev.
-chris
Re: [linux-lvm] snapshot of Reiserfs
Chris, you write:
Quoted 14 lines
Quoted 11 lines · On Wednesday, February 21, 2001 09:44:39 AM -0700 Andreas Dilger…
Given that the VFS support for the *unlockfs methods is included in 2.4.1, this should probably become something like:
/*
lvm_do_lv_createcalls fsync_dev_lockfs()/unlockfs() */ #ifLINUX_KERNEL_VERSION>=KERNEL_VERSION(2,4,1)
#defineLVM_VFS_ENHANCEMENT
#else
/* Need to apply a kernel patch to add lockfs/unlockfs VFS methods */ /* #defineLVM_VFS_ENHANCEMENT*/
#endif
Quoted 1 line
I like this idea.
Note that I thought the fsync_dev_lockfs() code was added to 2.4.1 when reiserfs was added. However, it appears that only the *lockfs pointers were added to the super_operations, and the actual code that uses them was NOT added. This means we can't do the above until fsync_dev_lockfs() is actually there.
Quoted 6 lines
Quoted 2 lines
Also, if the
sync_supers_lockfs()method is changed to callwrite_super()ifwrite_super_lockfs()doesn't exist, like:The
fsync_dev_lockfscall does this for us, if there is nowrite_super_lockfsprovided,fsync_dev_lockfsis effectively the same as callingfsync_dev.
Except that fsync_dev() calls the write_super() method, and fsync_dev_lockfs() only calls the write_super_lockfs() method if it exists - it does not call write_super() if write_super_lockfs() does not exist. If it were changed as I suggest, then the two would be the same.
Cheers, Andreas
Signature · 3 lines
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- DogbertRe: [linux-lvm] snapshot of Reiserfs
Quoted 12 lines · On Wednesday, February 21, 2001 11:55:14 AM -0700 Andreas Dilger…
Quoted 12 lines
Quoted 11 lines
Given that the VFS support for the *unlockfs methods is included in 2.4.1, this should probably become something like:
/*
lvm_do_lv_createcalls fsync_dev_lockfs()/unlockfs() */ #ifLINUX_KERNEL_VERSION>=KERNEL_VERSION(2,4,1)
#defineLVM_VFS_ENHANCEMENT
#else
/* Need to apply a kernel patch to add lockfs/unlockfs VFS methods */ /* #defineLVM_VFS_ENHANCEMENT*/
#endif
Quoted 8 lines
Quoted 1 line
I like this idea.
Note that I thought the
fsync_dev_lockfs()code was added to 2.4.1 when reiserfs was added. However, it appears that only the *lockfs pointers were added to thesuper_operations, and the actual code that uses them was NOT added. This means we can't do the above untilfsync_dev_lockfs()is actually there.
Yes, it would have been smarter for me to push for the entire lockfs patch a long time ago.
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
Also, if the
sync_supers_lockfs()method is changed to callwrite_super()ifwrite_super_lockfs()doesn't exist, like:The
fsync_dev_lockfscall does this for us, if there is nowrite_super_lockfsprovided,fsync_dev_lockfsis effectively the same as callingfsync_dev.Except that
fsync_dev()calls thewrite_super()method, andfsync_dev_lockfs()only calls thewrite_super_lockfs()method if it exists - it does not callwrite_super()ifwrite_super_lockfs()does not exist. If it were changed as I suggest, then the two would be the same.
Hmmm, fsync_dev_lockfs should look like this:
+int fsync_dev_lockfs(kdev_t dev)
+{
+ sync_buffers(dev, 0);
+
+ lock_kernel();
+ sync_supers(dev);
^^^^^^^^^^^^^^^^^^
+ /* note, the FS might need to start transactions to
+ ** sync the inodes, or the quota, no locking until
+ ** after these are done
+ */
+ sync_inodes(dev);
+ DQUOT_SYNC(dev);
+ /* if inodes or quotas could be dirtied during the
+ ** sync_supers_lockfs call, the FS is responsible for getting
+ ** them on disk, without deadlocking against the lock
+ */
+ sync_supers_lockfs(dev) ;
+ unlock_kernel();
+
+ return sync_buffers(dev, 1) ;
+}
+
It is amost exactly a cut n' paste of fsync_dev, with an extra call to sync_supers_lockfs. It should do what fsync_dev does, even when there are no sync_super_lockfs methods are provided. The only reason I didn't just call fsync_dev from fsync_dev_lockfs is because I wanted the sync_buffers call to happen after the lockfs call ;-)
-chris
Re: [linux-lvm] snapshot of Reiserfs
Quoted 15 lines · Chris Mason
Hmmm,
fsync_dev_lockfsshould look like this:(quoted diff) +11
-0+int fsync_dev_lockfs(kdev_t dev) +{ + sync_buffers(dev, 0); + + lock_kernel(); + sync_supers(dev); ^^^^^^^^^^^^^^^^^^ + /* note, the FS might need to start transactions to + ** sync the inodes, or the quota, no locking until + ** after these are done + */ + sync_inodes(dev);
Review
Quoted 10 lines
(quoted diff) +10
-0+ DQUOT_SYNC(dev); + /* if inodes or quotas could be dirtied during the + ** sync_supers_lockfs call, the FS is responsible for getting + ** them on disk, without deadlocking against the lock + */ + sync_supers_lockfs(dev) ; + unlock_kernel(); + + return sync_buffers(dev, 1) ; +}
Some overhead in calling sync_supers() and sync_supers_lockfs() because they do both do the same list traversal. Granted, on most systems the total number of superblocks is small... Last time I had a look at this, I suggested that the sync_supers_lockfs() call be changed, namely that it is illegal to call it with a zero "dev" parameter, otherwise you will lock all filesystems and that may be a bad thing. This simplifies the code a bit. If we also have it call write_super() if write_super_lockfs() is missing, it is better yet.
Quoted 5 lines
It is amost exactly a cut n' paste of
fsync_dev, with an extra call tosync_supers_lockfs. It should do whatfsync_devdoes, even when there are nosync_super_lockfsmethods are provided. The only reason I didn't just callfsync_devfromfsync_dev_lockfsis because I wanted thesync_bufferscall to happen after the lockfs call ;-)
And the reason for this is? The first call to sync_buffers doesn't wait on completion (unlike the second sync_buffers call), so there is no guarantee that they are all written out.
Cheers, Andreas
Signature · 3 lines
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- DogbertRe: [linux-lvm] snapshot of Reiserfs
Quoted 10 lines · On Wednesday, February 21, 2001 04:23:51 PM -0700 Andreas Dilger…
Some overhead in calling
sync_supers()andsync_supers_lockfs()because they do both do the same list traversal. Granted, on most systems the total number of superblocks is small... Last time I had a look at this, I suggested that thesync_supers_lockfs()call be changed, namely that it is illegal to call it with a zero "dev" parameter, otherwise you will lock all filesystems and that may be a bad thing. This simplifies the code a bit. If we also have it callwrite_super()ifwrite_super_lockfs()is missing, it is better yet.
It might be a stupid thing for the caller to do, but it should still work. If I tried really hard, I might be able to think of some kind of clustering deal where we wanted to checkpoint the current system and move it onto another machine. It would be a stretch though ;-)
Quoted 9 lines
Quoted 5 lines
It is amost exactly a cut n' paste of
fsync_dev, with an extra call tosync_supers_lockfs. It should do whatfsync_devdoes, even when there are nosync_super_lockfsmethods are provided. The only reason I didn't just callfsync_devfromfsync_dev_lockfsis because I wanted thesync_bufferscall to happen after the lockfs call ;-)And the reason for this is? The first call to
sync_buffersdoesn't wait on completion (unlike the secondsync_bufferscall), so there is no guarantee that they are all written out.
The reason was to avoid a second call to sync_buffers that does wait on completion....
You make some very good points. The goal behind the existing call was to do this:
1) flush as much as you can (inodes, supers, quotas, trigger buffer flushes)
2) ask the FS to lock itself.
3) make sure all dirty buffers are on disk
#2 might involve another set of flushes for anything that was modified between #1 and the lock. The FS is resonsible for this, since it might have odd/complicated ways to figure out what is dirty (inodes under reiserfs).
#3 is not allowed to deadlock against the FS lock, and it must go after the lock to prevent new buffers from being dirtied after the sync.
Yes, this means scanning the list of supers twice, but I think it provides a good mix of responsibilities between fsync_dev_lockfs call and the FS. Any ideas on cleaning this up further are more than welcome.
-chris