LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/cach ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-01-29 23:45:48
Modified files:
. : WHATS_NEW lib/cache : lvmcache.c lvmcache.h lib/device : dev-io.c
lib/format_text: archiver.c format-text.c
lib/label : label.c
lib/report : report.c
Log message:
Rely upon internally-cached PV labels while corresponding VG lock is held.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.781&r2=1.782
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.h.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-io.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/archiver.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.85&r2=1.86
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/label/label.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.33 - =================================== + Rely upon internally-cached PV labels while corresponding VG lock is held. Version 2.02.32 - 29th January 2008 ===================================
lib/cache/lvmcache.c +66 -8
140 lines not on this page · raw message
lib/cache/lvmcache.h +1 -1
@@ -86,7 +86,7 @@struct lvmcache_vginfo *vginfo_from_vgname (const char *vgname,const char *vgid);struct lvmcache_vginfo *vginfo_from_vgid (const char *vgid); -struct lvmcache_info *info_from_pvid (const char *pvid); +struct lvmcache_info *info_from_pvid (const char *pvid,int valid_only);const char *vgname_from_vgid (struct dm_pool *mem,const char *vgid);struct device *device_from_pvid (struct cmd_context *cmd,struct id *pvid);int vgs_locked (void );
lib/device/dev-io.c +1 -1
@@ -523,7 +523,7 @@/* Close unless device is known to belong to a locked VG */ if (immediate || (dev->open_count <1 && - (!(info =info_from_pvid (dev->pvid)) || + (!(info =info_from_pvid (dev->pvid,0 )) || !info->vginfo || !vgname_is_locked (info->vginfo->vgname))))_close (dev);
lib/format_text/archiver.c +1 -1
@@ -305,7 +305,7 @@/* Add any metadata areas on the PVs */ list_iterate_items(pvl, &vg->pvs) { pv = pvl->pv; -if (!(info =info_from_pvid (pv->dev->pvid))) { +if (!(info =info_from_pvid (pv->dev->pvid,0 ))) {log_error ("PV %s missing from cache" ,pv_dev_name (pv));return 0 ;
lib/format_text/format-text.c +2 -2
@@ -391,7 +391,7 @@ } error: -if ((info =info_from_pvid (dev_area->dev->pvid))) +if ((info =info_from_pvid (dev_area->dev->pvid,0 )))lvmcache_update_vgname_and_id (info,ORPHAN ,ORPHAN ,0 ,NULL );return NULL ;
@@ -1610,7 +1610,7 @@/* If new vg, add any further mdas on this PV to the fid's mda list */ if (vg) {/* Iterate through all mdas on this PV */ -if ((info =info_from_pvid (pv->dev->pvid))) { +if ((info =info_from_pvid (pv->dev->pvid,0 ))) { pvmdas = &info->mdas; list_iterate_items(mda, pvmdas) { mda_count++;
lib/label/label.c +9 -4
@@ -179,7 +179,7 @@ out:if (!found) { -if ((info =info_from_pvid (dev->pvid))) +if ((info =info_from_pvid (dev->pvid,0 )))lvmcache_update_vgname_and_id (info,ORPHAN ,ORPHAN ,0 ,NULL );log_very_verbose ("%s: No label detected" ,dev_name (dev));
@@ -260,7 +260,6 @@return r; } -/* FIXME Avoid repeated re-reading if cache lock held */ int label_read (struct device *dev,struct label **result,uint64_t scan_sector) {
@@ -270,10 +269,16 @@struct lvmcache_info *info;int r =0 ; +if ((info =info_from_pvid (dev->pvid,1 ))) { +log_debug ("Using cached label for %s" ,dev_name (dev)); + *result = info->label; +return 1 ; + } +if (!dev_open (dev)) { stack; -if ((info =info_from_pvid (dev->pvid))) +if ((info =info_from_pvid (dev->pvid,0 )))lvmcache_update_vgname_and_id (info,ORPHAN ,ORPHAN ,0 ,NULL );
@@ -353,7 +358,7 @@int r =0 ;if (!dev_open (dev)) { -if ((info =info_from_pvid (dev->pvid))) +if ((info =info_from_pvid (dev->pvid,0 )))lvmcache_update_vgname_and_id (info,ORPHAN ,ORPHAN ,0 ,NULL );
lib/report/report.c +2 -2
@@ -840,7 +840,7 @@uint32_t count;const char *pvid = (const char *)(&((struct id *) data)->uuid); - info =info_from_pvid (pvid); + info =info_from_pvid (pvid,0 ); count = info ?list_size (&info->mdas) :0 ;return _uint32_disp (rh, mem, field, &count, private);
@@ -867,7 +867,7 @@const char *pvid = (const char *)(&((struct id *) data)->uuid);struct metadata_area *mda; - info =info_from_pvid (pvid); + info =info_from_pvid (pvid,0 ); list_iterate_items(mda, &info->mdas) {if (!mda->ops->mda_free_sectors)