2004-09-22 18:48:21

by Robert Love

[permalink] [raw]
Subject: [patch] inotify: eliminate struct padding

Hey, John!

"struct inotify_device" was receiving a lot of padding, because it has a
lot of large structures of various sizes in it. Plus a single char.

On x86, the main thing getting padding was "bitmask". Rearranging the
structure solved the padding problem. We have no ABI issues since the
structure is internal to inotify.c.

Once the per-element padding was fixed, we still have the structure
being padded out to the architecture's alignment size. This is caused
by the lone char, read_state. It turns out that nothing was using
read_state (??), so I just removed it.

Now there is no padding on the elements or the structure as a whole.
This saves a handful of bytes per structure.

I also s/watcher_count/nr_watches/ since we have a lot of other
watcher_counts. I am easily confused.

Best,

Robert Love


Attachments:
inotify-padding-1.patch (2.61 kB)