55 Commits
Author SHA1 Message Date
David Sterba 0942caa373 btrfs: add missing options displayed in mount output
There are three missed mount options settable by user which are not
currently displayed in mount output.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
2011-07-06 18:46:43 -04:00
David Sterba 35a30d7ce5 btrfs: fix uninitialized return value
When allocation fails in btrfs_read_fs_root_no_name, ret is not set
although it is returned, holding a garbage value.

Signed-off-by: David Sterba <[email protected]>
Reviewed-by: Li Zefan <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
2011-06-17 14:54:18 -04:00
David Sterba 3ed4498caf btrfs: fix dereference of ERR_PTR value
smatch reports:

btrfs_recover_log_trees error: 'wc.replay_dest' dereferencing
possible ERR_PTR()

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
2011-06-17 14:54:17 -04:00
David Sterba 5be76758f3 btrfs: fix unlocked access of delalloc_inodes
list_splice_init will make delalloc_inodes empty, but without a spinlock
around, this may produce corrupted list head, accessed in many placess,
The race window is very tight and nobody seems to have hit it so far.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
2011-06-10 18:57:11 -04:00
David Sterba aa0467d8d2 btrfs: fix uninitialized variable warning
With Linus' tree, today's linux-next build (powercp ppc64_defconfig)
produced this warning:

fs/btrfs/delayed-inode.c: In function 'btrfs_delayed_update_inode':
fs/btrfs/delayed-inode.c:1598:6: warning: 'ret' may be used
uninitialized in this function

