Commit graph

108 commits

Author SHA1 Message Date
Steven Whitehouse
0d42e54220 [GFS2] Remove unused ra_state variable
As per Nick Piggin's comments on lkml, remove the unused ra_state
variable.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
2006-06-20 16:13:49 -04:00
David Woodhouse
0239c4ae8a [GFS2] Fix printk format warnings in DLM code
fs/gfs2/locking/dlm/thread.c: In function ‘process_complete’:
fs/gfs2/locking/dlm/thread.c:56: warning: format ‘%llx’ expects type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’
fs/gfs2/locking/dlm/thread.c:69: warning: format ‘%llx’ expects type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’
fs/gfs2/locking/dlm/thread.c:102: warning: format ‘%llx’ expects type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’
fs/gfs2/locking/dlm/thread.c:124: warning: format ‘%llx’ expects type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’
fs/gfs2/locking/dlm/thread.c:146: warning: format ‘%llx’ expects type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’
fs/gfs2/locking/dlm/thread.c:148: warning: format ‘%llx’ expects type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-20 13:48:31 +01:00
David Woodhouse
695165dfba [GFS2] Fix use of bitops on unsigned int (struct gfs2_holder->gh_iflags)
fs/gfs2/glock.c: In function ‘gfs2_holder_get’:
fs/gfs2/glock.c:439: warning: passing argument 2 of ‘set_bit’ from incompatible pointer type
fs/gfs2/glock.c: In function ‘rq_promote’:
fs/gfs2/glock.c:512: warning: passing argument 2 of ‘set_bit’ from incompatible pointer type
fs/gfs2/glock.c:526: warning: passing argument 2 of ‘set_bit’ from incompatible pointer type
 ...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-20 13:44:27 +01:00
Steven Whitehouse
b61dde795f [GFS2] Always include glock in transaction
Include the glock in the transaction, even when not journaling
data in order that ordered write data will be correctly flushed
when the lock is released.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-06-19 10:51:11 -04:00
Steven Whitehouse
3a8476dda1 [GFS2] Remove debugging printks
A few of my printks slipped through last time. Also fix a couple of
minor bugs.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-06-19 09:10:39 -04:00
Steven Whitehouse
feaa7bba02 [GFS2] Fix unlinked file handling
This patch fixes the way we have been dealing with unlinked,
but still open files. It removes all limits (other than memory
for inodes, as per every other filesystem) on numbers of these
which we can support on GFS2. It also means that (like other
fs) its the responsibility of the last process to close the file
to deallocate the storage, rather than the person who did the
unlinking. Note that with GFS2, those two events might take place
on different nodes.

Also there are a number of other changes:

 o We use the Linux inode subsystem as it was intended to be
used, wrt allocating GFS2 inodes
 o The Linux inode cache is now the point which we use for
local enforcement of only holding one copy of the inode in
core at once (previous to this we used the glock layer).
 o We no longer use the unlinked "special" file. We just ignore it
completely. This makes unlinking more efficient.
 o We now use the 4th block allocation state. The previously unused
state is used to track unlinked but still open inodes.
 o gfs2_inoded is no longer needed
 o Several fields are now no longer needed (and removed) from the in
core struct gfs2_inode
 o Several fields are no longer needed (and removed) from the in core
superblock

There are a number of future possible optimisations and clean ups
which have been made possible by this patch.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-06-14 15:32:57 -04:00
Steven Whitehouse
01eb7c0796 [GFS2] Fix warning on impossible event in eattr code
The caller ensures that ea_list_i() is never called with an
invalid type, so lets BUG() if we see one. This clears up
a couple of compiler warnings too.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-06-06 17:31:30 -04:00
Steven Whitehouse
6b61b072a8 [GFS2] Move some fields around to reduce wasted space
We can reclaim some space by moving fields in some structures
in order to allow them to pack better on 64 bit architectures.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-06-06 14:49:39 -04:00
Ryan O'Hara
e70409f5f3 [GFS2] Fix for selinux support
This should fix the mount problems with gfs2 and selinux.

Signed-off-by: Ryan O'Hara <rohara@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-25 17:36:15 -04:00
Steven Whitehouse
382066da25 [GFS2] Casts for printing 64bit numbers
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-24 10:22:09 -04:00
David Teigland
9229f01349 [GFS2] Cast 64 bit printk args to unsigned long long.
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-24 09:21:30 -04:00
Steven Whitehouse
90cdd2083a [GFS2] Flag up issue in selinux code
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-22 10:36:25 -04:00
Ryan O'Hara
639b6d79b8 [GFS2] selinux support
This adds support to GFS2 for selinux extended attributes. There is a
known bug in gfs2_ea_get() which is believed to be independant of this
patch. Further patches will follow once that bug is fixed in order to
make GFS2 use as much of the generic eattr infrastructure as possible.

