All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-lvm] Setting readahead for Logical Volumes via udev
@ 2014-05-19 15:58 David Wittman
  2014-05-20  7:03 ` Peter Rajnoha
  0 siblings, 1 reply; 5+ messages in thread
From: David Wittman @ 2014-05-19 15:58 UTC (permalink / raw)
  To: linux-lvm

[-- Attachment #1: Type: text/plain, Size: 1891 bytes --]

Hey all,

I'm having an issue tuning the readahead value for my Logical Volumes via
udev. In short, I'm trying to create a rule that sets the readahead
attribute for each of my Logical Volumes at boot time or upon the creation
of a new volume. udev seems like the perfect place to do this, but for some
reason or another LVM seems to be overriding these settings.

Here's the udev rule I'm using, followed by an example:

```
# cat /etc/udev/rules.d/83-readahead.rules
# Set the readahead on non-spinning disks to 8kb (16 512b sectors)
ACTION=="add", KERNEL=="dm-*", ATTR{queue/rotational}=="0",
ATTR{bdi/read_ahead_kb}="8"

# lvcreate -L 100G data_fioa -n readahead_test
  Logical volume "readahead_test" created

# blockdev --report
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0    107374182400   /dev/dm-0
```

You'll notice above that the readahead is still 256 512-byte sectors. The
same happens upon a reboot of the system. Despite this, I do see
information in logs from udev that it is writing this value:

> udevd-work[4778]: ATTR
'/sys/devices/virtual/block/dm-1/bdi/read_ahead_kb' writing '8'
/etc/udev/rules.d/83-readahead.rules:3

(Note: this is an earlier log entry; I have since disabled debug logging,
so ignore any inconsistencies here)

With all that said, I am quite certain that the udev rules are correct,
because after running `udevadm trigger`, the readahead values are then set
properly:

```
# udevadm trigger
# blockdev --report
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw    16   512  4096          0    107374182400   /dev/dm-0
```

I've tried tweaking a few of the udev specific values in lvm.conf, to no
avail. Any help or suggestions are appreciated. Here are my system details:

Distro: CentOS 6.4
LVM2 version: lvm2-2.02.98-9.el6_4.3.x86_64
udev version: udev-147-2.46.el6_4.2.x86_64

Thanks,

Dave

[-- Attachment #2: Type: text/html, Size: 2613 bytes --]

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

* Re: [linux-lvm] Setting readahead for Logical Volumes via udev
  2014-05-19 15:58 [linux-lvm] Setting readahead for Logical Volumes via udev David Wittman
@ 2014-05-20  7:03 ` Peter Rajnoha
  2014-05-20 15:37   ` David Wittman
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Rajnoha @ 2014-05-20  7:03 UTC (permalink / raw)
  To: dwittman; +Cc: LVM general discussion and development

On 05/19/2014 05:58 PM, David Wittman wrote:
> Hey all,
> 
> I'm having an issue tuning the readahead value for my Logical Volumes
> via udev. In short, I'm trying to create a rule that sets the readahead
> attribute for each of my Logical Volumes at boot time or upon the
> creation of a new volume. udev seems like the perfect place to do this,
> but for some reason or another LVM seems to be overriding these settings.
> 
> Here's the udev rule I'm using, followed by an example:
> 
> ```
> # cat /etc/udev/rules.d/83-readahead.rules
> # Set the readahead on non-spinning disks to 8kb (16 512b sectors)
> ACTION=="add", KERNEL=="dm-*", ATTR{queue/rotational}=="0",
> ATTR{bdi/read_ahead_kb}="8"
> 

Try ACTION=="change", KERNEL=="dm-*", ENV{DM_ACTIVATION}=="1", ATTR ....

Anyway, there's direct way to set the readahead value using LVM tools with:
  lvcreate/lvchange -r/--readahead (see man lvcreate and lvchange for more info).

-- 
Peter

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

