pandora-kernel.git
14 years agoocfs2: Give ocfs2_split_record() an extent_tree instead of an inode.
Joel Becker [Fri, 13 Feb 2009 10:56:23 +0000 (02:56 -0800)]
ocfs2: Give ocfs2_split_record() an extent_tree instead of an inode.

Another on the way to generic btree functions.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_insert_at_leaf() doesn't need struct inode.
Joel Becker [Fri, 13 Feb 2009 10:54:36 +0000 (02:54 -0800)]
ocfs2: ocfs2_insert_at_leaf() doesn't need struct inode.

Give it an ocfs2_extent_tree and it is happy.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Make truncating the extent map an extent_tree_operation.
Joel Becker [Fri, 13 Feb 2009 10:50:12 +0000 (02:50 -0800)]
ocfs2: Make truncating the extent map an extent_tree_operation.

ocfs2_remove_extent() wants to truncate the extent map if it's
truncating an inode data extent.  But since many btrees can call that
function, let's make it an op on ocfs2_extent_tree.  Other tree types
can leave it empty.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_truncate_rec() doesn't need struct inode.
Joel Becker [Fri, 13 Feb 2009 10:42:30 +0000 (02:42 -0800)]
ocfs2: ocfs2_truncate_rec() doesn't need struct inode.

It's not using it anymore.  Remove it from the parameter list.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_grow_branch() and ocfs2_append_rec_to_path() lose struct inode.
Joel Becker [Fri, 13 Feb 2009 10:24:10 +0000 (02:24 -0800)]
ocfs2: ocfs2_grow_branch() and ocfs2_append_rec_to_path() lose struct inode.

ocfs2_grow_branch() not really using it other than to pass it to the
subfunctions ocfs2_shift_tree_depth(), ocfs2_find_branch_target(), and
ocfs2_add_branch().  The first two weren't it either, so they drop the
argument.  ocfs2_add_branch() only passed it to
ocfs2_adjust_rightmost_branch(), which drops the inode argument and uses
the ocfs2_extent_tree as well.

ocfs2_append_rec_to_path() can be take an ocfs2_extent_tree instead of
the inode.  The function ocfs2_adjust_rightmost_records() goes along for
the ride.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_try_to_merge_extent() doesn't need struct inode.
Joel Becker [Fri, 13 Feb 2009 10:19:11 +0000 (02:19 -0800)]
ocfs2: ocfs2_try_to_merge_extent() doesn't need struct inode.

It's not using it, so remove it from the parameter list.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_merge_rec_left/right() no longer need struct inode.
Joel Becker [Fri, 13 Feb 2009 10:16:08 +0000 (02:16 -0800)]
ocfs2: ocfs2_merge_rec_left/right() no longer need struct inode.

Drop it from the parameters - they already have ocfs2_extent_list.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_rotate_tree_left() no longer needs struct inode.
Joel Becker [Fri, 13 Feb 2009 10:09:31 +0000 (02:09 -0800)]
ocfs2: ocfs2_rotate_tree_left() no longer needs struct inode.

It already gets ocfs2_extent_tree, so we can just use that.  This chains
to the same modification for ocfs2_remove_rightmost_path() and
ocfs2_rotate_rightmost_leaf_left().

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: __ocfs2_rotate_tree_left() doesn't need struct inode.
Joel Becker [Fri, 13 Feb 2009 03:47:43 +0000 (19:47 -0800)]
ocfs2: __ocfs2_rotate_tree_left() doesn't need struct inode.

It already has struct ocfs2_extent_tree, which has the caching info.  So
we don't need to pass it struct inode.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_rotate_subtree_left() doesn't need struct inode.
Joel Becker [Fri, 13 Feb 2009 03:45:28 +0000 (19:45 -0800)]
ocfs2: ocfs2_rotate_subtree_left() doesn't need struct inode.

It already has struct ocfs2_extent_tree, which has the caching info.  So
we don't need to pass it struct inode.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_update_edge_lengths() doesn't need struct inode.
Joel Becker [Fri, 13 Feb 2009 03:43:57 +0000 (19:43 -0800)]
ocfs2: ocfs2_update_edge_lengths() doesn't need struct inode.

Pass in the extent tree, which is all we need.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_rotate_tree_right() doesn't need struct inode.
Joel Becker [Fri, 13 Feb 2009 03:42:08 +0000 (19:42 -0800)]
ocfs2: ocfs2_rotate_tree_right() doesn't need struct inode.

We don't need struct inode in ocfs2_rotate_tree_right() anymore.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Drop struct inode from ocfs2_extent_tree_operations.
Joel Becker [Fri, 13 Feb 2009 03:32:43 +0000 (19:32 -0800)]
ocfs2: Drop struct inode from ocfs2_extent_tree_operations.

We can get to the inode from the caching information.  Other parent
types don't need it.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Pass ocfs2_extent_tree to ocfs2_get_subtree_root()
Joel Becker [Fri, 13 Feb 2009 03:20:13 +0000 (19:20 -0800)]
ocfs2: Pass ocfs2_extent_tree to ocfs2_get_subtree_root()

Get rid of the inode argument.  Use extent_tree instead.  This means a
few more functions have to pass an extent_tree around.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Get inode out of ocfs2_rotate_subtree_root_right().
Joel Becker [Fri, 13 Feb 2009 03:10:13 +0000 (19:10 -0800)]
ocfs2: Get inode out of ocfs2_rotate_subtree_root_right().

Pass the ocfs2_extent_list down through ocfs2_rotate_tree_right() and
get rid of struct inode in ocfs2_rotate_subtree_root_right().

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_complete_edge_insert() doesn't need struct inode at all.
Joel Becker [Fri, 13 Feb 2009 03:02:36 +0000 (19:02 -0800)]
ocfs2: ocfs2_complete_edge_insert() doesn't need struct inode at all.

Completely unused argument.  Get rid of it.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Pass ocfs2_extent_tree to ocfs2_unlink_path()
Joel Becker [Fri, 13 Feb 2009 02:57:52 +0000 (18:57 -0800)]
ocfs2: Pass ocfs2_extent_tree to ocfs2_unlink_path()