Introduced by commit 16cdcec736 ("btrfs: implement delayed inode items
operation").

This fixes a bug in btrfs_update_inode(): if the returned value from
btrfs_delayed_update_inode is a nonzero garbage, inode stat data are not
updated and several call paths may hit a BUG_ON or fail with strange
code.

Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: David Sterba <[email protected]>
2011-06-04 08:11:38 -04:00
David Sterba 7841cb2898 btrfs: add helper for fs_info->closing
wrap checking of filesystem 'closing' flag and fix a few missing memory
barriers.

Signed-off-by: David Sterba <[email protected]>
2011-06-04 08:11:22 -04:00
David Sterba a4689d2bd3 btrfs: use btrfs_ino to access inode number
commit 4cb5300bc ("Btrfs: add mount -o auto_defrag") accesses inode
number directly while it should use the helper with the new inode
number allocator.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
2011-06-04 08:03:46 -04:00
David Sterba 4ea028859b btrfs: use unsigned type for single bit bitfield
Signed-off-by: David Sterba <[email protected]>
2011-05-12 18:14:53 +02:00
David Sterba 7a36ddec10 btrfs: use printk_ratelimited instead of printk_ratelimit
As per printk_ratelimit comment, it should not be used.

Signed-off-by: David Sterba <[email protected]>
2011-05-12 18:08:38 +02:00
David Sterba 182608c829 btrfs: remove old unused commented out code
Remove code which has been #if0-ed out for a very long time and does not
seem to be related to current codebase anymore.

Signed-off-by: David Sterba <[email protected]>
2011-05-06 12:34:10 +02:00
David Sterba f2a97a9dbd btrfs: remove all unused functions
Remove static and global declarations and/or definitions. Reduces size
of btrfs.ko by ~3.4kB.

  text    data     bss     dec     hex filename
402081    7464     200  409745   64091 btrfs.ko.base
398620    7144     200  405964   631cc btrfs.ko.remove-all

Signed-off-by: David Sterba <[email protected]>
2011-05-06 12:34:03 +02:00
David Sterba 621496f4fd btrfs: remove unused function prototypes
function prototypes without a body

Signed-off-by: David Sterba <[email protected]>
2011-05-04 14:01:26 +02:00
David Sterba 8cc33e5c19 btrfs: Document a mutex lock/unlock sequence 2011-05-02 15:29:25 +02:00
David Sterba b3b4aa74b5 btrfs: drop unused parameter from btrfs_release_path
parameter tree root it's not used since commit
5f39d397df ("Btrfs: Create extent_buffer
interface for large blocksizes")

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:22 +02:00
David Sterba ba14419264 btrfs: drop gfp parameter from alloc_extent_buffer
pass GFP_NOFS directly to kmem_cache_alloc

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:22 +02:00
David Sterba f09d1f60e6 btrfs: drop gfp parameter from find_extent_buffer
pass GFP_NOFS directly to kmem_cache_alloc

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:22 +02:00
David Sterba 172ddd60a6 btrfs: drop gfp parameter from alloc_extent_map
pass GFP_NOFS directly to kmem_cache_alloc

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:21 +02:00
David Sterba a8067e022a btrfs: drop unused parameter from extent_map_tree_init
the GFP flags are not stored anywhere and all allocations are done via
alloc_extent_map(GFP_NOFS).

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:21 +02:00
David Sterba f993c883ad btrfs: drop unused argument from extent_io_tree_init
all callers pass GFP_NOFS, but the GFP mask argument is not used in the
function; GFP_ATOMIC is passed to radix tree initialization and it's the
only correct one, since we're using the preload/insert mechanism of
radix tree.
Let's drop the gfp mask from btrfs function, this will not change
behaviour.

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:21 +02:00
David Sterba 62a45b6092 btrfs: make functions static when possible
Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:20 +02:00
David Sterba c704005d88 btrfs: unify checking of IS_ERR and null
use IS_ERR_OR_NULL when possible, done by this coccinelle script:

@ match @
identifier id;
@@
(
- BUG_ON(IS_ERR(id) || !id);
+ BUG_ON(IS_ERR_OR_NULL(id));
|
- IS_ERR(id) || !id
+ IS_ERR_OR_NULL(id)
|
- !id || IS_ERR(id)
+ IS_ERR_OR_NULL(id)
)

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:20 +02:00
David Sterba 4891aca2da btrfs: fix dereference before check
The superblock's ->s_fs_info is properly set in btrfs_fill_super, after
a call to open_ctree, which derefereces it before check. Although
tree_root is set via btrfs_set_super, let's be defensive and leave the
check in place.

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:20 +02:00
David Sterba edc95aec57 btrfs: remove nested duplicate variable declarations
Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:19 +02:00
David Sterba 306e16ce13 btrfs: rename variables clashing with global function names
reported by gcc -Wshadow:
page_index, page_offset, new_inode, dev_name

Signed-off-by: David Sterba <[email protected]>
2011-05-02 13:57:19 +02:00
David Sterba 45c51b9994 xfs: cleanup duplicate initializations
follow these guidelines:
- leave initialization in the declaration block if it fits the line
- move to the code where it's more suitable ('for' init block)

The last chunk was modified from David's original to be a correct
fix for what appeared to be a duplicate initialization.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Alex Elder <[email protected]>
Reviewed-by: Dave Chinner <[email protected]>
2011-04-28 13:25:29 -05:00
David Sterba cfece4db11 btrfs: add missing spin_unlock to a rare exit path
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
2011-04-25 19:43:52 -04:00
David Sterba b4232a2277 netfilter: h323: bug in parsing of ASN1 SEQOF field
Static analyzer of clang found a dead store which appears to be a bug in
reading count of items in SEQOF field, only the lower byte of word is
stored. This may lead to corrupted read and communication shutdown.

The bug has been in the module since it's first inclusion into linux
kernel.

[Patrick: the bug is real, but without practical consequence since the
 largest amount of sequence-of members we parse is 30.]

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Patrick McHardy <[email protected]>
2011-04-04 15:21:02 +02:00
David Sterba f07ef1de9b crypto: tcrypt - do not attempt to write to readonly variable
Commit da7f033ddc (”crypto: cryptomgr - Add test infrastructure”) added a
const to variable which is later used as target buffer of memcpy.

crypto/tcrypt.c:217:12: warning: passing 'const char (*)[128]' to parameter of type 'void *' discards qualifiers
                                memset(&iv, 0xff, iv_len);


crypto/tcrypt.c:test_cipher_speed()

-       unsigned char *key, iv[128];
+       const char *key, iv[128];
...
        memset(&iv, 0xff, iv_len);

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
2011-03-04 15:28:52 +08:00
David Sterba 0cdfb819b6 USB: cdc-wdm: fix misuse of logical operation in place of bitop
CC: Greg Kroah-Hartman <[email protected]>
CC: Oliver Neukum <[email protected]>
CC: Marcel Holtmann <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2011-01-22 18:32:55 -08:00
David Sterba 4571928fc7 Bluetooth: l2cap: fix misuse of logical operation in place of bitop
CC: Marcel Holtmann <[email protected]>
CC: "Gustavo F. Padovan" <[email protected]>
CC: João Paulo Rechi Vita <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Gustavo F. Padovan <[email protected]>
2011-01-19 14:40:42 -02:00
David Sterba 824f5f38d3 tg3: fix return value check in tg3_read_vpd()
Besides -ETIMEDOUT and -EINTR, pci_read_vpd may return other error
values like -ENODEV or -EINVAL which are ignored due to the buggy
check, but the data are not read from VPD anyway and this is checked
subsequently with at most 3 needless loop iterations. This does not
show up as a runtime bug.

CC: Matt Carlson <[email protected]>
CC: Michael Chan <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
2010-12-31 12:31:01 -08:00
David Sterba ef11e701f3 Input: bu21013_ts - fix misuse of logical operation in place of bitop
Signed-off-by: David Sterba <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
2010-12-27 17:23:10 -08:00
David Sterba e7bf068aa3 i7core_edac: fix typos in comments
Signed-off-by: Jiri Kosina <[email protected]>
2010-12-28 01:20:51 +01:00
David Sterba 86280a2088 HID: picolcd: fix misuse of logical operation in place of bitop
CC: Bruno Prémont <[email protected]>
CC: Jiri Kosina <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
2010-12-27 16:38:16 +01:00
David Sterba 5f0af70a25 mm: remove call to find_vma in pagewalk for non-hugetlbfs
Commit d33b9f45 ("mm: hugetlb: fix hugepage memory leak in
walk_page_range()") introduces a check if a vma is a hugetlbfs one and
later in 5dc37642 ("mm hugetlb: add hugepage support to pagemap") it is
moved under #ifdef CONFIG_HUGETLB_PAGE but a needless find_vma call is
left behind and its result is not used anywhere else in the function.

The side-effect of caching vma for @addr inside walk->mm is neither
utilized in walk_page_range() nor in called functions.

Signed-off-by: David Sterba <[email protected]>
Reviewed-by: Naoya Horiguchi <[email protected]>
Acked-by: Andi Kleen <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Lee Schermerhorn <[email protected]>
Cc: Matt Mackall <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Cc: Wu Fengguang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2010-11-25 06:50:46 +09:00
David Sterba a48a982a6b fs/ocfs2/dlm: Use GFP_ATOMIC under spin_lock
coccinelle check scripts/coccinelle/locks/call_kern.cocci found that
in fs/ocfs2/dlm/dlmdomain.c an allocation with GFP_KERNEL is done
with locks held:

dlm_query_region_handler
  spin_lock(dlm_domain_lock)
    dlm_match_regions
      kmalloc(GFP_KERNEL)

Change it to GFP_ATOMIC.

Signed-off-by: David Sterba <[email protected]>
CC: Joel Becker <[email protected]>
CC: Mark Fasheh <[email protected]>
CC: [email protected]

--
Exists in v2.6.37-rc1 and current linux-next.
Signed-off-by: Joel Becker <[email protected]>
2010-11-18 14:10:55 -08:00
David Sterba ef821ae70f USB: xhci: Use GFP_ATOMIC under spin_lock
coccinelle check scripts/coccinelle/locks/call_kern.cocci found that
in drivers/usb/host/xhci.c an allocation with GFP_KERNEL is done
with locks held:

xhci_resume
  spin_lock_irq(xhci->lock)
    xhci_setup_msix
      kmalloc(GFP_KERNEL)

Change it to GFP_ATOMIC.

Signed-off-by: David Sterba <[email protected]>
CC: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-11-11 06:59:14 -08:00
David Sterba a013869248 ipwireless: Preallocate received packet buffers with MRU size
ipwireless: Preallocate received packet buffers with MRU size

Packets are assembled from link size (~300 bytes) up to PPP MRU
(1500 by default). Try to preallocate full size rather than
repeatedly advance buffer size by 256 bytes.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba 0f38c47a54 ipwireless: Put packets to pool start
ipwireless: Put packets to pool start

Put packets to pool start, try to reuse cached memory.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba bee9c7c077 ipwireless: Increase PPP outgoing queue size
ipwireless: Increase PPP outgoing queue size

Increase default size of PPP outgoing queue. Currently set to 1, which
means that a packet quickly following another pushed by PPP must wait
until hardware actually sends the previous and PPP has to be waken up
by ppp_wakeup(). This slows down upstream.

Now PPP can push more packets at once which get buffered inside driver
and pushed immediatelly to hardware when previous packet is out.

Experiments show that size = 10 is quite good for all connection types
(GPRS/EDGE/UMTS) and gains 4 KB/sec of upload for UMTS for batch uploads.
Need for higher queue size than 10 occures in only < 0.1 % of cases.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba 09e491e9a7 ipwireless: Explicitly request io and mem regions
ipwireless: Explicitly request io and mem regions

Documentation/pcmcia/driver-changes.txt says, that driver should call request_region
for used memory/io regions since PCMCIA does not do this (since 2.6.8).

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba ff3e990e61 ipwireless: Constify buffer variables
ipwireless: Constify buffer variables

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba 93110f698f ipwireless: Do not return value from sending funcs
ipwireless: Do not return value from sending funcs

Do not return value from do_send_fragment and do_send_packet, it's not used.
The packet size checks are not useful too:

* zero length packet will never be sent, caller always passes packet_header
  size which is either 1 or 3
* MTU check is done in caller, no need to repeat

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba d54c2752f6 ipwireless: Remove endian-dependent bitfields
ipwireless: Remove endian-dependent bitfields

Remove endian-dependent bitfields and use bitmasks to transform
packet header bitfields from/to machine order.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba 622e713e8e ipwireless: Glue splitted printk strings back
ipwireless: Glue splitted printk strings back

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba 2fc5577e17 ipwireless: Remove pt_regs from interrupt handler
ipwireless: Remove pt_regs from interrupt handler

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba 63c4dbd102 ipwireless: Rename spinlock variables to lock
ipwireless: Rename spinlock variables to lock

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba 2e713165f8 ipwireless: Remove unused defines
ipwireless: Remove unused defines

Remove unused defines, defines hiding variables, defines hiding 0.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba d4c0deb700 ipwireless: Misc cleanups
ipwireless: Misc cleanups

- remove likely() and some extra () in ifs
- use unsigned in for loops
- remove useless typecasts
- remove obvious comments
- add () around ?:

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-28 08:28:03 -07:00
David Sterba 339caf2a22 proc: misplaced export of find_get_pid
Move EXPORT_SYMBOL right after the func

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-07-25 10:53:45 -07:00
David Sterba eb4e545d4a ipwireless: Fix blocked sending
Packet sending is driven by two flags, tx_ready and tx_queued.
It was possible, that there were queued data for sending and
hardware was flagged as blocked but in fact it was not.

The tx_queued was indicator but should be really a counter else
first fragmented packet resets tx_queued flag, but there may be
pending packets which do not get sent.

New semantics:
tx_ready - set, if hw is ready to send packet, no packet is being
           transferred right now
           set the flag right at the place where data are copied
           into hw memory and not earlier without checking if it
           was succesful
tx_queued - count of enqueued packets, including fragments

Tested-by: Michal Rokos <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-06-06 11:31:02 -07:00
David Sterba 16abef0e9e fs: use loff_t type instead of long long
Use offset type consistently.

Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-04-22 15:17:11 -07:00
David Sterba a51f4124e6 ipwireless: fix potential tty == NULL dereference
The Coverity checker spotted the following inconsequent NULL checking in
drivers/char/pcmcia/ipwireless/network.c:ipwireless_network_packet_received()

if (tty && channel_idx == IPW_CHANNEL_RAS
		&& (network->ras_control_lines &
			IPW_CONTROL_LINE_DCD) != 0
		&& ipwireless_tty_is_modem(tty)) {
...
	else
		ipwireless_tty_received(tty, data, length);

Cc: Adrian Bunk <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Cc: "John W. Linville" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-03-04 16:35:13 -08:00
David Sterba 099dc4fb62 ipwireless: driver for PC Card 3G/UMTS modem
The device is manufactured by IPWireless.  In some countries (for
example Czech Republic, T-Mobile ISP) this card is shipped for service
called UMTS 4G.

It's a piece of PCMCIA "4G" UMTS PPP networking hardware that presents
itself as a serial character device (i.e.  looks like usual modem to
userspace, accepts AT commands, etc).

Rewieved-by: Jiri Slaby <[email protected]>
Signed-off-by: Ben Martel <[email protected]>
Signed-off-by: Stephen Blackheath <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
2008-02-07 17:19:49 -08:00
David Sterba b63bb739a1 bonding: Fix time comparison
From: David Sterba <[email protected]>

Use macros for comparing jiffies. Jiffies' wrap caused missed events and hangs.
Module reinsert was needed to make bonding work again.

Signed-off-by: David Sterba <[email protected]>
Acked-by: Jay Vosburgh <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
2007-12-07 15:00:30 -05:00