FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 10-29-2009, 12:39 PM
Hans de Goede
 
Default ped_device_get_constraint: return constraint without alignment

In libparted-1.9 ped_device_get_constraint() would always return a constraint
without any start / end aligning (grain_size == 1). Now that we are starting to
support disks with a physical sector size other then 512, the old
ped_device_get_constraint() code may actually start returning constrains
with aligment info with a grain_size != 1.

Since this is a behavior change and since the old code does not take a possible
aligment info into account, this patch removes the aligning code from
ped_device_get_constraint(), so that its behavior is unchanged.

This patch also updates the functions doxygen documentation to reflect what
it has actually done all these years.
---
libparted/device.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/libparted/device.c b/libparted/device.c
index 34b8eb5..6210a23 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -416,31 +416,32 @@ ped_device_sync_fast (PedDevice* dev)
}

/**
- * Get a constraint that represents hardware requirements on alignment and
- * geometry.
- * This is, for example, important for media that have a physical sector
- * size that is a multiple of the logical sector size.
+ * Get a constraint that represents hardware requirements on geometry.
+ * This function will return a constraint representing the limits imposed
+ * by the size of the disk, it will *not* provide any alignment constraints.
*
- * warning This function is experimental for physical sector sizes not equal to
- * 2^9.
+ * Alignment constraints may be desirable when using media that have a physical
+ * sector size that is a multiple of the logical sector size, as in this case
+ * proper partition alignment can benefit disk performance signigicantly.
+ * When you want a constraint with aligment info, use
+ * ped_device_get_minimal_aligned_constraint() or
+ * ped_device_get_optimal_aligned_constraint().
+ *
+ *
eturn NULL on error, otherwise a pointer to a dynamically allocated
+ * constraint.
*/
PedConstraint*
ped_device_get_constraint (PedDevice* dev)
{
- int multiplier = dev->phys_sector_size / dev->sector_size;
-
- PedAlignment* start_align = ped_alignment_new (multiplier, multiplier);
-
PedGeometry *s, *e;
PedConstraint* c = ped_constraint_new (
- start_align, ped_alignment_any,
+ ped_alignment_any, ped_alignment_any,
s = ped_geometry_new (dev, 0, dev->length),
e = ped_geometry_new (dev, 0, dev->length),
1, dev->length);

free (s);
free (e);
- free (start_align);
return c;
}

--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-29-2009, 02:26 PM
Hans de Goede
 
Default ped_device_get_constraint: return constraint without alignment

In libparted-1.9 ped_device_get_constraint() would always return a constraint
without any start / end aligning (grain_size == 1). Now that we are starting to
support disks with a physical sector size other then 512, the old
ped_device_get_constraint() code may actually start returning constrains
with alignment info with a grain_size != 1.

Since this is a behavior change and since the old code does not take a possible
alignment info into account, this patch removes the aligning code from
ped_device_get_constraint(), so that its behavior is unchanged.

This patch also updates the functions doxygen documentation to reflect what
it has actually done all these years.
---
libparted/device.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/libparted/device.c b/libparted/device.c
index 4fec1a9..483011a 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -416,31 +416,32 @@ ped_device_sync_fast (PedDevice* dev)
}

/**
- * Get a constraint that represents hardware requirements on alignment and
- * geometry.
- * This is, for example, important for media that have a physical sector
- * size that is a multiple of the logical sector size.
+ * Get a constraint that represents hardware requirements on geometry.
+ * This function will return a constraint representing the limits imposed
+ * by the size of the disk, it will *not* provide any alignment constraints.
*
- * warning This function is experimental for physical sector sizes not equal to
- * 2^9.
+ * Alignment constraints may be desirable when using media that have a physical
+ * sector size that is a multiple of the logical sector size, as in this case
+ * proper partition alignment can benefit disk performance signigicantly.
+ * When you want a constraint with alignment info, use
+ * ped_device_get_minimal_aligned_constraint() or
+ * ped_device_get_optimal_aligned_constraint().
+ *
+ *
eturn NULL on error, otherwise a pointer to a dynamically allocated
+ * constraint.
*/
PedConstraint*
ped_device_get_constraint (PedDevice* dev)
{
- int multiplier = dev->phys_sector_size / dev->sector_size;
-
- PedAlignment* start_align = ped_alignment_new (multiplier, multiplier);
-
PedGeometry *s, *e;
PedConstraint* c = ped_constraint_new (
- start_align, ped_alignment_any,
+ ped_alignment_any, ped_alignment_any,
s = ped_geometry_new (dev, 0, dev->length),
e = ped_geometry_new (dev, 0, dev->length),
1, dev->length);

free (s);
free (e);
- free (start_align);
return c;
}

--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-30-2009, 10:59 AM
Hans de Goede
 
Default ped_device_get_constraint: return constraint without alignment

In libparted-1.9 ped_device_get_constraint() would always return a constraint
without any start / end aligning (grain_size == 1). Now that we are starting to
support disks with a physical sector size other then 512, the old
ped_device_get_constraint() code may actually start returning constrains
with alignment info with a grain_size != 1.

Since this is a behavior change and since the old code does not take a possible
alignment info into account, this patch removes the aligning code from
ped_device_get_constraint(), so that its behavior is unchanged.

This patch also updates the functions doxygen documentation to reflect what
it has actually done all these years.
---
libparted/device.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/libparted/device.c b/libparted/device.c
index 4fec1a9..483011a 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -416,31 +416,32 @@ ped_device_sync_fast (PedDevice* dev)
}

/**
- * Get a constraint that represents hardware requirements on alignment and
- * geometry.
- * This is, for example, important for media that have a physical sector
- * size that is a multiple of the logical sector size.
+ * Get a constraint that represents hardware requirements on geometry.
+ * This function will return a constraint representing the limits imposed
+ * by the size of the disk, it will *not* provide any alignment constraints.
*
- * warning This function is experimental for physical sector sizes not equal to
- * 2^9.
+ * Alignment constraints may be desirable when using media that have a physical
+ * sector size that is a multiple of the logical sector size, as in this case
+ * proper partition alignment can benefit disk performance signigicantly.
+ * When you want a constraint with alignment info, use
+ * ped_device_get_minimal_aligned_constraint() or
+ * ped_device_get_optimal_aligned_constraint().
+ *
+ *
eturn NULL on error, otherwise a pointer to a dynamically allocated
+ * constraint.
*/
PedConstraint*
ped_device_get_constraint (PedDevice* dev)
{
- int multiplier = dev->phys_sector_size / dev->sector_size;
-
- PedAlignment* start_align = ped_alignment_new (multiplier, multiplier);
-
PedGeometry *s, *e;
PedConstraint* c = ped_constraint_new (
- start_align, ped_alignment_any,
+ ped_alignment_any, ped_alignment_any,
s = ped_geometry_new (dev, 0, dev->length),
e = ped_geometry_new (dev, 0, dev->length),
1, dev->length);

free (s);
free (e);
- free (start_align);
return c;
}

--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 03:25 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org