ocfs2_unlink_path() doesn't need struct inode, so let's pass it struct
ocfs2_extent_tree.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_create_new_meta_bhs() doesn't need struct inode.
Joel Becker [Fri, 13 Feb 2009 02:49:19 +0000 (18:49 -0800)]
ocfs2: ocfs2_create_new_meta_bhs() doesn't need struct inode.

Pass struct ocfs2_extent_tree into ocfs2_create_new_meta_bhs().  It no
longer needs struct inode or ocfs2_super.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_find_path() only needs the caching info
Joel Becker [Fri, 13 Feb 2009 02:08:48 +0000 (18:08 -0800)]
ocfs2: ocfs2_find_path() only needs the caching info

ocfs2_find_path and ocfs2_find_leaf() walk our btrees, reading extent
blocks.  They need struct ocfs2_caching_info for that, but not struct
inode.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Pass ocfs2_caching_info to ocfs2_read_extent_block().
Joel Becker [Fri, 13 Feb 2009 01:49:26 +0000 (17:49 -0800)]
ocfs2: Pass ocfs2_caching_info to ocfs2_read_extent_block().

extent blocks belong to btrees on more than just inodes, so we want to
pass the ocfs2_caching_info structure directly to
ocfs2_read_extent_block().  A number of places in alloc.c can now drop
struct inode from their argument list.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Store the ocfs2_caching_info on ocfs2_extent_tree.
Joel Becker [Fri, 13 Feb 2009 01:32:34 +0000 (17:32 -0800)]
ocfs2: Store the ocfs2_caching_info on ocfs2_extent_tree.

What do we cache?  Metadata blocks.  What are most of our non-inode metadata
blocks?  Extent blocks for our btrees.  struct ocfs2_extent_tree is the
main structure for managing those.  So let's store the associated
ocfs2_caching_info there.

This means that ocfs2_et_root_journal_access() doesn't need struct inode
anymore, and any place that has an et can refer to et->et_ci instead of
INODE_CACHE(inode).

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Pass struct ocfs2_caching_info to the journal functions.
Joel Becker [Fri, 13 Feb 2009 00:41:25 +0000 (16:41 -0800)]
ocfs2: Pass struct ocfs2_caching_info to the journal functions.

The next step in divorcing metadata I/O management from struct inode is
to pass struct ocfs2_caching_info to the journal functions.  Thus the
journal locks a metadata cache with the cache io_lock function.  It also
can compare ci_last_trans and ci_created_trans directly.

This is a large patch because of all the places we change
ocfs2_journal_access..(handle, inode, ...) to
ocfs2_journal_access..(handle, INODE_CACHE(inode), ...).

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: move ip_created_trans to struct ocfs2_caching_info
Joel Becker [Thu, 12 Feb 2009 23:41:59 +0000 (15:41 -0800)]
ocfs2: move ip_created_trans to struct ocfs2_caching_info

Similar ip_last_trans, ip_created_trans tracks the creation of a journal
managed inode.  This specifically tracks what transaction created the
inode.  This is so the code can know if the inode has ever been written
to disk.

This behavior is desirable for any journal managed object.  We move it
to struct ocfs2_caching_info as ci_created_trans so that any object
using ocfs2_caching_info can rely on this behavior.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: move ip_last_trans to struct ocfs2_caching_info
Joel Becker [Thu, 12 Feb 2009 23:24:40 +0000 (15:24 -0800)]
ocfs2: move ip_last_trans to struct ocfs2_caching_info

We have the read side of metadata caching isolated to struct
ocfs2_caching_info, now we need the write side.  This means the journal
functions.  The journal only does a couple of things with struct inode.

This change moves the ip_last_trans field onto struct
ocfs2_caching_info as ci_last_trans.  This field tells the journal
whether a pending journal flush is required.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Take the inode out of the metadata read/write paths.
Joel Becker [Wed, 11 Feb 2009 04:00:41 +0000 (20:00 -0800)]
ocfs2: Take the inode out of the metadata read/write paths.

We are really passing the inode into the ocfs2_read/write_blocks()
functions to get at the metadata cache.  This commit passes the cache
directly into the metadata block functions, divorcing them from the
inode.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Change metadata caching locks to an operations structure.
Joel Becker [Wed, 11 Feb 2009 03:00:37 +0000 (19:00 -0800)]
ocfs2: Change metadata caching locks to an operations structure.

We don't really want to cart around too many new fields on the
ocfs2_caching_info structure.  So let's wrap all our access of the
parent object in a set of operations.  One pointer on caching_info, and
more flexibility to boot.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Make the ocfs2_caching_info structure self-contained.
Joel Becker [Wed, 11 Feb 2009 00:05:07 +0000 (16:05 -0800)]
ocfs2: Make the ocfs2_caching_info structure self-contained.

We want to use the ocfs2_caching_info structure in places that are not
inodes.  To do that, it can no longer rely on referencing the inode
directly.

This patch moves the flags to ocfs2_caching_info->ci_flags, stores
pointers to the parent's locks on the ocfs2_caching_info, and renames
the constants and flags to reflect its independant state.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: ocfs2_write_begin_nolock() should handle len=0
Sunil Mushran [Fri, 4 Sep 2009 18:12:01 +0000 (11:12 -0700)]
ocfs2: ocfs2_write_begin_nolock() should handle len=0

Bug introduced by mainline commit e7432675f8ca868a4af365759a8d4c3779a3d922
The bug causes ocfs2_write_begin_nolock() to oops when len=0.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Cc: stable@kernel.org
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: invalidate dentry if its dentry_lock isn't initialized.
Tao Ma [Thu, 27 Aug 2009 06:46:56 +0000 (14:46 +0800)]
ocfs2: invalidate dentry if its dentry_lock isn't initialized.

In commit a5a0a630922a2f6a774b6dac19f70cb5abd86bb0, when
ocfs2_attch_dentry_lock fails, we call an extra iput and reset
dentry->d_fsdata to NULL. This resolve a bug, but it isn't
completed and the dentry is still there. When we want to use
it again, ocfs2_dentry_revalidate doesn't catch it and return
true. That make future ocfs2_dentry_lock panic out.
One bug is http://oss.oracle.com/bugzilla/show_bug.cgi?id=1162.