Signed-off-by: Ryan O'Hara <rohara@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-22 10:08:35 -04:00
David Teigland
d2f222e631 [GFS2] setup lock_dlm kobject earlier
Setup the lock_dlm kobject before setting up the dlm lockspace instead
of after.  We want to use the sysfs files to detect the mount without
having to wait for the dlm setup which can take a while.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-19 08:24:02 -04:00
Steven Whitehouse
320dd101e2 [GFS2] glock debugging and inode cache changes
This adds some extra debugging to glock.c and changes
inode.c's deallocation code to call the debugging code
at a suitable moment. I'm chasing down a particular bug
to do with deallocation at the moment and the code can
go again once the bug is fixed.

Also this includes the first part of some changes to unify
the Linux struct inode and GFS2's struct gfs2_inode. This
transformation will happen in small parts over the next short
period.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-18 16:25:27 -04:00
Steven Whitehouse
3a8a9a1034 [GFS2] Update copyright date to 2006
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-18 15:09:15 -04:00
Steven Whitehouse
bd8968010a [GFS2] Remove semaphore.h from C files
We no longer use semaphores, everything has been converted to
mutex or rwsem, so we don't need to include this header any more.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-18 14:54:58 -04:00
Steven Whitehouse
1b50259bc3 [GFS2] Drop log lock on I/O error & tidy up
This patch drops the log spinlock when an I/O error occurs
to avoid any possible problems in case of blocking or
recursion in the I/O error routine. It also has a few
cosmetic changes to tidy up various other files.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-18 14:10:52 -04:00
Steven Whitehouse
02f211f4d0 [GFS2] Remove bits.c from the Makefile
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-18 14:03:43 -04:00
Steven Whitehouse
3efd7534a8 [GFS2] Make newly moved functions static
The functions moved from bits.c can now be made static.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-18 14:02:52 -04:00
Steven Whitehouse
88c8ab1fcb [GFS2] Merge bits.[ch] into rgrp.c
Since they are small and will be inlined by the complier,
it makes sense to merge the contents of bits.[ch] into
rgrp.c

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-18 13:52:39 -04:00
Steven Whitehouse
64c14ea73b [GFS2] Fix ref count bug that used to bite us on umount
The ref count of certain glock's got elevated too far during unlink
which caused umount to fail. This fixes it.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-16 13:37:11 -04:00
Steven Whitehouse
b9cb981310 [GFS2] Fix attributes setting logic
The attributes logic for immutable was wrong so that there was
not way to remove this attribute once set. This fixes the
bug.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-12 17:07:56 -04:00
Steven Whitehouse
9801f6461e [GFS2] Remove incorrect initialisation of gh_owner
The gh_owner field shouldn't be set or reset outside the glock code.
These were left over from when recursive locking was allowed. It
isn't any more, so they are not needed.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-12 14:06:02 -04:00
Steven Whitehouse
e90c01e148 [GFS2] Reverse block order in build_height
The original code ordered the blocks allocated in the build_height
routine backwards causing excessive disk seeks during a read of the
metadata. This patch reverses the order to try and reduce disk seeks.

Example: A five level metadata tree, I = Inode, P = Pointers, D = Data

You need to read the blocks in the order:

I P5 P4 P3 P2 P1 D

in order to read a single data block. The new code now orders the blocks
in this way. The old code used to order them as:

I P1 P2 P3 P4 P5 D

requiring two extra seeks on average. Note that for files which are
grown by gradual extension rather than by truncate or by llseek/write
at a large offset, this doesn't apply. In the case of writing to a
file linearly, this routine will only be called upon to extend the
height of the tree by one block at a time, so the ordering is
determined by when its called rather than by the internals of the
routine itself. Optimising that part of the ordering is a much
harder problem.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-12 12:09:15 -04:00
Steven Whitehouse
fd88de569b [GFS2] Readpages support
This adds readpages support (and also corrects a small bug in
the readpage error path at the same time). Hopefully this will
improve performance by allowing GFS to submit larger lumps of
I/O at a time.

