Commit Graph

232 Commits

Author SHA1 Message Date
Steven Whitehouse 7ecdb70a0e [GFS2] Fix endian bug for de_type
Missing endian conversion for the de_type field.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-03 21:03:35 -04:00
Ryan O'Hara fcb47e0bd2 [GFS2] Initialize SELinux extended attributes at inode creation time.
This patch has gfs2_security_init declared as a static function, which
is correct. As a result, the declaration of this function in inode.h is
removed (and thus inode.h is unchanged). Also removed #include eaops.h,
which is not needed.

Signed-Off-By: Ryan O'Hara <rohara@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-03 11:57:35 -04:00
Steven Whitehouse ddacfaf76d [GFS2] Move logging code into log.c (mostly)
This moves the logging code from meta_io.c into log.c and glops.c. As a
result the routines can now be static and all the logging code is together
in log.c, leaving meta_io.c with just metadata i/o code in it.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-03 11:10:41 -04:00
Steven Whitehouse f92a0b6ff4 [GFS2] Mark nlink cleared so VFS sees it happen
This does nothing atm, but will be required for later support of
r/o bind mounts.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 16:01:53 -04:00
Steven Whitehouse 409e185d23 [GFS2] Two redundant casts removed
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 14:20:43 -04:00
Steven Whitehouse 48516ced21 [GFS2] Remove uneeded endian conversion
In many places GFS2 was calling the endian conversion routines
for an inode even when only a single field, or a few fields might
have changed. As a result we were copying lots of data needlessly.

This patch replaces those calls with conversion of just the
required fields in each case. This should be faster and easier
to understand. There are still other places which suffer from this
problem, but this is a start in the right direction.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 12:39:19 -04:00
Steven Whitehouse 3cf1e7bed4 [GFS2] Remove duplicate sb reading code
For some reason we had two different sets of code for reading in the
superblock. This removes one of them in favour of the other. Also we
don't need the temporary buffer for the sb since we already have one
in the gfs2 sb itself.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 11:49:41 -04:00
Steven Whitehouse 2e565bb69c [GFS2] Mark metadata reads for blktrace
Mark the metadata reads so that blktrace knows what they are.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 11:38:25 -04:00
Steven Whitehouse 128e5ebaf8 [GFS2] Remove iflags.h, use FS_
Update GFS2 in the light of David Howells' patch:

[PATCH] BLOCK: Move common FS-specific ioctls to linux/fs.h [try #6]
36695673b0

which calls the filesystem independant flags FS_..._FL. As a result
we no longer need the flags.h file and the conversion routine is
moved into the GFS2 source code.

Userland programs which used to include iflags.h should now include
fs.h and use the new flag names.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 11:24:43 -04:00
Steven Whitehouse d00223f169 [GFS2] Fix code style/indent in ops_file.c
Fix a couple of minor issues.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 10:28:05 -04:00
Andrew Morton 930cc237d6 [GFS2] streamline-generic_file_-interfaces-and-filemap gfs fix
Fix GFS for streamline-generic_file_-interfaces-and-filemap.patch

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 09:02:54 -04:00
Badari Pulavarty 9c9eb21eee [GFS2] Remove readv/writev methods and use aio_read/aio_write instead (gfs bits)
This patch removes readv() and writev() methods and replaces them with
aio_read()/aio_write() methods.

Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-10-02 09:02:12 -04:00
Theodore Ts'o 825f9075d7 [GFS2] inode-diet: Eliminate i_blksize from the inode structure
This eliminates the i_blksize field from struct inode.  Filesystems that want
to provide a per-inode st_blksize can do so by providing their own getattr
routine instead of using the generic_fillattr() function.

Note that some filesystems were providing pretty much random (and incorrect)
values for i_blksize.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
2006-09-28 08:32:51 -04:00
Theodore Ts'o bba9dfd835 [GFS2] inode_diet: Replace inode.u.generic_ip with inode.i_private (gfs)
The following patches reduce the size of the VFS inode structure by 28 bytes
on a UP x86.  (It would be more on an x86_64 system).  This is a 10% reduction
in the inode size on a UP kernel that is configured in a production mode
(i.e., with no spinlock or other debugging functions enabled; if you want to
save memory taken up by in-core inodes, the first thing you should do is
disable the debugging options; they are responsible for a huge amount of bloat
in the VFS inode structure).

This patch:

The filesystem or device-specific pointer in the inode is inside a union,
which is pretty pointless given that all 30+ users of this field have been
using the void pointer.  Get rid of the union and rename it to i_private, with
a comment to explain who is allowed to use the void pointer.  This is just a
cleanup, but it allows us to reuse the union 'u' for something something where
the union will actually be used.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
2006-09-28 08:32:24 -04:00
Steven Whitehouse 7e18c02be7 [GFS2] Fix bug in Makefiles for lock modules
The Makefile had the wrong CONFIG_ variable in it so that in
case GFS2 was y and the lock modules were m, they were not
getting built properly.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-27 12:20:06 -04:00
Steven Whitehouse 907b9bceb4 [GFS2/DLM] Fix trailing whitespace
As per Andrew Morton's request, removed trailing whitespace.

Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-25 09:26:04 -04:00
Steven Whitehouse 7276b3b0c7 [GFS2] Tidy up meta_io code
Fix a bug in the directory reading code, where we might have dereferenced
a NULL pointer in case of OOM. Updated the directory code to use the new
& improved version of gfs2_meta_ra() which now returns the first block
that was being read. Previously it was releasing it requiring following
code to grab the block again at each point it was called.

Also turned off readahead on directory lookups since we are reading a
hash table, and therefore reading the entries in order is very
unlikely. Readahead is still used for all other calls to the
directory reading function (e.g. when growing the hash table).

Removed the DIO_START constant. Everywhere this was used, it was
used to unconditionally start i/o aside from a couple of places, so
I've removed it and made the couple of exceptions to this rule into
separate functions.

Also hunted through the other DIO flags and removed them as arguments
from functions which were always called with the same combination of
arguments.

Updated gfs2_meta_indirect_buffer to be a bit more efficient and
hopefully also be a bit easier to read.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-21 17:05:23 -04:00
Steven Whitehouse 56965536b8 [GFS2] Remove unused constants
Three of the DIO constants were not being used, so remove them.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-20 15:48:09 -04:00
Steven Whitehouse f0e522a901 [GFS2] Remove "NFS only" readdir path
This code path shouldn't be needed, so remove it for now. This
tidys things up.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-19 16:41:11 -04:00
Steven Whitehouse 74669416f7 [GFS2] Use list_for_each_entry_safe_reverse in gfs2_ail1_start()
This is an attempt to fix Red Hat bz 204364. I don't hit it all
the time, but with these changes, running postmark which used to
trigger it on a regular basis no longer appears to. So I'm not
saying that its 100% certain that its fixed, but it does look
promising at the moment.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-19 11:17:38 -04:00
Fabio Massimo Di Nitto 7d308590ae [GFS2] Export lm_interface to kernel headers
lm_interface.h has a few out of the tree clients such as GFS1
and userland tools.

Right now, these clients keeps a copy of the file in their build tree
that can go out of sync.

Move lm_interface.h to include/linux, export it to userland and
clean up fs/gfs2 to use the new location.

Signed-off-by: Fabio M. Di Nitto <fabbione@ubuntu.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-19 08:45:18 -04:00
akpm@osdl.org f3b30912e0 [GFS2] inode-diet-eliminate-i_blksize-and-use-a-per-superblock-default-vs-gfs2
i_blksize got removed in -mm.

Cc: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-19 08:43:01 -04:00
Steven Whitehouse 07903c02d0 [GFS2] Tweek unlock test in readpage()
This make the unlock test a bit simpler.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-18 17:30:05 -04:00
Russell Cattelan dc41aeedef [GFS2] Fix for mmap() bug in readpage
Fix for Red Hat bz 205307. Don't need to lock in readpage if
the higher level code has already grabbed the lock.

Signed-off-by: Russell Cattelan <cattelan@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-18 17:26:48 -04:00
Steven Whitehouse 7a6bbacbb8 [GFS2] Map multiple blocks at once where possible
This is a tidy up of the GFS2 bmap code. The main change is that the
bh is passed to gfs2_block_map allowing the flags to be set directly
rather than having to repeat that code several times in ops_address.c.

At the same time, the extent mapping code from gfs2_extent_map has
been moved into gfs2_block_map. This allows all calls to gfs2_block_map
to map extents in the case that no allocation is taking place. As a
result reads and non-allocating writes should be faster. A quick test
with postmark appears to support this.

There is a limit on the number of blocks mapped in a single bmap
call in that it will only ever map blocks which are pointed to
from a single pointer block. So in other words, it will never try
to do additional i/o in order to satisfy read-ahead. The maximum
number of blocks is thus somewhat less than 512 (the GFS2 4k block
size minus the header divided by sizeof(u64)). I've further limited
the mapping of "normal" blocks to 32 blocks (to avoid extra work)
since readpages() will currently read a maximum of 32 blocks ahead (128k).

Some further work will probably be needed to set a suitable value
for DIO as well, but for now thats left at the maximum 512 (see
ops_address.c:gfs2_get_block_direct).

There is probably a lot more that can be done to improve bmap for GFS2,
but this is a good first step.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-18 17:18:23 -04:00
David Teigland 65952fb4e9 [GFS2] print mount errors related to sysfs
Print an error message if mount fails in setting up the sysfs files.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-18 09:43:23 -04:00
Steven Whitehouse a8336344a5 [GFS2] Fix glock hash clearing
A one liner bug fix to prevent the return value being
wrong when more than one superblock is mounted.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-14 13:57:38 -04:00
Steven Whitehouse faa31ce85f [GFS2] Tidy up log.c
Based upon previous feedback from lkml and also removing some
commented out debugging which is no longer needed.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-13 11:13:27 -04:00
Steven Whitehouse 16feb9fec0 [GFS2] Use atomic_t rather than kref in glock.c
Use atomic_t as the ref count in glocks rather than a kref.
This is another step towards using RCU for the glock hash.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-13 10:43:37 -04:00
Steven Whitehouse b6397893a5 [GFS2] Use hlist for glock hash chains
This results in smaller list heads, so that we can have more chains
in the same amount of memory (twice as many). I've multiplied the
size of the table by four though - this is because we are saving
memory by not having one lock per chain any more. So we land up
using about the same amount of memory for the hash table as we
did before I started these changes, the difference being that we
now have four times as many hash chains.

The reason that I say "about the same amount of memory" is that the
actual amount now depends upon the NR_CPUS and some of the config
variables, so that its not exact and in some cases we do use more
memory. Eventually we might want to scale the hash table size
according to the size of physical ram as measured on module load.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-12 10:10:01 -04:00
Steven Whitehouse 2426443460 [GFS2] Rewrite of examine_bucket()
The existing implementation of this function in glock.c was not
very efficient as it relied upon keeping a cursor element upon the
hash chain in question and moving it along. This new version improves
upon this by using the current element as a cursor. This is possible
since we only look at the "next" element in the list after we've
taken the read_lock() subsequent to calling the examiner function.
Obviously we have to eventually drop the ref count that we are then
left with and we cannot do that while holding the read_lock, so we
do that next time we drop the lock. That means either just before
we examine another glock, or when the loop has terminated.

The new implementation has several advantages: it uses only a
read_lock() rather than a write_lock(), so it can run simnultaneously
with other code, it doesn't need a "plug" element, so that it removes
a test not only from this list iterator, but from all the other glock
list iterators too. So it makes things faster and smaller.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-11 21:40:30 -04:00
Steven Whitehouse 94610610f1 [GFS2] Remove unused function from glock.c
The callback for iopen locks is unused, so this removes
it.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-09 18:59:27 -04:00
Steven Whitehouse a5e08a9ef5 [GFS2] Add consts to glock sorting function
Add back the consts which were casted away in the glock sorting
function. Also add early exit code.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-09 17:07:05 -04:00
Steven Whitehouse 087efdd391 [GFS2] Make glock hash locks proportional to NR_CPUS
Make the number of locks used for hash chains in glock.c
proportional to NR_CPUS. Also move constants for the number
of hash chains into glock.c from incore.h since they are
not used outside of glock.c.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-09 16:59:11 -04:00
Steven Whitehouse ff6af411ae [GFS2] vfree should be kfree (II)
The superblock is now created with kmalloc, not vmalloc.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-09 16:56:34 -04:00
Steven Whitehouse 37b2fa6a24 [GFS2] Move rwlocks in glock.c into their own array
This splits the rwlocks guarding the hash chains of the glock hash
table into their own array. This will reduce memory usage in some
cases due to better alignment, although the real reason for doing it
is to allow the two tables to be different sizes in future (i.e.
the locks will be sized proportionally with the max number of CPUs
and the hash chains sized proportinally with the size of physical memory)

In order to allow this, the gl_bucket member of struct gfs2_glock has
now become gl_hash, so we record the hash rather than a pointer to the
bucket itself.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-08 13:35:56 -04:00
Steven Whitehouse 9b47c11d1c [GFS2] Use void * instead of typedef for locking module interface
As requested by Jan Engelhardt, this removes the typedefs in the
locking module interface and replaces them with void *. Also
since we are changing the interface, I've added a few consts
as well.

Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-08 10:17:58 -04:00
Steven Whitehouse a2c4580797 [GFS2] vfree should be kfree
This was missed in an earlier patch when changing over from vmalloc
to kmalloc for the superblock.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-08 10:13:03 -04:00
Steven Whitehouse 5ce311ebdb [GFS2] Remove unused sync_lvb code from lock modules
This code is no longer used for anything and can be removed
from the locking modules. The sync_lvb function is not required
as this happens automatically with the current locking system.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-07 17:35:48 -04:00
Steven Whitehouse 1c089c325d [GFS2] Remove one typedef
This removes one of the typedefs from the locking interface. It
is replaced by a forward declaration of the gfs2 superblock. The
other two are not so easy to solve since in their case, they
can refer to one of two possible structures.

Cc: David Teigland <teigland@redhat.com>
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-07 15:50:20 -04:00
Steven Whitehouse b9201ce9a8 [GFS2] Forgot to remove unused include vmalloc.h
Excatly as the subject line says.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-07 14:46:39 -04:00
Steven Whitehouse 85d1da67f7 [GFS2] Move glock hash table out of superblock
There are several reasons why we want to do this:
 - Firstly its large and thus we'll scale better with multiple
   GFS2 fs mounted at the same time
 - Secondly its easier to scale its size as required (thats a plan
   for later patches)
 - Thirdly, we can use kzalloc rather than vmalloc when allocating
   the superblock (its now only 4888 bytes)
 - Fourth its all part of my plan to eventually be able to use RCU
   with the glock hash.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-07 14:40:21 -04:00
Steven Whitehouse b8547856f9 [GFS2] Add gfs2 superblock to glock hash function
This is another patch preparing for sharing of the glock hash
table between different gfs2 mounts.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-07 13:12:27 -04:00
Steven Whitehouse 62f140c173 [GFS2] Add brackets in locking/dlm/sysfs.c
As per Jan Engelhardt's request.

Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-07 09:54:55 -04:00
David Teigland 3204a6c055 [GFS2] use snprintf for sysfs show
Use snprintf(buf, PAGE_SIZE, ...) instead of sprintf for sysfs show
methods.  Per instructions in Documentation/filesystems/sysfs.txt

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-07 09:43:34 -04:00
Jan Engelhardt c53921248c [GFS2] More style changes
Remove redundant brackets

Signed-off-by: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-07 09:42:56 -04:00
Steven Whitehouse 7b62536141 [GFS2] Add a comment in ops_export.c
Ass a comment explaining the slightly odd construct used to
pass error values back.

Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-05 15:56:17 -04:00
Steven Whitehouse 2c1e52aa90 [GFS2] More style fixes
As per Jan Engelhardt's follow up emails, here are a few small
fixes which were missed earlier.

Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-05 15:41:57 -04:00
Steven Whitehouse 48fac17909 [GFS2] Remove unused code from quota
As per Jan Engelhardt's request, some unused code is removed and
some consts added in the quota code.

Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-05 15:17:12 -04:00
Steven Whitehouse a67cdbd457 [GFS2] Style changes in logging code
As per Jan Engelhardt's comments, removed some unused code and
removed some brackets which were not required.

Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-09-05 14:41:30 -04:00