The resolution is to add a check for dentry->d_fsdata in
revalidate process and return false if dentry->d_fsdata is NULL,
so that a new ocfs2_lookup will be called again.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2/dlm: Wait on lockres instead of erroring cancel requests
Goldwyn Rodrigues [Thu, 20 Aug 2009 18:43:19 +0000 (13:43 -0500)]
ocfs2/dlm: Wait on lockres instead of erroring cancel requests

In case a downconvert is queued, and a flock receives a signal,
BUG_ON(lockres->l_action != OCFS2_AST_INVALID) is triggered
because a lock cancel triggers a dlmunlock while an AST is
scheduled.

To avoid this, allow a LKM_CANCEL to pass through, and let it
wait on __dlm_wait_on_lockres().

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de>
Acked-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Add missing lock name
Jan Kara [Thu, 20 Aug 2009 16:26:52 +0000 (18:26 +0200)]
ocfs2: Add missing lock name

There is missing name for NFSSync cluster lock. This makes lockdep unhappy
because we end up passing NULL to lockdep when initializing lock key. Fix it.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Don't oops in ocfs2_kill_sb on a failed mount
Jan Kara [Thu, 30 Jul 2009 15:01:53 +0000 (17:01 +0200)]
ocfs2: Don't oops in ocfs2_kill_sb on a failed mount

If we fail to mount the filesystem, we have to be careful not to dereference
uninitialized structures in ocfs2_kill_sb.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: release the buffer head in ocfs2_do_truncate.
Tao Ma [Wed, 12 Aug 2009 06:42:47 +0000 (14:42 +0800)]
ocfs2: release the buffer head in ocfs2_do_truncate.

In ocfs2_do_truncate, we forget to release last_eb_bh which
will cause memleak. So call brelse in the end.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Handle quota file corruption more gracefully
Jan Kara [Mon, 3 Aug 2009 16:24:21 +0000 (18:24 +0200)]
ocfs2: Handle quota file corruption more gracefully

ocfs2_read_virt_blocks() does BUG when we try to read a block from a file
beyond its end. Since this can happen due to filesystem corruption, it
is not really an appropriate answer. Make ocfs2_read_quota_block() check
the condition and handle it by calling ocfs2_error() and returning EIO.

[ Modified to print ip_blkno in the error - Joel ]

Reported-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Fix possible deadlock when extending quota file
Jan Kara [Thu, 6 Aug 2009 21:29:34 +0000 (23:29 +0200)]
ocfs2: Fix possible deadlock when extending quota file

In OCFS2, allocator locks rank above transaction start. Thus we
cannot extend quota file from inside a transaction less we could
deadlock.

We solve the problem by starting transaction not already in
ocfs2_acquire_dquot() but only in ocfs2_local_read_dquot() and
ocfs2_global_read_dquot() and we allocate blocks to quota files before starting
the transaction.  In case we crash, quota files will just have a few blocks
more but that's no problem since we just use them next time we extend the
quota file.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: keep index within status_map[]
Roel Kluin [Thu, 6 Aug 2009 23:07:50 +0000 (16:07 -0700)]
ocfs2: keep index within status_map[]

Do not exceed array status_map[]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Initialize the cluster we're writing to in a non-sparse extend
Sunil Mushran [Thu, 6 Aug 2009 23:12:58 +0000 (16:12 -0700)]
ocfs2: Initialize the cluster we're writing to in a non-sparse extend

In a non-sparse extend, we correctly allocate (and zero) the clusters between
the old_i_size and pos, but we don't zero the portions of the cluster we're
writing to outside of pos<->len.

It handles clustersize > pagesize and blocksize < pagesize.

[Cleaned up by Joel Becker.]

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Remove redundant BUG_ON in __dlm_queue_ast()
Goldwyn Rodrigues [Fri, 31 Jul 2009 19:28:02 +0000 (14:28 -0500)]
ocfs2: Remove redundant BUG_ON in __dlm_queue_ast()

We BUG_ON() the same thing twice.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2/quota: Release lock for error in ocfs2_quota_write.
Tao Ma [Thu, 30 Jul 2009 08:07:10 +0000 (16:07 +0800)]
ocfs2/quota: Release lock for error in ocfs2_quota_write.

ocfs2_quota_write needs to release the lock if it fails to
read quota block. So use "goto out" instead of "return err".

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Define credit counts for quota operations
Jan Kara [Wed, 22 Jul 2009 11:17:21 +0000 (13:17 +0200)]
ocfs2: Define credit counts for quota operations

Numbers of needed credits for some quota operations were written
as raw numbers. Create appropriate defines instead.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Remove syncjiff field from quota info
Jan Kara [Wed, 22 Jul 2009 11:17:20 +0000 (13:17 +0200)]
ocfs2: Remove syncjiff field from quota info

syncjiff is just a converted value of syncms. Some places which
are updating syncms forgot to update syncjiff as well. Since the
conversion is just a simple division / multiplication and it does
not happen frequently, just remove the syncjiff field to avoid
forgotten conversions.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Fix initialization of blockcheck stats
Jan Kara [Wed, 22 Jul 2009 11:17:19 +0000 (13:17 +0200)]
ocfs2: Fix initialization of blockcheck stats

We just set blockcheck stats to zeros but we should also
properly initialize the spinlock there.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Zero out padding of on disk dquot structure
Jan Kara [Wed, 22 Jul 2009 11:17:18 +0000 (13:17 +0200)]
ocfs2: Zero out padding of on disk dquot structure

Padding fields of on-disk dquot structure were not zeroed. Zero them
so that it's easier to use them later.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Initialize blocks allocated to local quota file
Jan Kara [Wed, 22 Jul 2009 11:17:17 +0000 (13:17 +0200)]
ocfs2: Initialize blocks allocated to local quota file

When we extend local quota file, we should initialize data
in newly allocated block. Firstly because on recovery we could
parse bogus data, secondly so that block checksums are properly
computed.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Mark buffer uptodate before calling ocfs2_journal_access_dq()
Jan Kara [Wed, 22 Jul 2009 11:17:16 +0000 (13:17 +0200)]
ocfs2: Mark buffer uptodate before calling ocfs2_journal_access_dq()

In a code path extending local quota files we marked new header
buffer uptodate only after calling ocfs2_journal_access_dq() which
triggers a bug. Fix it and also call ocfs2 variant of the function
marking buffer uptodate.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Make global quota files blocksize aligned
Jan Kara [Wed, 22 Jul 2009 11:17:15 +0000 (13:17 +0200)]
ocfs2: Make global quota files blocksize aligned

