Commit Graph

253353 Commits (dbb0743a58825d94f1b3fdfa90a8d61dfef88f7b)

Author SHA1 Message Date
Dave Jiang 103a00c200 isci: Make the driver copy data directly from and to sg for PIO
We can copy the data directly to and from sg for SATA PIO read operations.
There is no reason to involve the hardware SGL. In the process we also need
to kmap the sg because we don't know where that can come from.

We also do to not call phys_to_virt(). The driver already has the information.
We can just calculcate the appropriate offets.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:28 -07:00
Dave Jiang f7885c8490 isci: Removed special macros that does 64bit address math
These macros are not necessary. We can do 64bit math directly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:28 -07:00
Piotr Sawicki b3824292cb isci: fix for asserts during aborts/resets to SAS/SATA in APC mode
Sending aborts/resets to SAS/SATA targets in APC mode eventually causes
an assert in scic_sds_apc_agent_link_up().  We need to handle the hard reset
case for apc mode ports.

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:28 -07:00
Tomasz Chudy 52b957c80c isci: Add Support for new TC completion codes
Update the SCI Core to comprehend the changes in the TC completion
codes from A0 to B0.  Specifically, there isnew R_ER code
differences for command and data FISes.

Changes are as follows:

1) 0x16 now additionally indicates an R_ERR received for a COMMAND
FIS being sent to a SATA target.  0x16 for SSP still indicates a
NAK received for a COMMAND frame.  Fix is to retry TC to be compliant
with SATA spec or ensure proper error handling of return value
(not spec compliant I don't believe).
2) 0x1B was previously called DONE_BREAK_RCVD for STP and
DONE_LL_ABORT_ERR for SSP.  Now it is universally called
DONE_LL_ABORT_ERR.  This is purely a superficial change.
3) 0x32 is no longer a reserved code.  Now it indicates
DONE_CMD_SDMA_ERR for STP/SSP.  There was a fatal error on the
SDMA for a command IU (includes Raw frames).  Consider retry,
but at a minimum gracefully fail the request.
4) 0x33 is no longer a reserved code.  Now it indicates
DONE_CMD_LL_ABORT_ERR for SSP.  There was a break receivd
during transmission of a command IU.  Consider retry, but
at a minimum gracefully fail the request.

Signed-off-by: Tomasz Chudy <Tomasz.Chudy@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:28 -07:00
Dan Williams 3c06c2839d isci: clean up remaining silicon revision ifdefs in phy init
Use the dynamic revision detection code in
scic_sds_phy_link_layer_initialization() and apply some coding style
fixups (long deref chains).  The compile time max link rate setting is
removed in favor of honoring the user-parameter max.

Reported-by: Krzysztof Wierzbicki <Krzysztof.Wierzbicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:28 -07:00
Jacek Danecki d9def184b3 isci: Add support for user parameters in SCIC layer
Add support for the following parameters in SCIC:

     /**
       * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
       * insertion frequency for this phy index.
       */
      u32  notify_enable_spin_up_insertion_frequency;

      /**
       * This method specifies the number of transmitted DWORDs within which
       * to transmit a single ALIGN primitive.  This value applies regardless
       * of what type of device is attached or connection state.  A value of
       * 0 indicates that no ALIGN primitives will be inserted.
       */
      u16  align_insertion_frequency;

      /**
       * This method specifies the number of transmitted DWORDs within which
       * to transmit 2 ALIGN primitives.  This applies for SAS connections
       * only.  A minimum value of 3 is required for this field.
       */
      u16  in_connection_align_insertion_frequency;

Signed-off-by: Krzysztof Wierzbicki <Krzysztof.Wierzbicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Henryk Dembkowski 246214667f isci: Move transport layer registers from port to phy
At init and RNC resume we need to touch every phy in a port to be sure
we have initialized STP properties in the case where port_index !=
phy_index.  Also add some missing __iomem annotations.

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Tomasz Chudy 06fdb32862 isci: fix "no outbound task timeout" default value
The default should be 5us.  The hardware encodes it in 256ns increments,
so the value should be 20 to approximate a 5us timeout.