* Re: [linux-lvm] Setting readahead for Logical Volumes via udev
  2014-05-20  7:03 ` Peter Rajnoha
@ 2014-05-20 15:37   ` David Wittman
  2014-05-22  7:07     ` Marian Csontos
  0 siblings, 1 reply; 5+ messages in thread
From: David Wittman @ 2014-05-20 15:37 UTC (permalink / raw)
  To: Peter Rajnoha; +Cc: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

Hey Peter,

Thanks for the response. I've previously tried the "change" action, and
adding the specifier for the DM_ACTIVATION environment variable had no
effect. I'm also aware of the capability to set the readahead on a
per-volume basis, but I'm looking for a solution which handles setting
these values at boot time and/or volume creation time.

Dave


On Tue, May 20, 2014 at 2:03 AM, Peter Rajnoha <prajnoha@redhat.com> wrote:

> On 05/19/2014 05:58 PM, David Wittman wrote:
> > Hey all,
> >
> > I'm having an issue tuning the readahead value for my Logical Volumes
> > via udev. In short, I'm trying to create a rule that sets the readahead
> > attribute for each of my Logical Volumes at boot time or upon the
> > creation of a new volume. udev seems like the perfect place to do this,
> > but for some reason or another LVM seems to be overriding these settings.
> >
> > Here's the udev rule I'm using, followed by an example:
> >
> > ```
> > # cat /etc/udev/rules.d/83-readahead.rules
> > # Set the readahead on non-spinning disks to 8kb (16 512b sectors)
> > ACTION=="add", KERNEL=="dm-*", ATTR{queue/rotational}=="0",
> > ATTR{bdi/read_ahead_kb}="8"
> >
>
> Try ACTION=="change", KERNEL=="dm-*", ENV{DM_ACTIVATION}=="1", ATTR ....
>
> Anyway, there's direct way to set the readahead value using LVM tools with:
>   lvcreate/lvchange -r/--readahead (see man lvcreate and lvchange for more
> info).
>
> --
> Peter
>

[-- Attachment #2: Type: text/html, Size: 2090 bytes --]

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

* Re: [linux-lvm] Setting readahead for Logical Volumes via udev
  2014-05-20 15:37   ` David Wittman
@ 2014-05-22  7:07     ` Marian Csontos
  2014-05-22 21:37       ` David Wittman
  0 siblings, 1 reply; 5+ messages in thread
From: Marian Csontos @ 2014-05-22  7:07 UTC (permalink / raw)
  To: LVM general discussion and development, dwittman

On 05/20/2014 05:37 PM, David Wittman wrote:
> Hey Peter,
>
> Thanks for the response. I've previously tried the "change" action, and
> adding the specifier for the DM_ACTIVATION environment variable had no
> effect. I'm also aware of the capability to set the readahead on a
> per-volume basis, but I'm looking for a solution which handles setting
> these values at boot time and/or volume creation time.

Hi David, may be I do not understand your requirements but the 
`--readahead` option does set the parameter at volume creation time and 
during boot time.

Seeing you use star in the rules, looks like you want to change default 
when new LV is created: there is `readahead` setting in the lvm.conf 
file to do that.

-- Martian

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

* Re: [linux-lvm] Setting readahead for Logical Volumes via udev
  2014-05-22  7:07     ` Marian Csontos
@ 2014-05-22 21:37       ` David Wittman
  0 siblings, 0 replies; 5+ messages in thread
From: David Wittman @ 2014-05-22 21:37 UTC (permalink / raw)
  To: Marian Csontos; +Cc: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 1022 bytes --]

Oh, well that makes more sense than using udev. I wasn't aware that -r
would set the readahead value persistently in the LV metadata. That makes
my life easy.

Thank you both.


On Thu, May 22, 2014 at 2:07 AM, Marian Csontos <mcsontos@redhat.com> wrote:

> On 05/20/2014 05:37 PM, David Wittman wrote:
>
>> Hey Peter,
>>
>> Thanks for the response. I've previously tried the "change" action, and
>> adding the specifier for the DM_ACTIVATION environment variable had no
>> effect. I'm also aware of the capability to set the readahead on a
>> per-volume basis, but I'm looking for a solution which handles setting
>> these values at boot time and/or volume creation time.
>>
>
> Hi David, may be I do not understand your requirements but the
> `--readahead` option does set the parameter at volume creation time and
> during boot time.
>
> Seeing you use star in the rules, looks like you want to change default
> when new LV is created: there is `readahead` setting in the lvm.conf file
> to do that.
>
> -- Martian
>
>

[-- Attachment #2: Type: text/html, Size: 1522 bytes --]

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

end of thread, other threads:[~2014-05-22 21:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-19 15:58 [linux-lvm] Setting readahead for Logical Volumes via udev David Wittman
2014-05-20  7:03 ` Peter Rajnoha
2014-05-20 15:37   ` David Wittman
2014-05-22  7:07     ` Marian Csontos
2014-05-22 21:37       ` David Wittman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.