Change i_size of global quota files so that it always remains aligned to block
size. This is mainly because the end of quota block may contain checksum (if
checksumming is enabled) and it's a bit awkward for it to be "outside" of quota
file (and it makes life harder for ocfs2-tools).

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Use ocfs2_rec_clusters in ocfs2_adjust_adjacent_records.
Tao Ma [Thu, 23 Jul 2009 00:12:58 +0000 (08:12 +0800)]
ocfs2: Use ocfs2_rec_clusters in ocfs2_adjust_adjacent_records.

In ocfs2_adjust_adjacent_records, we will adjust adjacent records
according to the extent_list in the lower level. But actually
the lower level tree will either be a leaf or a branch. If we only
use ocfs2_is_empty_extent we will meet with some problem if the lower
tree is a branch (tree_depth > 1). So use !ocfs2_rec_clusters instead.
And actually only the leaf record can have holes. So add a BUG_ON
for non-leaf branch.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Fix deadlock on umount
Jan Kara [Mon, 20 Jul 2009 10:12:36 +0000 (12:12 +0200)]
ocfs2: Fix deadlock on umount

In commit ea455f8ab68338ba69f5d3362b342c115bea8e13, we moved the dentry lock
put process into ocfs2_wq. This causes problems during umount because ocfs2_wq
can drop references to inodes while they are being invalidated by
invalidate_inodes() causing all sorts of nasty things (invalidate_inodes()
ending in an infinite loop, "Busy inodes after umount" messages etc.).

We fix the problem by stopping ocfs2_wq from doing any further releasing of
inode references on the superblock being unmounted, wait until it finishes
the current round of releasing and finally cleaning up all the references in
dentry_lock_list from ocfs2_put_super().

The issue was tracked down by Tao Ma <tao.ma@oracle.com>.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Add extra credits and access the modified bh in update_edge_lengths.
Tao Ma [Tue, 21 Jul 2009 07:42:05 +0000 (15:42 +0800)]
ocfs2: Add extra credits and access the modified bh in update_edge_lengths.

In normal tree rotation left process, we will never touch the tree
branch above subtree_index and ocfs2_extend_rotate_transaction doesn't
reserve the credits for them either.

But when we want to delete the rightmost extent block, we have to update
the rightmost records for all the rightmost branch(See
ocfs2_update_edge_lengths), so we have to allocate extra credits for them.
What's more, we have to access them also.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Fail ocfs2_get_block() immediately when a block needs allocation
Wengang Wang [Mon, 13 Jul 2009 03:38:58 +0000 (11:38 +0800)]
ocfs2: Fail ocfs2_get_block() immediately when a block needs allocation

ocfs2_get_block() does no allocation.  Hole filling for writes should
have happened farther up in the call chain.  We detect this case and
print an error, but we then continue with the function.  We should be
exiting immediately.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Fix error return in ocfs2_write_cluster()
Wengang Wang [Mon, 13 Jul 2009 03:38:23 +0000 (11:38 +0800)]
ocfs2: Fix error return in ocfs2_write_cluster()

A typo caused ocfs2_write_cluster() to return 0 in some error cases.
Fix it.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Fix compilation warning for fs/ocfs2/xattr.c
Subrata Modak [Mon, 13 Jul 2009 19:49:31 +0000 (01:19 +0530)]
ocfs2: Fix compilation warning for fs/ocfs2/xattr.c

gcc 4.4.1 generates the following build warning on i386:

CC [M]  fs/ocfs2/xattr.o
fs/ocfs2/xattr.c: In function â€˜ocfs2_xattr_block_get’:
fs/ocfs2/xattr.c:1055: warning: â€˜block_off’ may be used uninitialized in this function

The following fix is based on a similar approach by David Howells
few days back: http://lkml.org/lkml/2009/7/9/109,

Signed-off-by: Subrata Modak<subrata@linux.vnet.ibm.com>,
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Initialize count in aio_write before generic_write_checks
Goldwyn Rodrigues [Sat, 11 Jul 2009 15:57:27 +0000 (10:57 -0500)]
ocfs2: Initialize count in aio_write before generic_write_checks

generic_write_checks() expects count to be initialized to the size of
the write.  Writes to files open with O_DIRECT|O_LARGEFILE write 0 bytes
because count is uninitialized.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: log the actual return value of ocfs2_file_aio_write()
Wengang Wang [Fri, 10 Jul 2009 05:26:04 +0000 (13:26 +0800)]
ocfs2: log the actual return value of ocfs2_file_aio_write()

in ocfs2_file_aio_write(), log_exit() could don't log the value
which is really returned. this patch fixes it.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: trivial fix for s/migrate/migration/ in dlmrecovery.c logging
Jeff Liu [Tue, 7 Jul 2009 07:51:40 +0000 (15:51 +0800)]
ocfs2: trivial fix for s/migrate/migration/ in dlmrecovery.c logging

in dlmrecovery.c:1121, replace 'migrate' to 'migration' to keep the consistency
by comparing to other lines with the similar log info in the same file.

Signed-off-by: Jeff Liu <jeff.liu@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agoocfs2: Fixup orphan scan cleanup after failed mount
Jeff Mahoney [Tue, 7 Jul 2009 21:22:12 +0000 (17:22 -0400)]
ocfs2: Fixup orphan scan cleanup after failed mount

If the mount fails for any reason, ocfs2_dismount_volume calls
ocfs2_orphan_scan_stop. It requires that ocfs2_orphan_scan_init
be called to setup the mutex and work queues, but that doesn't
happen if the mount has failed and we oops accessing an uninitialized
work queue.

This patch splits the init and startup of the orphan scan, eliminating
the oops.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
14 years agox86: don't clear nodes_states[N_NORMAL_MEMORY] when numa is not compiled in
Yinghai Lu [Wed, 8 Jul 2009 16:50:19 +0000 (09:50 -0700)]
x86: don't clear nodes_states[N_NORMAL_MEMORY] when numa is not compiled in

Alex found that specjbb2005 still can not run with hugepages on an
x86-64 machine.  This only happens when numa is not compiled in.