In order to simplify the setting of BH_Boundary, it currently gets
set when we hit the end of a indirect pointer block. There is
always a boundary at this point with the current allocation code.
It doesn't get all the boundaries right though, so there is still
room for improvement in this.

See comments in fs/gfs2/ops_address.c for further information about
readpages with GFS2.

Signed-off-by: Steven Whitehouse
2006-05-05 16:59:11 -04:00
Robert S Peterson
5bb76af1e0 [GFS2] Set d_ops for root inode
Well, I managed to track down the bug in gfs2 that was causing
my grief.  Below is a patch for the problem.  Please incorporate
as you see fit.  Or should I say: as you see git.

The problem was basically that you never set d_ops for the root
inode, so the wrong hash algorithm was being used.  But only for
the root directory.  Turns out that if I used subdirectories, it
used the proper hash and my files were found just fine.

Signed-off-by: Robert S Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-05 16:29:50 -04:00
Steven Whitehouse
d2d7b8a2a7 [GFS2] Fix bug in writepage()
As pointed out by Wendy Cheng, the logic in GFS2's writepage() function
wasn't quite right with respect to invalidating pages when a file has been
truncated. This patch fixes that.

CC: Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-05-02 12:09:42 -04:00
Steven Whitehouse
56409abbf8 [GFS2] Remove some unused code
Remove some of the unused code flagged up by Adrian Bunk.

Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Steven Whitehouse
2006-04-28 11:48:45 -04:00
Adrian Bunk
08bc2dbc73 [GFS2] [-mm patch] fs/gfs2/: possible cleanups
This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 unused functions
- remove the following global function that was both unused and
  unimplemented:
  - super.c: gfs2_do_upgrade()

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-28 10:59:12 -04:00
Steven Whitehouse
363275216c [GFS2] Reordering in deallocation to avoid recursive locking
Despite my earlier careful search, there was a recursive lock left
in the deallocation code. This removes it. It also should speed up
deallocation be reducing the number of locking operations which take
place by using two "try lock" operations on the two locks involved in
inode deallocation which allows us to grab the locks out of order
(compared with NFS which grabs the inode lock first and the iopen
lock later). It is ok for us to fail while doing this since if it
does fail it means that someone else is still using the inode and
thus it wouldn't be possible to deallocate anyway.

This fixes the bug reported to me by Rob Kenna.

Cc: Rob Kenna <rkenna@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-28 10:46:21 -04:00
David Teigland
e7f5c01cad [GFS2] Remove redundant casts to/from void
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-27 11:25:45 -04:00
David Teigland
6bd70aba5a [DLM] lock_dlm recover_status patch
This saves the journal recovery result and makes it visible through sysfs.
User space needs to know if the node actually recovered the journal or
tried and gave up.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-26 15:56:35 -04:00
Steven Whitehouse
579b78a43b [GFS2] Remove GL_NEVER_RECURSE flag
There is no point in keeping this flag since recursion is not
now allowed for any glock.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-26 14:58:26 -04:00
Steven Whitehouse
5965b1f479 [GFS2] Don't do recursive locking in glock layer
This patch changes the last user of recursive locking so that
it no longer needs this feature and removes it from the glock
layer. This makes the glock code a lot simpler and easier to
understand. Its also a prerequsite to adding support for the
AOP_TRUNCATED_PAGE return code (or at least it is if you don't
want your brain to melt in the process)

I've left in a couple of checks just in case there is some place
else in the code which is still using this feature that I didn't
spot yet, but they can probably be removed long term.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-26 13:21:55 -04:00
David Teigland
3a2a9c96ac [GFS2] Update plock code in DLM locking module
We should be using fl_pid not fl_owner.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-25 15:45:51 -04:00
Steven Whitehouse
4bcf7091f9 [GFS2] Remove inherited flags from exported flags.
We don't need the inherited flags since this action can be
implied by setting the flags on directories where they
wouldn't otherwise make sense. It reduces the number of extra
flags by two. Also updated the list of flags to take account of
one extra ext2/3 flag.

Cc: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-25 13:20:27 -04:00
Steven Whitehouse
b5ea3e1ef3 [GFS2] Tidy up Makefile & Kconfig
Remove select of SYSFS as requested by Greg KH. Change whitespace to
tabs rather than spaces in places where it was incorrect and removed
'default m' as suggested by Adrian Bunk.