Signed-off-by: Tomasz Chudy <Tomasz.Chudy@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams 8f31550c77 isci: phy state machine cleanup step1
c99 the struct initializers:
	1/ allows grep to consistently show method name associations.  The
	   naming is mostly consistent (except when it isn't) so this guarantees
	   coverage of present and future exception cases.
	2/ let's the compiler guarantee that the state table array entry
	   correlates with an actual state name and detect accidental reordering or
	   deletion of states.
	/ allows default handler's to be identified easily

Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dave Jiang 858d4aa741 isci: Move firmware loading to per PCI device
Moved the firmware loading from per adapter to per PCI device. This should
prevent firmware from being loaded twice becuase of 2 SCU controller per
PCI device. We do have to do it per PCI device because request_firmware()
requires a struct device passed in.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Havard Skinnemoen 92cd51153d isci: Initialize proc_name field in scsi_host_template
The proc_name field in struct scsi_host_template is exported through sysfs and
allows userspace tools to identify the driver behind a particular SCSI host
controller.

Initialize this field so that userspace tools can easily identify isci host
controllers through sysfs.

Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Edmund Nadolski 5d147e7383 isci: remove scic_controller_get_handler_methods and ilk
This removes scic_controller_get_handler_methods and its
associated unused code.

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[djbw: kill off the legacy handler, now that we have basic error isr support]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams 83f5eeef59 isci: debug fixes
Some of the chain walks to get back to our dev are invalid.

isci_remote_device_change_state: delete rather than adding conditional deref
chain walking
isci_request_change_state: fix, it was being called too early
isci_request_ssp_io_request_get_lun: fix compile breakage hidden by ifdef DEBUG

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams 83e514301e isci: advertise linkrate
Inform libsas of the linkrate of direct attached links.

Reported-by: Haavard Skinnemoen <hskinnemoen@gmail.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams 92f4f0f544 isci: implement error isr
Add basic support for handling/reporting error interrupts.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Edmund Nadolski 77950f51f5 isci: enable interrupts during controller start, and flush discovery
Polling the event queue during scan is an unneeded holdover from the
original driver.

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[djbw: ensure we flush all port events and domain discovery]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams 0cf89d1d27 isci: cleanup "starting" state handling
The lldd actively disallows requests in the "starting" state.  Retrying
or holding off commands in this state is sub-optimal:
1/ it adds another state check to the fast path
2/ retrying can cause libsas to give up

However, isci's ->lldd_dev_found() routine already waits for controller
start to complete before allowing further progress.  Checking the
"starting" state in isci_task_execute_task and the isr is redundant and
misleading.  Clean this up and introduce a controller-wide event queue
to start reeling in "completion" proliferation in the driver.

The "stopping" state cleanups are in a similar vein, rely on the the isr
and other paths being precluded from occurring rather than implementing
state checking logic.

Reported-by: Christoph Hellwig <hch@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams c7ef4031f0 isci: bypass scic_controller_get_handler_methods()
The indirection is unecessary and broken in the current case that assigns the
handlers based on a not up-to-date pdev->msix_enabled value.

Route the handlers directly to the requisite core routines.

Todo: hook up error interrupt handling

Reported-by: Jeff Garzik <jeff@garzik.org>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams 11c8898629 isci: remove SCIC_DEBUG_ENABLED, and fixup an odd macro
This will be replaced by state machine tracepoints and should have been a part
of the logger removal.

Ran across scic_sds_port_decrement_request_count() which is an ugly macro
which silently hides accounting errors.  Turn it into a WARN_ONCE to see if it
ever triggers.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams f7d36e1872 isci: kill a callback cast
Callbacks are already type unsafe, obfuscating things further by casting the
callback routine is less safe because now function argument number changes
will not be caught by the compiler.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Henryk Dembkowski 27d42e3e79 isci: coding style changes for remote device
Change names from upper to low letters

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 03:55:27 -07:00
Dan Williams e574a8c180 isci: cleanup core consolidation leftovers
Remove duplicated license and header file includes that were leftover
from commit 4c1db2d0 "isci: consolidate core" (in the isci.git historical
branch).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Henryk Dembkowski db48255b32 isci: c99 tables cleanup step1
scic_sds_stp_remote_device_ready_substate_handler_table[]
	scic_sds_smp_remote_device_ready_substate_handler_table[]

c99 the struct initializers:
	1/ allows grep to consistently show method name associations.  The
	   naming is mostly consistent (except when it isn't) so this guarantees
	   coverage of present and future exception cases.
	2/ let's the compiler guarantee that the state table array entry
	   correlates with an actual state name and detect accidental reordering or
	   deletion of states.
	3/ allows default handler's to be identified easily

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Henryk Dembkowski 2f02f556ab isci: coding style changes for remote device
Change names from upper to low letters

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Henryk Dembkowski 7fbafaa519 isci: remote device and node cleanup step1
c99 the struct initializers (scic_sds_remote_device_state_handler_table[]):
	1/ allows grep to consistently show method name associations.  The
	   naming is mostly consistent (except when it isn't) so this guarantees
	   coverage of present and future exception cases.
	2/ let's the compiler guarantee that the state table array entry
	   correlates with an actual state name and detect accidental reordering or
	   deletion of states.
	3/ allows default handler's to be identified easily

Change names from upper to low letters

Cleanup empty lines

Signed-off-by: Henryk Dembkowski <henryk.dembkowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Dave Jiang 6e473dd112 isci: removing unused loglevel module param
We no longer use the loglevel parameter. Remove.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Edmund Nadolski b5739b6050 isci: kill sci_types.h
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[rebased after killing SCI_IO_REQUEST_DATA_DIRECTION]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Dan Williams 82d29928c1 isci: kill SCI_IO_REQUEST_DATA_DIRECTION
It's an unnecessary typedef that mirrors the kernel's enum
dma_data_direction.

Also cleanup some long variable names along the way.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Edmund Nadolski a7e536c7d6 isci: remove SCI_INVALID_HANDLE
Replace SCI_INVALID_HANDLE with NULL

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Edmund Nadolski 74ea9c163a isci: remove unused SC_LIBRARY_HANDLE_T typedef
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03 00:36:31 -07:00
Dan Williams 6f231dda68 isci: Intel(R) C600 Series Chipset Storage Control Unit Driver
Support for the up to 2x4-port 6Gb/s SAS controllers embedded in the
chipset.

This is a snapshot of the first publicly available version of the driver,
commit 4c1db2d0 in the 'historical' branch.

   git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git historical

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-02 22:56:22 -07:00
Linus Torvalds 59c5f46fbe Linux 3.0-rc2 2011-06-06 18:06:33 +09:00
Hugh Dickins e0dcd8a05b mm: fix ENOSPC returned by handle_mm_fault()
Al Viro observes that in the hugetlb case, handle_mm_fault() may return
a value of the kind ENOSPC when its caller is expecting a value of the
kind VM_FAULT_SIGBUS: fix alloc_huge_page()'s failure returns.

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-06-06 18:00:27 +09:00
Linus Torvalds 0d6925d43b Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: usb - turn off de-emphasis in s/pdif for cm6206
  ALSA: asihpi: Use angle brackets for system includes
  ALSA: fm801: add error handling if auto-detect fails
  ALSA: hda - Check pin support EAPD in ad198x_power_eapd_write
  ALSA: hda - Fix HP and Front pins of ad1988/ad1989 in ad198x_power_eapd()
  ALSA: 6fire: Don't leak firmware in error path
  ASoC: Fix wm_hubs input PGA ZC bits
  ASoC: Fix dapm_is_shared_kcontrol so everything isn't shared
2011-06-06 17:51:28 +09:00
Linus Torvalds c12f667e75 Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
  hwmon: (max6642): Better chip detection schema
  hwmon: (coretemp) Further relax temperature range checks
  hwmon: (coretemp) Fix TjMax detection for older CPUs
  hwmon: (coretemp) Relax target temperature range check
  hwmon: (max6642) Rename temp_fault sysfs attribute to temp2_fault
2011-06-06 17:48:02 +09:00
Takashi Iwai 3190dad97b Merge branch 'fix/asoc' into for-linus 2011-06-06 09:28:49 +02:00
Linus Torvalds 0792644d22 Merge branch 'for-linus' of git://android.git.kernel.org/kernel/tegra
* 'for-linus' of git://android.git.kernel.org/kernel/tegra:
  ARM: Tegra: Harmony: Fix conflicting GPIO numbering
2011-06-05 08:11:11 +09:00
Stephen Warren f2a4d8ae4d ARM: Tegra: Harmony: Fix conflicting GPIO numbering
Currently, both the WM8903 and TPS6586x chips attempt to register with
gpiolib using the same GPIO numbers. This causes the audio driver to
fail to initialize.

To solve this, add a define to board-harmony.h for the TPS6586x, and make
board-harmony-power.c use this define, instead of directly referencing
TEGRA_NR_GPIOS.

This fixes a regression introduced by commit
6f168f2fa6.
ARM: tegra: harmony: initialize the TPS65862 PMIC

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Colin Cross <ccross@android.com>
2011-06-04 15:51:52 -07:00
Linus Torvalds e6ece70732 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: (25 commits)
  btrfs: fix uninitialized variable warning
  btrfs: add helper for fs_info->closing
  Btrfs: add mount -o inode_cache
  btrfs: scrub: add explicit plugging
  btrfs: use btrfs_ino to access inode number
  Btrfs: don't save the inode cache if we are deleting this root
  btrfs: false BUG_ON when degraded
  Btrfs: don't save the inode cache in non-FS roots
  Btrfs: make sure we don't overflow the free space cache crc page
  Btrfs: fix uninit variable in the delayed inode code
  btrfs: scrub: don't reuse bios and pages
  Btrfs: leave spinning on lookup and map the leaf
  Btrfs: check for duplicate entries in the free space cache
  Btrfs: don't try to allocate from a block group that doesn't have enough space
  Btrfs: don't always do readahead
  Btrfs: try not to sleep as much when doing slow caching
  Btrfs: kill BTRFS_I(inode)->block_group
  Btrfs: don't look at the extent buffer level 3 times in a row
  Btrfs: map the node block when looking for readahead targets
  Btrfs: set range_start to the right start in count_range_bits
  ...
2011-06-05 06:17:23 +09:00
Per Dalén 942c1a927b hwmon: (max6642): Better chip detection schema
Improve detection of MAX6642 by reading non existing registers (0x04, 0x06
and 0xff). Reading those registers returns the previously read value.

Signed-off-by: Per Dalen <per.dalen@appeartv.com>
[guenter.roeck@ericsson.com: added second set of register reads]
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-06-04 10:34:28 -07:00
Linus Torvalds 23c79d31a3 Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] Fix oops caused by queue refcounting failure
2011-06-04 23:19:51 +09:00
Linus Torvalds 0e833d8cfc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (40 commits)
  tg3: Fix tg3_skb_error_unmap()
  net: tracepoint of net_dev_xmit sees freed skb and causes panic
  drivers/net/can/flexcan.c: add missing clk_put
  net: dm9000: Get the chip in a known good state before enabling interrupts
  drivers/net/davinci_emac.c: add missing clk_put
  af-packet: Add flag to distinguish VID 0 from no-vlan.
  caif: Fix race when conditionally taking rtnl lock
  usbnet/cdc_ncm: add missing .reset_resume hook
  vlan: fix typo in vlan_dev_hard_start_xmit()
  net/ipv4: Check for mistakenly passed in non-IPv4 address
  iwl4965: correctly validate temperature value
  bluetooth l2cap: fix locking in l2cap_global_chan_by_psm
  ath9k: fix two more bugs in tx power
  cfg80211: don't drop p2p probe responses
  Revert "net: fix section mismatches"
  drivers/net/usb/catc.c: Fix potential deadlock in catc_ctrl_run()
  sctp: stop pending timers and purge queues when peer restart asoc
  drivers/net: ks8842 Fix crash on received packet when in PIO mode.
  ip_options_compile: properly handle unaligned pointer
  iwlagn: fix incorrect PCI subsystem id for 6150 devices
  ...
2011-06-04 23:16:00 +09: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 <sfr@canb.auug.org.au>
Signed-off-by: David Sterba <dsterba@suse.cz>
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 <dsterba@suse.cz>
2011-06-04 08:11:22 -04:00
Chris Mason 4b9465cb9e Btrfs: add mount -o inode_cache
This makes the inode map cache default to off until we
fix the overflow problem when the free space crcs don't fit
inside a single page.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-06-04 08:03:47 -04:00
Arne Jansen e7786c3ae5 btrfs: scrub: add explicit plugging
With the removal of the implicit plugging scrub ends up doing more and
smaller I/O than necessary. This patch adds explicit plugging per chunk.

Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-06-04 08:03:46 -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 <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-06-04 08:03:46 -04:00
Josef Bacik d132a538d2 Btrfs: don't save the inode cache if we are deleting this root
With xfstest 254 I can panic the box every time with the inode number caching
stuff on.  This is because we clean the inodes out when we delete the subvolume,
but then we write out the inode cache which adds an inode to the subvolume inode
tree, and then when it gets evicted again the root gets added back on the dead
roots list and is deleted again, so we have a double free.  To stop this from
happening just return 0 if refs is 0 (and we're not the tree root since tree
root always has refs of 0).  With this fix 254 no longer panics.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Tested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-06-04 08:03:45 -04:00
Arne Jansen 5f3f302a6f btrfs: false BUG_ON when degraded
In degraded mode the struct btrfs_device of missing devs don't have
device->name set. A kstrdup of NULL correctly returns NULL. Don't
BUG in this case.

Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-06-04 08:03:44 -04:00
liubo ca456ae280 Btrfs: don't save the inode cache in non-FS roots
This adds extra checks to make sure the inode map we are caching really
belongs to a FS root instead of a special relocation tree.  It
prevents crashes during balancing operations.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2011-06-04 08:03:44 -04:00