The root cause: node_set_state will not set it back for us in that case,
so don't clear that when numa is not select in config

[ v2: use node_clear_state instead ]
Reported-and-Tested-by: Alex Shi <alex.shi@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoRemove multiple KERN_ prefixes from printk formats
Joe Perches [Mon, 6 Jul 2009 20:05:40 +0000 (13:05 -0700)]
Remove multiple KERN_ prefixes from printk formats

Commit 5fd29d6ccbc98884569d6f3105aeca70858b3e0f ("printk: clean up
handling of log-levels and newlines") changed printk semantics.  printk
lines with multiple KERN_<level> prefixes are no longer emitted as
before the patch.

<level> is now included in the output on each additional use.

Remove all uses of multiple KERN_<level>s in formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agotty: maintainers data was edited wrongly by someone
Alan Cox [Tue, 7 Jul 2009 15:39:54 +0000 (16:39 +0100)]
tty: maintainers data was edited wrongly by someone

Move tty entries to tty not trivial. Noted by David Brownell.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agopty: Rework the pty layer to use the normal buffering logic
Alan Cox [Tue, 7 Jul 2009 15:39:41 +0000 (16:39 +0100)]
pty: Rework the pty layer to use the normal buffering logic

This fixes the ppp problems and various other issues with call locking
caused by one side of a pty called in one locking context trying to match
another with differing rules on the other side. We also get a big slack
space to work with that means we can bury the flow control deadlock case
for any conceivable real world situation.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
Linus Torvalds [Wed, 8 Jul 2009 16:36:46 +0000 (09:36 -0700)]
Merge branch 'fixes' of git://git./linux/kernel/git/davej/cpufreq

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] Powernow-k8: support family 0xf with 2 low p-states
  [CPUFREQ] fix (utter) cpufreq_add_dev mess
  [CPUFREQ] Cleanup locking in conservative governor
  [CPUFREQ] Cleanup locking in ondemand governor
  [CPUFREQ] Mark policy_rwsem as going static in cpufreq.c wont be exported
  [CPUFREQ] Eliminate the recent lockdep warnings in cpufreq

14 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
Linus Torvalds [Wed, 8 Jul 2009 16:35:50 +0000 (09:35 -0700)]
Merge branch 'for_linus' of git://git./linux/kernel/git/jack/linux-quota-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-quota-2.6:
  quota: Fix possible deadlock during parallel quotaon and quotaoff