Reorganised Makefile as suggested by Sam Ravnborg.

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Adrian Bunk <bunk@stusta.de>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-24 14:14:42 -04:00
Steven Whitehouse
b800a1cb39 [GFS2] Tidy up daemon.c
As per Andrew Morton's comments, remove uneeded casts and use
wait_event_interruptible() rather than open code the wait.

Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-24 13:13:56 -04:00
Steven Whitehouse
61e085a88c [GFS2] Tidy up dir code as per Christoph Hellwig's comments
1. Comment whitespace fix
2. Removed unused header files from dir.c
3. Split the gfs2_dir_get_buffer() function into two functions

Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-24 10:07:13 -04:00
Steven Whitehouse
1e09ae544e [GFS2] Move BUG() back into the header file
In order to make the file and line number reporting work
correctly, this has been moved back into the header file.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-21 15:52:46 -04:00
Steven Whitehouse
1dde2dbfc7 [GFS2] Add back missing BUG()
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-21 15:39:02 -04:00
Steven Whitehouse
a74604bee2 [GFS2] sem -> mutex conversion in locking.c
Convert a semaphore to a mutex in locking.c and also tidy
up one or two loose ends.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-21 15:10:46 -04:00
David Teigland
c63e31c2cc [GFS2] journal recovery patch
This is one of the changes related to journal recovery I mentioned a
couple weeks ago.  We can get into a situation where there are only
readonly nodes currently mounting the fs, but there are journals that need
to be recovered.  Since the readonly nodes can't recover journals, the
next rw mounter needs to go through and check all journals and recover any
that are dirty (i.e. what the first node to mount the fs does).  This rw
mounter needs to skip the journals held by the existing readonly nodes.
Skipping those journals amounts to using the TRY flag on the journal locks
so acquiring the lock of a journal held by a readonly node will fail
instead of blocking indefinately.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-20 17:03:48 -04:00
Steven Whitehouse
190562bd84 [GFS2] Fix a bug: scheduling under a spinlock
At some stage, a mutex was added to gfs2_glock_put() without
checking all its call sites. Two of them were called from
under a spinlock causing random delays at various points and
crashes.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-20 16:57:23 -04:00
Steven Whitehouse
fe1bdedc6c [GFS2] Use vmalloc() in dir code
When allocating memory to sort directory entries, use vmalloc()
rather than kmalloc() since for larger directories, the required
size can easily be graeter than the 128k maximum of kmalloc().

Also adding the first steps towards getting the AOP_TRUNCATED_PAGE
return code get in the glock code by flagging all places where we
request a glock and we are holding a page lock.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-18 10:09:15 -04:00
Steven Whitehouse
4d8012b60e [GFS2] Fix bug which was causing postmark to fail
A typo in the directory code was causing postmark to fail
somewhere in the allocation code, since it was unable to
find newly allocated directory leaf blocks under certain
circumstances.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-12 17:39:45 -04:00
Steven Whitehouse
f4154ea039 [GFS2] Update journal accounting code.
A small update to the journaling code to change the way that
the "extra" blocks are accounted for in the journal. These are
used at a rate of one per 503 metadata blocks or one per 251
journaled data blocks (or just one if the total number of journaled
blocks in the transaction is smaller). Since we are using them at
two different rates the old method of accounting for them no longer
works and we count them up as required.

Since the "per transaction" accounting can't handle this (there is no
fixed number of header blocks per transaction) we have to account for
it in the general journal code. We now require that each transaction
reserves more blocks than it actually needs to take account of the
possible extra blocks.

Also a final fix to dir.c to ensure that all ref counts are handled
correctly.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-11 14:49:06 -04:00
Steven Whitehouse
ed3865079b [GFS2] Finally get ref counting correct
The last patch missed some other instances of incorrect ref counting,
this fixes all of those too.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-07 16:28:07 -04:00
Steven Whitehouse
b09e593d79 [GFS2] Fix a ref count bug and other clean ups
This fixes a ref count bug that sometimes showed up a umount time
(causing it to hang) but it otherwise mostly harmless. At the same
time there are some clean ups including making the log operations
structures const, moving a memory allocation so that its not done
in the fast path of checking to see if there is an outstanding
transaction related to a particular glock.

Removes the sd_log_wrap varaible which was updated, but never actually
used anywhere. Updates the gfs2 ioctl() to run without the kernel lock
(which it never needed anyway). Removes the "invalidate inodes" loop
from GFS2's put_super routine. This is done in kill super anyway so
we don't need to do it here. The loop was also bogus in that if there
are any inodes "stuck" at this point its a bug and we need to know
about it rather than hide it by hanging forever.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2006-04-07 11:17:32 -04:00