14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
Linus Torvalds [Wed, 8 Jul 2009 16:35:22 +0000 (09:35 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/rafael/suspend-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
  PM: Clear -EAGAIN in dpm_prepare
  x86: Fix resume from suspend when CONFIG_CC_STACKPROTECTOR

14 years agointel-iommu: Fix intel_iommu_unmap_range() with size 0
Sheng Yang [Wed, 8 Jul 2009 10:52:52 +0000 (11:52 +0100)]
intel-iommu: Fix intel_iommu_unmap_range() with size 0

After some API change, intel_iommu_unmap_range() introduced a assumption that
parameter size != 0, otherwise the dma_pte_clean_range() would have a
overflowed argument. But the user like KVM don't have this assumption before,
then some BUG() triggered.

Fix it by ignoring size = 0.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoFree struct device in fw_dev_release()
Catalin Marinas [Wed, 8 Jul 2009 10:17:40 +0000 (11:17 +0100)]
Free struct device in fw_dev_release()

The f_dev in _request_firmware() is allocated via the fw_setup_device()
and fw_register_device() calls and its class set to firmware_class (the
class release function is fw_dev_release).

Commit 6acf70f078ca replaced the kfree(dev) in fw_dev_release() with a
put_device() call but my understanding is that the release function is
called via put_device -> kobject_put -> kref_put -> koject_release etc.
and it should call kfree since it's the last to see this device
structure alive.

Because of that, the _request_firmware() function on its -ENOENT error
path only calls device_unregister(f_dev) which would eventually call
fw_dev_release() but there is no kfree (the subsequent put_device call
would just make the kref negative).

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoFree the memory allocated by memdup_user() in fs/sysfs/bin.c
Catalin Marinas [Wed, 8 Jul 2009 10:17:34 +0000 (11:17 +0100)]
Free the memory allocated by memdup_user() in fs/sysfs/bin.c

Commit 1c8542c7bb replaced kmalloc() with memdup_user() in the write()
function but also dropped the kfree(temp). The memdup_user() function
allocates memory which is never freed.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Parag Warudkar <parag.warudkar@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Linus Torvalds [Wed, 8 Jul 2009 16:32:41 +0000 (09:32 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: gpio_mouse - use standard driver registration method
  Input: mark serio and i8042 as suspended when hibernating too
  Input: add support for generic GPIO-based matrix keypad
  Input: arrange keyboards alphabetically
  Input: gpio-keys - avoid possibility of sleeping in timer function
  Input: gpio-keys - revert 'change timer to workqueue'
  Input: dm355evm_keys - fix kconfig symbol names
  Input: wacom - add DTF720a support and fix rotation on Intuos3
  Input: i8042 - more reset quirks for MSI Wind-clone netbooks

14 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Wed, 8 Jul 2009 16:32:20 +0000 (09:32 -0700)]
Merge branch 'merge' of git://git./linux/kernel/git/benh/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  powerpc: Don't use alloc_bootmem() in init_IRQ() path
  powerpc: Fix spin_event_timeout() to be robust over context switches
  powerpc: Use pr_devel() in do_dcache_icache_coherency()
  powerpc/cell: Use pr_devel() in axon_msi.c
  powerpc: Use pr_devel() in arch/powerpc/mm/gup.c
  powerpc: Cleanup & use pr_devel() in arch/powerpc/mm/slb.c
  powerpc/perf_counter: Remove duplicated #include
  powerpc: Use pr_devel() in arch/powerpc/mm/mmu_context_nohash.c
  powerpc/pseries: Use pr_devel() in xics.c
  powerpc: Remove unnecessary semicolons
  powerpc/pseries: Use pr_devel() in pseries LPAR HPTE routines
  powerpc/44x: Fix build error with -Werror for Warp platform
  powerpc/4xx: Have Warp take advantage of GPIO LEDs default-state = keep
  powerpc/44x: Update Warp defconfig

14 years agoheaders: mnt_namespace.h redux
Alexey Dobriyan [Tue, 7 Jul 2009 21:54:37 +0000 (01:54 +0400)]
headers: mnt_namespace.h redux

Fix various silly problems wrt mnt_namespace.h:

 - exit_mnt_ns() isn't used, remove it
 - done that, sched.h and nsproxy.h inclusions aren't needed
 - mount.h inclusion was need for vfsmount_lock, but no longer
 - remove mnt_namespace.h inclusion from files which don't use anything
   from mnt_namespace.h

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'sh/for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal...
Linus Torvalds [Wed, 8 Jul 2009 16:24:01 +0000 (09:24 -0700)]
Merge branch 'sh/for-2.6.31' of git://git./linux/kernel/git/lethal/sh-2.6

* 'sh/for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  serial: sh-sci: fix sci interrupt handler
  video: hitfb: Move over to dev_pm_ops.
  video: hitfb: Convert to framebuffer_alloc().
  video: sh_mobile_lcdcfb: Convert to framebuffer_alloc().
  sh: add r8a66597 usb0 host to the se7724 board
  usb: allow sh7724 to enable on-chip r8a66597
  sh-sci: update receive error handling for muxed irqs
  sh: define PERF_COUNTER_INDEX_OFFSET.

14 years agoRevert "fb: Initialize fb_info mutexes in framebuffer_alloc()"
Linus Torvalds [Wed, 8 Jul 2009 16:20:11 +0000 (09:20 -0700)]
Revert "fb: Initialize fb_info mutexes in framebuffer_alloc()"

This reverts commit 4148df9b0f38bdd362dd91d52076926c11cbe5a9.

Let's hope that the mm_lock initialization is now correct with all
drivers, following Krzysztof's patches.

Requested-by: Krzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agomatroxfb: fix regression with uninitalized fb_info->mm_lock mutex (second head)
Krzysztof Helt [Tue, 7 Jul 2009 20:34:13 +0000 (22:34 +0200)]
matroxfb: fix regression with uninitalized fb_info->mm_lock mutex (second head)

Remove redundant locking by the mm_lock mutex before a second head of
matrox framebuffer is registered.

This fixes a problem with uninitialized the fb_info->mm_lock mutex
introduced by the commit 537a1bf059f " fbdev: add mutex for fb_mmap
locking"

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agomatroxfb: fix regression with uninitalized fb_info->mm_lock mutex
Krzysztof Helt [Tue, 7 Jul 2009 20:06:48 +0000 (22:06 +0200)]
matroxfb: fix regression with uninitalized fb_info->mm_lock mutex

Remove redundant call to the matroxfb_update_fix() before matrox
frambuffer is registered.

This fixes a problem with uninitialized the fb_info->mm_lock mutex
introduced by the commit 537a1bf059f " fbdev: add mutex for fb_mmap
locking"

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agow100fb: fix regression with uninitalized fb_info->mm_lock mutex
Krzysztof Helt [Tue, 7 Jul 2009 17:24:54 +0000 (19:24 +0200)]
w100fb: fix regression with uninitalized fb_info->mm_lock mutex

Remove redundant call to the w100fb_set_par() before w100 frambuffer is
registered.

This fixes a problem with uninitialized the fb_info->mm_lock mutex
introduced by the commit 537a1bf059f " fbdev: add mutex for fb_mmap
locking"

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoatafb: fix regression with uninitalized fb_info->mm_lock mutex
Krzysztof Helt [Tue, 7 Jul 2009 17:15:16 +0000 (19:15 +0200)]
atafb: fix regression with uninitalized fb_info->mm_lock mutex

Remove redundant locking of the fb_info->mm_lock mutex before the
frambuffer is registered.

This fixes a problem with uninitialized the fb_info->mm_lock mutex
introduced by the commit 537a1bf059f " fbdev: add mutex for fb_mmap
locking"

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoi810fb: fix regression with uninitalized fb_info->mm_lock mutex
Krzysztof Helt [Tue, 7 Jul 2009 17:07:57 +0000 (19:07 +0200)]
i810fb: fix regression with uninitalized fb_info->mm_lock mutex

Remove redundant call to the encode_fix() before i810 frambuffer is
registered.

This fixes a problem with uninitialized the fb_info->mm_lock mutex
introduced by the commit 537a1bf059f " fbdev: add mutex for fb_mmap
locking"

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoelfcore.h : Fix UML build breakage
Parag Warudkar [Wed, 8 Jul 2009 15:46:02 +0000 (11:46 -0400)]
elfcore.h : Fix UML build breakage

Commit a65e7bfcd74e4c0939f235d2bf9f48ddb3a57991 broke the UML build with
the following error -

  In file included from fs/proc/kcore.c:17:
  include/linux/elfcore.h: In function 'elf_core_copy_task_regs':
  include/linux/elfcore.h:129: error: implicit declaration of function 'task_pt_regs'

Fix this by restoring the previous behavior of returning 0 for all arches
like UML that don't define task_pt_regs.

Signed-off-by: Parag Warudkar <parag.lkml@gmail.com>
Acked-by: Amerigo Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoPM: Clear -EAGAIN in dpm_prepare
Sebastian Ott [Wed, 8 Jul 2009 11:26:05 +0000 (13:26 +0200)]
PM: Clear -EAGAIN in dpm_prepare

When the last device in the dpm list is unregistered directly after its
prepare() callback returned with -EAGAIN, the return code is passed to
the calling function, resulting in a suspend failure. Prevent this by
clearing the return code after -EAGAIN.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
14 years agox86: Fix resume from suspend when CONFIG_CC_STACKPROTECTOR
Peter Chubb [Wed, 8 Jul 2009 11:20:13 +0000 (13:20 +0200)]
x86: Fix resume from suspend when CONFIG_CC_STACKPROTECTOR

Patch 08687aec71bc9134fe336e561f6did877bacf74fc0a (x86: unify
power/cpu_(32|64).c)  renamed cpu_32.c to cpu.c, but did not update
the special compilation flags for the file for the new name.

This patch fixes the compilation flags, and therefore fixes resume
from suspend on my Acer Aspire One.

[rjw: The regression from 2.6.30 fixed by this patch is tracked as
 http://bugzilla.kernel.org/show_bug.cgi?id=13661]

Signed-off-by: Peter Chubb <peterc@nicta.com.au>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
14 years agoInput: gpio_mouse - use standard driver registration method
Saeed Bishara [Wed, 8 Jul 2009 05:11:52 +0000 (22:11 -0700)]
Input: gpio_mouse - use standard driver registration method

This patch is needed when the gpio's became available only at late
stages, for example, when using i2c gpio expander.

Signed-off-by: Saeed Bishara <saeed@marvell.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
14 years agoInput: mark serio and i8042 as suspended when hibernating too
Thadeu Lima de Souza Cascardo [Wed, 8 Jul 2009 05:10:02 +0000 (22:10 -0700)]
Input: mark serio and i8042 as suspended when hibernating too

Serio ports are not being restarted any longer because resume operations
after hibernate do nothing, since the device has not been marked as
suspended. This happens because suspend is only considering the SUSPEND
event but not the FREEZE event.

Note that this driver has still to migrate to dev_pm_ops, but this fixes
this particular bug now.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
14 years agopowerpc: Don't use alloc_bootmem() in init_IRQ() path
Anton Vorontsov [Wed, 1 Jul 2009 10:59:57 +0000 (10:59 +0000)]
powerpc: Don't use alloc_bootmem() in init_IRQ() path

This patch fixes various badnesses like this for all interrupt
controllers:

------------[ cut here ]------------
Badness at c04db9dc [verbose debug info unavailable]
NIP: c04db9dc LR: c04db9ac CTR: 00000000
REGS: c053de30 TRAP: 0700   Not tainted  (2.6.31-rc1-00432-ge69b2b5-dirty)
MSR: 00021000 <ME,CE>  CR: 22020084  XER: 00000000
TASK = c0500480[0] 'swapper' THREAD: c053c000
GPR00: 00000001 c053dee0 c0500480 00000000 00000050 00000020 3fffffff 00000000
GPR08: 00000001 c0540000 e0080080 00000000 22000084 64183600 3ff8f800 00000000
GPR16: 841b0240 449a0303 00000000 00000000 00000000 00000000 00000000 c04f5bf4
GPR24: 00000000 00000000 00000000 00000050 00000020 00000000 3fffffff 00000050
NIP [c04db9dc] alloc_arch_preferred_bootmem+0x48/0x74
LR [c04db9ac] alloc_arch_preferred_bootmem+0x18/0x74
Call Trace:
[c053dee0] [c000a5a4] __of_address_to_resource+0x44/0xd0 (unreliable)
[c053def0] [c04dba58] ___alloc_bootmem_nopanic+0x50/0x108
[c053df20] [c04dbb28] ___alloc_bootmem+0x18/0x50
[c053df30] [c04d5de0] qe_ic_init+0x5c/0x1b0
[c053df70] [c04d77b0] mpc85xx_mds_pic_init+0xb8/0x10c
[c053dfb0] [c04cf374] init_IRQ+0x28/0x3c

p.s. commit 85355bb272db31a3f2dd99d547eef794805e1319 ("powerpc: Fix
mpic alloc warning") missed some alloc_bootmem() instances, this is
now fixed.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc: Fix spin_event_timeout() to be robust over context switches
Grant Likely [Mon, 29 Jun 2009 13:40:51 +0000 (13:40 +0000)]
powerpc: Fix spin_event_timeout() to be robust over context switches

Current implementation of spin_event_timeout can be interrupted by an
IRQ or context switch after testing the condition, but before checking
the timeout.  This can cause the loop to report a timeout when the
condition actually became true in the middle.

This patch adds one final check of the condition upon exit of the loop
if the last test of the condition was still false.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc: Use pr_devel() in do_dcache_icache_coherency()
Michael Ellerman [Wed, 17 Jun 2009 18:13:52 +0000 (18:13 +0000)]
powerpc: Use pr_devel() in do_dcache_icache_coherency()

pr_debug() can now result in code being generated even when DEBUG
is not defined. That's not really desirable in some places.

With CONFIG_DYNAMIC_DEBUG=y:

size before:
   text    data     bss     dec     hex filename
   2036     368       8    2412     96c arch/powerpc/mm/pgtable.o

size after:
   text    data     bss     dec     hex filename
   1677     248       8    1933     78d arch/powerpc/mm/pgtable.o

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc/cell: Use pr_devel() in axon_msi.c
Michael Ellerman [Wed, 17 Jun 2009 18:13:53 +0000 (18:13 +0000)]
powerpc/cell: Use pr_devel() in axon_msi.c

pr_debug() can now result in code being generated even when DEBUG
is not defined. That's not really desirable in some places.

With CONFIG_DYNAMIC_DEBUG=y:

size before:
   text    data     bss     dec     hex filename
   7083    1616       0    8699    21fb arch/powerpc/../axon_msi.o

size after:
   text    data     bss     dec     hex filename
   5772    1208       0    6980    1b44 arch/powerpc/../axon_msi.o

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc: Use pr_devel() in arch/powerpc/mm/gup.c
Michael Ellerman [Wed, 17 Jun 2009 18:13:51 +0000 (18:13 +0000)]
powerpc: Use pr_devel() in arch/powerpc/mm/gup.c

pr_debug() can now result in code being generated even when DEBUG
is not defined. That's not really desirable in some places.

With CONFIG_DYNAMIC_DEBUG=y:

size before:
   text    data     bss     dec     hex filename
   3252     384       0    3636     e34 arch/powerpc/mm/gup.o

size after:
   text    data     bss     dec     hex filename
   2576      96       0    2672     a70 arch/powerpc/mm/gup.o

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc: Cleanup & use pr_devel() in arch/powerpc/mm/slb.c
Michael Ellerman [Wed, 17 Jun 2009 18:13:51 +0000 (18:13 +0000)]
powerpc: Cleanup & use pr_devel() in arch/powerpc/mm/slb.c

pr_debug() can now result in code being generated even when DEBUG
is not defined. That's not really desirable in some places.

With CONFIG_DYNAMIC_DEBUG=y:

size before:
   text    data     bss     dec     hex filename
   3261     416       4    3681     e61 arch/powerpc/mm/slb.o

size after:
   text    data     bss     dec     hex filename
   2861     248       4    3113     c29 arch/powerpc/mm/slb.o

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc/perf_counter: Remove duplicated #include
Huang Weiyi [Sat, 20 Jun 2009 13:37:00 +0000 (13:37 +0000)]
powerpc/perf_counter: Remove duplicated #include

Remove duplicated #include('s) in
  arch/powerpc/kernel/mpc7450-pmu.c
  arch/powerpc/kernel/ppc970-pmu.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc: Use pr_devel() in arch/powerpc/mm/mmu_context_nohash.c
Michael Ellerman [Wed, 17 Jun 2009 18:13:54 +0000 (18:13 +0000)]
powerpc: Use pr_devel() in arch/powerpc/mm/mmu_context_nohash.c

pr_debug() can now result in code being generated even when DEBUG
is not defined. That's not really desirable in some places.

With CONFIG_DYNAMIC_DEBUG=y:

size before:
   text    data     bss     dec     hex filename
   1508      48      28    1584     630 powerpc/mm/mmu_context_nohash.o

size after:
   text    data     bss     dec     hex filename
   1088       0      28    1116     45c powerpc/mm/mmu_context_nohash.o

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc/pseries: Use pr_devel() in xics.c
Michael Ellerman [Wed, 17 Jun 2009 18:13:53 +0000 (18:13 +0000)]
powerpc/pseries: Use pr_devel() in xics.c

pr_debug() can now result in code being generated even when DEBUG
is not defined. That's not really desirable in some places.

With CONFIG_DYNAMIC_DEBUG=y:

size before:
   text    data     bss     dec     hex filename
   7720    5488     296   13504    34c0 platforms/pseries/xics.o

size after:
   text    data     bss     dec     hex filename
   7535    5456     296   13287    33e7 platforms/pseries/xics.o

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc: Remove unnecessary semicolons
Joe Perches [Sun, 28 Jun 2009 06:26:10 +0000 (06:26 +0000)]
powerpc: Remove unnecessary semicolons

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agopowerpc/pseries: Use pr_devel() in pseries LPAR HPTE routines
Michael Ellerman [Wed, 17 Jun 2009 18:13:50 +0000 (18:13 +0000)]
powerpc/pseries: Use pr_devel() in pseries LPAR HPTE routines

pr_debug() can now result in code being generated even when DEBUG
is not defined. That's not really desirable in some places.

In particular, pSeries_lpar_hpte_insert() goes from 185 instructions
to 77 instructions as a result of this patch. Luckily that code
isn't called very often ...

With CONFIG_DYNAMIC_DEBUG=y:

size before:
   text    data     bss     dec     hex filename
   7284    1552     296    9132    23ac platforms/pseries/lpar.o

size after:
   text    data     bss     dec     hex filename
   5806    1096     296    7198    1c1e platforms/pseries/lpar.o

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
14 years agoMerge commit 'jwb/merge' into merge
Benjamin Herrenschmidt [Wed, 8 Jul 2009 03:49:38 +0000 (13:49 +1000)]
Merge commit 'jwb/merge' into merge

14 years agoquota: Fix possible deadlock during parallel quotaon and quotaoff
Jiaying Zhang [Tue, 7 Jul 2009 16:15:21 +0000 (18:15 +0200)]
quota: Fix possible deadlock during parallel quotaon and quotaoff

The following test script triggers a deadlock on ext2 filesystem:
while true; do quotaon /dev/hda >&/dev/null; usleep $RANDOM; done &
while true; do quotaoff /dev/hda >&/dev/null; usleep $RANDOM; done &

I found there is a potential deadlock between quotaon and quotaoff (or
quotasync). Basically, all of quotactl operations need to be protected by
dqonoff_mutex. vfs_quota_off and vfs_quota_sync also call sb->s_op->quota_write
that needs to grab the i_mutex of the quota file.  But in vfs_quota_on_inode
(called from quotaon operation), the current code tries to grab  the i_mutex of
the quota file first before getting quonoff_mutex.

Reverse the order in which we take locks in vfs_quota_on_inode().

Jan Kara: Changed changelog to be more readable, made lockdep happy with
  I_MUTEX_QUOTA.

Signed-off-by: Jiaying Zhang <jiayingz@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoserial: sh-sci: fix sci interrupt handler
SUGIOKA Toshinobu [Tue, 7 Jul 2009 05:32:07 +0000 (05:32 +0000)]
serial: sh-sci: fix sci interrupt handler

Fix up the error bit handling on SCI ports.

Signed-off-by: SUGIOKA Toshinobu <sugioka@itonet.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux...
Paul Mundt [Tue, 7 Jul 2009 02:55:05 +0000 (11:55 +0900)]
Merge branch 'master' of git://git./linux/kernel/git/torvalds/linux-2.6 into sh/for-2.6.31

14 years agovideo: hitfb: Move over to dev_pm_ops.
Paul Mundt [Tue, 7 Jul 2009 02:50:57 +0000 (11:50 +0900)]
video: hitfb: Move over to dev_pm_ops.

A trivial update to move hitfb over to dev_pm_ops.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agovideo: hitfb: Convert to framebuffer_alloc().
Paul Mundt [Tue, 7 Jul 2009 02:44:56 +0000 (11:44 +0900)]
video: hitfb: Convert to framebuffer_alloc().

Follows the sh_mobile_lcdcfb change.

Also fixes up a memory leak with cmap allocation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years agovideo: sh_mobile_lcdcfb: Convert to framebuffer_alloc().
Paul Mundt [Tue, 7 Jul 2009 02:24:32 +0000 (11:24 +0900)]
video: sh_mobile_lcdcfb: Convert to framebuffer_alloc().

All fb_info structures need to be allocated with framebuffer_alloc() due
to special initialization. Switch over to it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
14 years ago[CPUFREQ] Powernow-k8: support family 0xf with 2 low p-states
Mark Langsdorf [Sun, 26 Jul 2009 15:55:25 +0000 (10:55 -0500)]
[CPUFREQ] Powernow-k8: support family 0xf with 2 low p-states

Provide support for family 0xf processors with 2 P-states
below the elevator voltage.  Remove the checks that prevent
this configuration from being supported and increase the
transition voltage to prevent errors during the transition.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Signed-off-by: Dave Jones <davej@redhat.com>