Tomasz Figa [Mon, 24 Jun 2013 12:39:52 +0000 (14:39 +0200)]
mfd: max8998: Add irq domain support
This patch adds irq domain support for max8998 interrupts.
To keep both non-DT and DT worlds happy, simple domain is used, which is
linear when no explicit IRQ base is specified and legacy, with static
mapping, otherwise.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Marek Szyprowski [Tue, 28 Feb 2012 09:31:19 +0000 (10:31 +0100)]
vt: disable console blank
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Inki Dae [Tue, 20 Aug 2013 08:39:12 +0000 (17:39 +0900)]
drm/exynos: add dmabuf sync support for g2d driver
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Inki Dae [Tue, 20 Aug 2013 08:35:43 +0000 (17:35 +0900)]
drm/exynos: add exynos_drm_gem_get_dmabuf function
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Seung-Woo Kim [Wed, 3 Jul 2013 08:09:21 +0000 (17:09 +0900)]
drm/exynos: remove duplicated error routine and unnecessary assign
There were duplicated error handling routines during allocating
pages in lowlevel_buffer_allocate() and g2d_userptr_get_dma_addr().
Also unnecessary NULL assignments for variable used not any more
are removed from g2d_userptr_get_dma_addr() and
g2d_userptr_put_dma_addr().
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
YoungJun Cho [Wed, 3 Jul 2013 08:09:19 +0000 (17:09 +0900)]
drm/exynos: use drm_calloc_large when allocates pointer array
If the type of object is pointer array, the drm_calloc_large() is
more suitable than kzalloc() for its allocation function. And uses
drm_free_large() instead of kfree() also.
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Inki Dae [Tue, 20 Aug 2013 05:28:56 +0000 (14:28 +0900)]
drm/exynos: check a pixel format to a particular window layer
This patch checks if a requested window supports alpha channel or not.
In case of s3c64xx, window 0 doesn't support alpha channel so if
the request pixel format is ARGB8888 then change it to XRGB8888.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
YoungJun Cho [Tue, 20 Aug 2013 08:18:40 +0000 (17:18 +0900)]
drm/exynos: Remove tracking log functions
This patch removes tracking log functions which were used to debug
in the early development stage and are not so important as were.
So remove them for code clean up.
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Rahul Sharma [Mon, 10 Jun 2013 09:20:00 +0000 (14:50 +0530)]
drm/exynos: hdmi: use drm_display_mode to check the supported modes
This patch renames check_timing to check_mode and removes the
unnecessary conversion of drm_display_mode to/from fb_videomode in
the hdmi driver.
v4:
1) Changed the commit message to add information related to renaming
the callbacks to check_mode.
2) Changed debug message to print 1/0 for interlace mode.
v3:
1) Replaced check_timing callbacks with check_mode.
2) Change the type of second parameter of check_mode callback from void
pointer paramenter to struct drm_display_mode pointer.
v2:
1) Removed convert_to_video_timing().
2) Corrected DRM_DEBUG_KMS to print the resolution properly.
Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Tomasz Figa [Wed, 1 May 2013 19:02:29 +0000 (21:02 +0200)]
drm/exynos: fimd: Add support for S3C64xx SoCs
The FIMD block present on S3C6400/S3C6410 SoCs is compatible with this
driver, so it can be supported by it as well.
This patch adds appropriate device IDs and driver data to enable this
driver for S3C64xx SoCs.
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Tomasz Figa [Wed, 1 May 2013 19:02:28 +0000 (21:02 +0200)]
drm/exynos: fimd: Add support for FIMD variants with clock selection
Some platforms that can be supported this driver has additional clock
source selection bits in VIDCON0 register that allows to select which
clock should be used to drive the pixel clock: bus clock or special
clock.
Since this driver assumes that special clock always drives the pixel
clock, this patch sets the selection bitfield to use the special clock.
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Tomasz Figa [Wed, 1 May 2013 19:02:27 +0000 (21:02 +0200)]
drm/exynos: fimd: Add support for FIMD versions without SHADOWCON register
Some platforms that can be supported with this driver have PRTCON
register instead of SHADOWCON, which requires slightly different
handling.
This patch factors out all register shadow control code from the driver
and adds a function to control register shadowing appropriately,
depending on driver data.
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Tomasz Figa [Wed, 1 May 2013 19:02:26 +0000 (21:02 +0200)]
drm/exynos: fimd: Hold pointer to driver data in context struct
This patch adds pointer to driver data to fimd_context structure, to
remove the need to call drm_fimd_get_driver_data() each time access to
driver data is necessary.
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Inki Dae [Tue, 20 Aug 2013 08:16:29 +0000 (17:16 +0900)]
drm/exynos: do not use mode_set_base function directly
This patch adds exynos_drm_crtc_mode_set_commit function
to update mode data and it makes page flip call this function
instead of calling exynos_drm_crtc_mode_set_base function directly.
exynos_drm_crtc_mode_set_base function is called by drm subsystem
as a callback so we don't have to call this function directly.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Sachin Kamat [Wed, 5 Jun 2013 07:00:23 +0000 (16:00 +0900)]
drm/exynos: Remove redundant use of of_match_ptr macro
'mixer_match_types' is always compiled in. Hence of_match_ptr is not
necessary.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Seung-Woo Kim [Wed, 5 Jun 2013 05:34:38 +0000 (14:34 +0900)]
drm/exynos: remove ignoring return value warning in hdmi
The definition of regulator_bulk_enable is fixed with __must_check
and this causes following build warning.
warning: ignoring return value of 'regulator_bulk_enable',
declared with attribute warn_unused_result
This patch fixes to check return value of the function.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Inki Dae [Tue, 28 May 2013 07:01:21 +0000 (16:01 +0900)]
drm/exynos: fix WINDOWS_NR checking to vidi driver
This patch just checks if win_data array range is valid
or not correctly.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Inki Dae [Tue, 20 Aug 2013 04:51:02 +0000 (13:51 +0900)]
drm/exynos: fix fimd pixel format setting
This patch fixes wrong pixel format setting.
A pixel format is decided according to bpp and depth, or user-requested
format but fimd driver considered only bpp value to decide a proper pixel
format. So this patch makes a proper pixel format to be set according
to drm_framebuffer's pixel_format which is set by addfb with bpp and
depth, or addfb2 with user-requested format.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Sachin Kamat [Wed, 14 Aug 2013 11:08:03 +0000 (16:38 +0530)]
drm/exynos: Add NULL pointer check
devm_kzalloc can fail. Hence check the pointer to avoid NULL pointer
dereferencing.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Sachin Kamat [Tue, 20 Aug 2013 08:11:26 +0000 (17:11 +0900)]
drm/exynos: Remove redundant error messages
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Sachin Kamat [Wed, 14 Aug 2013 11:08:01 +0000 (16:38 +0530)]
drm/exynos: Add missing of.h header include
Add of.h explicitly for of_* APIs.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Sachin Kamat [Fri, 26 Jul 2013 07:59:19 +0000 (13:29 +0530)]
drm/exynos: Remove module.h header inclusion
Remove module.h header file inclusion from files since they do
not use/refer to any code from that file.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Mark Brown [Mon, 12 Aug 2013 23:46:40 +0000 (00:46 +0100)]
drm/exynos: Add missing includes
Ensure that all externally accessed functions are correctly prototyped
when defined in each file by making sure the headers with the protoypes
are included in the file with the definition.
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Beomho Seo [Wed, 14 Aug 2013 04:04:49 +0000 (13:04 +0900)]
iio: add proximity/light sensor cm36651 driver
- Add proximity/light sensor cm36651 driver using iio subsystem
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Beomho Seo [Wed, 14 Aug 2013 03:01:53 +0000 (12:01 +0900)]
TRATS2: dts: exynos4412-m0.dts: Add cm36651 proximity/light sensor node
- Support cm36651 proximity/light sensor device for TRATS2 board
- Add also the binding documentation file
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Beomho Seo [Wed, 14 Aug 2013 02:56:48 +0000 (11:56 +0900)]
ARM: tizen_defconfig: add cm36651 proxmity/light sensor config
- Add cm36651 proximity/light sensor configuration
- Disable gp2ap002a00f proximity/light sensor configuration
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Beomho Seo [Wed, 14 Aug 2013 02:54:56 +0000 (11:54 +0900)]
iio:add proximity/light sensor cm36651 driver to Kconfig and Makefile
- Add cm36651 proximity/light sensor to Kconfig to enable compilation
- Add cm36651 proximity/light sensor to Makefile to enable compilation
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Inki Dae [Tue, 13 Aug 2013 04:47:57 +0000 (13:47 +0900)]
dma-buf: return POLLIN | POLLOUT instead of POLLERR
It's not error if a dmabuf wasn't locked when select is called but
rather that means there is no anyone accessing the dmabuf so return
POLLIN | POLLOUT.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Seth Jennings [Wed, 10 Jul 2013 23:05:05 +0000 (16:05 -0700)]
zswap: add documentation
Add the documentation file for the zswap functionality
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Robert Jennings <rcj@linux.vnet.ibm.com>
Cc: Jenifer Hopper <jhopper@us.ibm.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <jweiner@redhat.com>
Cc: Larry Woodman <lwoodman@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Joe Perches <joe@perches.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: Hugh Dickens <hughd@google.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Seth Jennings [Wed, 10 Jul 2013 23:05:03 +0000 (16:05 -0700)]
zswap: add to mm/
zswap is a thin backend for frontswap that takes pages that are in the
process of being swapped out and attempts to compress them and store
them in a RAM-based memory pool. This can result in a significant I/O
reduction on the swap device and, in the case where decompressing from
RAM is faster than reading from the swap device, can also improve
workload performance.
It also has support for evicting swap pages that are currently
compressed in zswap to the swap device on an LRU(ish) basis. This
functionality makes zswap a true cache in that, once the cache is full,
the oldest pages can be moved out of zswap to the swap device so newer
pages can be compressed and stored in zswap.
This patch adds the zswap driver to mm/
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Robert Jennings <rcj@linux.vnet.ibm.com>
Cc: Jenifer Hopper <jhopper@us.ibm.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <jweiner@redhat.com>
Cc: Larry Woodman <lwoodman@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Joe Perches <joe@perches.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: Hugh Dickens <hughd@google.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Conflicts:
mm/Kconfig
Seth Jennings [Wed, 10 Jul 2013 23:04:55 +0000 (16:04 -0700)]
zbud: add to mm/
zbud is an special purpose allocator for storing compressed pages. It
is designed to store up to two compressed pages per physical page.
While this design limits storage density, it has simple and
deterministic reclaim properties that make it preferable to a higher
density approach when reclaim will be used.
zbud works by storing compressed pages, or "zpages", together in pairs
in a single memory page called a "zbud page". The first buddy is "left
justifed" at the beginning of the zbud page, and the last buddy is
"right justified" at the end of the zbud page. The benefit is that if
either buddy is freed, the freed buddy space, coalesced with whatever
slack space that existed between the buddies, results in the largest
possible free region within the zbud page.
zbud also provides an attractive lower bound on density. The ratio of
zpages to zbud pages can not be less than 1. This ensures that zbud can
never "do harm" by using more pages to store zpages than the
uncompressed zpages would have used on their own.
This implementation is a rewrite of the zbud allocator internally used
by zcache in the driver/staging tree. The rewrite was necessary to
remove some of the zcache specific elements that were ingrained
throughout and provide a generic allocation interface that can later be
used by zsmalloc and others.
This patch adds zbud to mm/ for later use by zswap.
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Robert Jennings <rcj@linux.vnet.ibm.com>
Cc: Jenifer Hopper <jhopper@us.ibm.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <jweiner@redhat.com>
Cc: Larry Woodman <lwoodman@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Joe Perches <joe@perches.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: Hugh Dickens <hughd@google.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Conflicts:
mm/Kconfig
Seth Jennings [Mon, 3 Jun 2013 20:33:02 +0000 (15:33 -0500)]
debugfs: add get/set for atomic types
debugfs currently lack the ability to create attributes
that set/get atomic_t values.
This patch adds support for this through a new
debugfs_create_atomic_t() function.
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Mel Gorman <mgorman@suse.de>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Beomho Seo [Mon, 12 Aug 2013 13:04:13 +0000 (22:04 +0900)]
Input: mcs_touchkey: Add parse DT function from device tree
Add parse DT function for support mcs touchkey driver
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Beomho Seo [Mon, 12 Aug 2013 12:51:45 +0000 (21:51 +0900)]
TRATS2: dts: exynos4412-m0.dts: Add mcs-touchkey node
Support melfas 2 touchkey device for TRATS2 board
Adds also the binding documentation file
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Beomho Seo [Mon, 12 Aug 2013 12:49:36 +0000 (21:49 +0900)]
ARM: tizen_defconfig: enable mcs_touchkey config
enable mcs_touchkey configuration
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Inki Dae [Fri, 9 Aug 2013 06:38:34 +0000 (15:38 +0900)]
dmabuf-sync: add select system call support.
This patch implements select system call for DMA BUF module
and adds related codes to dmabuf sync framework.
The purpose of this feature is to wait for the completion of DMA
or CPU access to a dmabuf without that caller locks the dmabuf
again after the completion.
This feature is useful when caller wants to be aware of the completion
of DMA access to a shared dmabuf, and the caller doesn't use interfaces
for the DMA device driver.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Sachin Kamat [Mon, 10 Jun 2013 08:49:41 +0000 (17:49 +0900)]
clk: exynos4: Add additional G2D clocks
Add G2D clocks for Exynos4x12 SoC and sclk_fimg2d required by G2D
IP.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Donghwa Lee [Wed, 7 Aug 2013 07:49:08 +0000 (16:49 +0900)]
ARM: dts: redwood: correct gpio_key interrupt control
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Donghwa Lee [Wed, 7 Aug 2013 05:20:08 +0000 (14:20 +0900)]
video: display: panel-s6d6aa1: remove useless function.
There is no usage for s6d6aa1_read_id().
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Donghwa Lee [Wed, 7 Aug 2013 05:07:29 +0000 (14:07 +0900)]
ARM: dts: remove repeated code and bug fix
This patch removes already defined dts code and include "exynos4412-slp_pq.dts".
And it is fixed gpio key interrupts.
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Hyungwon Hwang [Fri, 2 Aug 2013 08:09:48 +0000 (17:09 +0900)]
DT: support l5f31188 panel
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
Jaehoon Chung [Thu, 1 Aug 2013 13:39:50 +0000 (22:39 +0900)]
mmc: dw_mmc-exynos: supporte the packed command
To increase the performance, use the packed command
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Jaehoon Chung [Thu, 1 Aug 2013 13:37:29 +0000 (22:37 +0900)]
mmc: dw_mmc: add the specified capabilities2 of the controller
Add the capabilities2 of controller to use *_CAP2_*
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Jaegeuk Kim [Tue, 30 Jul 2013 02:36:53 +0000 (11:36 +0900)]
f2fs: fix handling orphan inodes
This patch fixes mishandling of the sbi->n_orphans variable.
If users request lots of f2fs_unlink(), check_orphan_space() could be contended.
In such the case, sbi->n_orphans can be read incorrectly so that f2fs_unlink()
would fall into the wrong state which results in the failure of
add_orphan_inode().
So, let's increment sbi->n_orphans virtually prior to the actual orphan inode
stuffs. After that, let's release sbi->n_orphans by calling release_orphan_inode
or remove_orphan_inode.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Gu Zheng [Thu, 25 Jul 2013 03:30:01 +0000 (11:30 +0800)]
f2fs: move bio_private allocation out of f2fs_bio_alloc()
bio->bi_private is not always needed. As in the reading data path,
end_read_io does not need bio_private for further using, so moving
bio_private allocation out of f2fs_bio_alloc(). Alloc it in the
submit_write_page(), and ignore it in the f2fs_readpage().
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Gu Zheng [Fri, 19 Jul 2013 08:24:06 +0000 (16:24 +0800)]
f2fs: use list_for_each rather than list_for_each_safe, in remove_orphan_inode()
As we remove the target single node, so list_for_each is enought, in order to
clean up, we use list_for_each_entry instead.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Gu Zheng [Mon, 22 Jul 2013 08:33:32 +0000 (16:33 +0800)]
f2fs: use seq_puts()/seq_putc() rather than seq_printf() where possible
For string without format specifiers, using seq_puts()/seq_putc()
instead of seq_printf().
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 22 Jul 2013 13:12:56 +0000 (22:12 +0900)]
f2fs: fix i_name during f2fs_sync_file
As similar as the i_pino fix, i_name also should be fixed when i_nlink is 1.
The errorneous scenario is like this.
1. touch test1
2. link test1 test2
3. unlink test2
4. fsync test1
After this, i_name should be test1.
CC: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Thu, 18 Jul 2013 09:02:31 +0000 (18:02 +0900)]
f2fs: update file name in the inode block during f2fs_rename
The error is reproducible by:
0. mkfs.f2fs /dev/sdb1 & mount
1. touch test1
2. touch test2
3. mv test1 test2
4. umount
5. dumpt.f2fs -i 4 /dev/sdb1
After this, when we retrieve the inode->i_name of test2 by dump.f2fs, we get
test1 instead of test2.
This is because f2fs didn't update the file name during the f2fs_rename.
So, this patch fixes that.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Gu Zheng [Mon, 15 Jul 2013 09:57:38 +0000 (17:57 +0800)]
f2fs: introduce help function F2FS_NODE()
Introduce help function F2FS_NODE() to simplify the conversion of node_page to
f2fs_node.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Gu Zheng [Fri, 12 Jul 2013 06:47:11 +0000 (14:47 +0800)]
f2fs: add a help func F2FS_STAT() to get the f2fs_stat_info
Add a help func F2FS_STAT() to get the f2fs_stat_info.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Fri, 28 Jun 2013 03:47:01 +0000 (12:47 +0900)]
f2fs: add proc entry to monitor current usage of segments
You can monitor valid block counts of whole segments in:
/proc/fs/f2fs/sdb1/segment_info.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Changman Lee [Thu, 4 Jul 2013 08:12:47 +0000 (17:12 +0900)]
f2fs: add description for fsck.f2fs and dump.f2fs
This patch adds some description on fsck.f2fs and dump.f2fs which is
recently merged into f2fs-tools.
Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Wed, 3 Jul 2013 01:55:52 +0000 (10:55 +0900)]
f2fs: recover date requested by fdatasync
In order to support SQLite that uses fdatasync instead of fsync, we should
guarantee the data requested by fdatasync can be recovered after sudden-power-
off.
So, let's remove the fdatasync condition in f2fs_sync_file.
Otherwise, we can restore the data after sudden-power-off due to nonexistence
of any fsync mark'ed node blocks.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Donghwa Lee [Thu, 1 Aug 2013 02:29:06 +0000 (11:29 +0900)]
ARM: dts: Add dts file for exynos4412-redwoodlte board
This patch adds a basic dts file for REDWOOD-LTE board based on Exynos 4412
SoC.
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Jaegeuk Kim [Thu, 27 Jun 2013 04:04:08 +0000 (13:04 +0900)]
f2fs: fix to recover i_size from roll-forward
If user requests many data writes and fsync together, the last updated i_size
should be stored to the inode block consistently.
But, previous write_end just marks the inode as dirty and doesn't update its
metadata into its inode block.
After that, fsync just writes the inode block with newly updated data index
excluding inode metadata updates.
So, this patch introduces write_end in which updates inode block too when the
i_size is changed.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Gu Zheng [Thu, 27 Jun 2013 01:28:54 +0000 (09:28 +0800)]
f2fs: remove the unused argument "sbi" of func destroy_fsync_dnodes()
As destroy_fsync_dnodes() is a simple list-cleanup func, so delete the unused
and unrelated f2fs_sb_info argument of it.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Thu, 27 Jun 2013 00:59:40 +0000 (09:59 +0900)]
f2fs: remove reusing any prefree segments
This patch removes check_prefree_segments initially designed to enhance the
performance by narrowing the range of LBA usage across the whole block device.
When allocating a new segment, previous f2fs tries to find proper prefree
segments, and then, if finds a segment, it reuses the segment for further
data or node block allocation.
However, I found that this was totally wrong approach since the prefree segments
have several data or node blocks that will be used by the roll-forward mechanism
operated after sudden-power-off.
Let's assume the following scenario.
/* write 8MB with fsync */
for (i = 0; i < 2048; i++) {
offset = i * 4096;
write(fd, offset, 4KB);
fsync(fd);
}
In this case, naive segment allocation sequence will be like:
data segment: x, x+1, x+2, x+3
node segment: y, y+1, y+2, y+3.
But, if we can reuse prefree segments, the sequence can be like:
data segment: x, x+1, y, y+1
node segment: y, y+1, y+2, y+3.
Because, y, y+1, and y+2 became prefree segments one by one, and those are
reused by data allocation.
After conducting this workload, we should consider how to recover the latest
inode with its data.
If we reuse the prefree segments such as y or y+1, we lost the old node blocks
so that f2fs even cannot start roll-forward recovery.
Therefore, I suggest that we should remove reusing prefree segments.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Gu Zheng [Thu, 20 Jun 2013 09:52:39 +0000 (17:52 +0800)]
f2fs: code cleanup and simplify in func {find/add}_gc_inode
This patch simplifies list operations in find_gc_inode and add_gc_inode.
Just simple code cleanup.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
[Jaegeuk Kim: add description]
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Sun, 16 Jun 2013 00:49:11 +0000 (09:49 +0900)]
f2fs: optimize the init_dirty_segmap function
Optimize the while loop condition
Since this condition will always be true and while loop will
be terminated by the following condition in code:
if (segno >= TOTAL_SEGS(sbi))
break;
Hence we can replace the while loop condition with while(1)
instead of always checking for segno to be less than Total segs.
Also we do not need to use TOTAL_SEGS() everytime. We can store
this value in a local variable since this value is constant.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Sun, 23 Jun 2013 22:47:23 +0000 (07:47 +0900)]
f2fs: fix an endian conversion bug detected by sparse
This patch should fix the following bug reported by kbuild test robot.
fs/f2fs/recovery.c:233:33: sparse: incorrect type in assignment
(different base types)
parse warnings: (new ones prefixed by >>)
>> recovery.c:233: sparse: incorrect type in assignment (different base types)
recovery.c:233: expected unsigned int [unsigned] [assigned] ofs_in_node
recovery.c:233: got restricted __le16 [assigned] [usertype] ofs_in_node
>> recovery.c:238: sparse: incorrect type in assignment (different base types)
recovery.c:238: expected unsigned int [unsigned] ofs_in_node
recovery.c:238: got restricted __le16 [assigned] [usertype] ofs_in_node
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Wed, 19 Jun 2013 11:47:19 +0000 (20:47 +0900)]
f2fs: fix crc endian conversion
While calculating CRC for the checkpoint block, we use __u32, but when storing
the crc value to the disk, we use __le32.
Let's fix the inconsistency.
Reported-and-Tested-by: Oded Gabbay <ogabbay@advaoptical.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Sun, 16 Jun 2013 00:48:48 +0000 (09:48 +0900)]
f2fs: add remount_fs callback support
Add the f2fs_remount function call which will be used
during the filesystem remounting. This function
will help us to change the mount options specific to
f2fs.
Also modify the f2fs background_gc mount option, which
will allow the user to dynamically trun on/off the
garbage collection in f2fs based on the background_gc
value. If background_gc=on, Garbage collection will
be turned off & if background_gc=off, Garbage collection
will be truned on.
By default the garbage collection is on in f2fs.
Change Log:
v2: Incorporated the review comments by Gu Zheng.
Removing the restore part for VFS flags
Updating comments with proper flag conditions
Display GC background option as ON/OFF
Revised conditions to stop GC in case of remount
v1: Initial changes for adding remount_fs callback
support.
Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
Reviewed-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
[Jaegeuk Kim: change /** with /* for the coding style]
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Thu, 13 Jun 2013 23:52:35 +0000 (08:52 +0900)]
f2fs: recover wrong pino after checkpoint during fsync
If a file is linked, f2fs loose its parent inode number so that fsync calls
for the linked file should do checkpoint all the time.
But, if we can recover its parent inode number after the checkpoint, we can
adjust roll-forward mechanism for the further fsync calls, which is able to
improve the fsync performance significatly.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Haicheng Li [Thu, 13 Jun 2013 08:59:29 +0000 (16:59 +0800)]
f2fs: optimize do_write_data_page()
Since "need_inplace_update() == true" is a very rare case, using unlikely()
to give compiler a chance to optimize the code.
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Haicheng Li [Thu, 13 Jun 2013 08:59:28 +0000 (16:59 +0800)]
f2fs: make locate_dirty_segment() as static
It's used only locally and could be static.
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Haicheng Li [Thu, 13 Jun 2013 08:59:27 +0000 (16:59 +0800)]
f2fs: remove unnecessary parameter "offset" from __add_sum_entry()
We can get the value directly from pointer "curseg".
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 10 Jun 2013 00:17:01 +0000 (09:17 +0900)]
f2fs: avoid freqeunt write_inode calls
If update_inode is called, we don't need to do write_inode.
So, let's use a *dirty* flag for each inode.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Sat, 8 Jun 2013 12:25:40 +0000 (21:25 +0900)]
f2fs: optimise the truncate_data_blocks_range() range
The function truncate_data_blocks_range() decrements the valid
block count of inode via dec_valid_block_count(). Since this
function updates the i_blocks field of inode, we can update this
field once we have calculated total the number of blocks
to be freed.
Therefore we can decrement valid blocks outside of the for loop.
if (nr_free) {
+ dec_valid_block_count(sbi, dn->inode, nr_free);
set_page_dirty(dn->node_page);
sync_inode_page(dn);
}
'nr_free' tells the total number of blocks freed. So, we can
just directly pass this value to dec_valid_block_count() and update
the i_blocks.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Sat, 8 Jun 2013 12:25:28 +0000 (21:25 +0900)]
f2fs: use the F2FS specific flags in f2fs_ioctl()
In f2fs_ioctl() function, it is using generic flags.
Since F2FS specific flags are defined. So lets use
those flags.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Fri, 7 Jun 2013 13:08:23 +0000 (22:08 +0900)]
f2fs: sync dir->i_size with its block allocation
If new dentry block is allocated and its i_size is updated, we should update
its inode block together in order to sync i_size and its block allocation.
Otherwise, we can loose additional dentry block due to the unconsistent i_size.
Errorneous Scenario
-------------------
In the recovery routine,
- recovery_dentry
| - __f2fs_add_link
| | - get_new_data_page
| | | - i_size_write(new_i_size)
| | | - mark_inode_dirty_sync(dir)
| | - update_parent_metadata
| | | - mark_inode_dirty(dir)
|
- write_checkpoint
- sync_dirty_dir_inodes
- filemap_flush(dentry_blocks)
- f2fs_write_data_page
- skip to write the last dentry block due to index < i_size
In the above flow, new_i_size is not updated to its inode block so that the
last dentry block will be lost accordingly.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Fri, 7 Jun 2013 07:33:07 +0000 (16:33 +0900)]
f2fs: fix i_blocks translation on various types of files
Basically an inode manages the number of allocated blocks with inode->i_blocks
which is represented in a unit of sectors, not file system blocks.
But, f2fs has used i_blocks in a unit of file system blocks, and f2fs_getattr
translates it to the number of sectors when fstat is called.
However, previously f2fs_file_inode_operations only has this, so this patch adds
it to all the types of inode_operations.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Gu Zheng [Fri, 7 Jun 2013 06:16:53 +0000 (14:16 +0800)]
f2fs: set sb->s_fs_info before calling parse_options()
In f2fs_fill_super(), set sb->s_fs_info before calling parse_options(), then we can get
f2fs_sb_info via F2FS_SB(sb) in parse_options().
So that the second argument "sbi" of func parse_options() is no longer needed.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 3 Jun 2013 10:46:19 +0000 (19:46 +0900)]
f2fs: support xattr security labels
This patch adds the support of security labels for f2fs, which will be used
by Linus Security Models (LSMs).
Quote from http://en.wikipedia.org/wiki/Linux_Security_Modules:
"Linux Security Modules (LSM) is a framework that allows the Linux kernel to
support a variety of computer security models while avoiding favoritism toward
any single security implementation. The framework is licensed under the terms of
the GNU General Public License and is standard part of the Linux kernel since
Linux 2.6. AppArmor, SELinux, Smack and TOMOYO Linux are the currently accepted
modules in the official kernel.".
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Wed, 5 Jun 2013 08:42:45 +0000 (17:42 +0900)]
f2fs: fix iget/iput of dir during recovery
It is possible that iput is skipped after iget during the recovery.
In recover_dentry(),
dir = f2fs_iget();
...
if (de && inode->i_ino == le32_to_cpu(de->ino))
goto out;
In this case, this dir is not able to be added in dirty_dir_inode_list.
The actual linking is done only when set_page_dirty() is called.
So let's add this newly got inode into the list explicitly, and put it at the
end of the recovery routine.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Sat, 1 Jun 2013 07:20:26 +0000 (16:20 +0900)]
f2fs: reorganise the function get_victim_by_default
Fix the function get_victim_by_default, where it checks
for the condition that p.min_segno != NULL_SEGNO as
shown:
if (p.min_segno != NULL_SEGNO)
goto got_it;
and if above condition is true then
got_it:
if (p.min_segno != NULL_SEGNO) {
So this condition is being checked twice. Hence move the goto
statement after the if condition so that duplication of condition
check is avoided.
Also this function makes a call to get_max_cost() to compute
the max cost based on the f2fs_sbi_info and victim policy. Since
get_max_cost depends on on three parameters of victim_sel_policy
=> alloc_mode, gc_mode & ofs_unit, once this victim policy is
initialised, these value will not change till the execution
time of get_victim_by_default() & also f2fs_sbi_info structure
parameters will not change.
Hence making calls to get_max_cost() in while loop does not seems to
be a good point. Instead we can call it once in begining and store
the results in local variable, which later can serve our purpose
for comparing the cost with max cost inside the while loop.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jason Hrycay [Fri, 31 May 2013 17:45:11 +0000 (12:45 -0500)]
f2fs: handle errors from get_node_page calls
Add check for error pointers returned from get_node_page in order to
avoid dereferencing a bad address on the next use.
Signed-off-by: Jason Hrycay <jason.hrycay@motorola.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Tue, 28 May 2013 03:25:47 +0000 (12:25 +0900)]
f2fs: cover cp_file information with ilock
If a file is linked with other files, it should be checkpointed at every fsync
calls.
For this, we use set_cp_file() with FADVISE_CP_BIT, but previously we didn't
cover the flag by the global lock.
This patch fixes that the inode page stores this correctly.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Tue, 28 May 2013 00:59:27 +0000 (09:59 +0900)]
f2fs: fix incorrect iputs during the dentry recovery
- iget/iput flow in the dentry recovery process
1. *dir* = f2fs_iget
2. set FI_DELAY_IPUT to *dir*
3. add *dir* to the dirty_dir_list
- __f2fs_add_link
- recover_dentry)
4. iput *dir* by remove_dirty_dir_inode
- sync_dirty_dir_inodes
- write_chekcpoint
If *dir*'s i_count is not 1 (i.e., root dir), remove_dirty_dir_inode is called
later and then iput is triggered again due to the FI_DELAY_IPUT flag.
So, let's unset the flag properly once iput is triggered.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Tue, 28 May 2013 00:19:22 +0000 (09:19 +0900)]
f2fs: fix dentry recovery routine
The error scenario is:
1. create /a
(1.a link /a /b)
2. sync
3. unlinke /a
4. create /a
5. fsync /a
6. Sudden power-off
When the f2fs recovers the fsynced dentry, /a, we discover an exsiting dentry at
f2fs_find_entry() in recover_dentry().
In such the case, we should unlink the existing dentry and its inode
and then recover newly created dentry.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 27 May 2013 01:32:01 +0000 (10:32 +0900)]
f2fs: iput only if whole data blocks are flushed
If there remains some unwritten blocks from the recovery, we should not call
iput on that directory inode.
Otherwise, we can loose some dentry blocks after the recovery.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Sun, 26 May 2013 02:05:32 +0000 (11:05 +0900)]
f2fs: return proper error from start_gc_thread
when there is an error from kthread_run, then return proper error
rather than returning -ENOMEM.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Thu, 23 May 2013 13:58:40 +0000 (22:58 +0900)]
f2fs: optimize several routines in node.h
There are various functions with common code which could be separated
out to make common routines. So, made new routines and in order to
retain the same call path and no major changes, written some macros
to access those routines.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Thu, 23 May 2013 13:58:07 +0000 (22:58 +0900)]
f2fs: remove unneeded initializations in f2fs_parent_dir
There is no need to initialize few pointers in f2fs_parent_dir
as the values are not checked and instead directly initialized
values are used.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Thu, 23 May 2013 13:57:53 +0000 (22:57 +0900)]
f2fs: push some variables to debug part
Some, counters are needed only for the statistical information
while debugging.
So, those can be controlled using CONFIG_F2FS_STAT_FS,
pushing the usage for few variables under this flag.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Fri, 24 May 2013 03:41:04 +0000 (12:41 +0900)]
f2fs: align data types between on-disk and in-memory block addresses
The on-disk block address is defined as __le32, but in-memory block address,
block_t, does as u64.
Let's synchronize them to 32 bits.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Dan Carpenter [Thu, 23 May 2013 10:02:13 +0000 (13:02 +0300)]
f2fs: dereferencing an ERR_PTR
There is an error path where "dir" is an ERR_PTR.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Wed, 22 May 2013 03:06:26 +0000 (12:06 +0900)]
f2fs: use ihold
Use the following helper function committed by Al.
commit
7de9c6ee3ecffd99e1628e81a5ea5468f7581a1f
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Sat Oct 23 11:11:40 2010 -0400
new helper: ihold()
...
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Wed, 22 May 2013 03:03:47 +0000 (12:03 +0900)]
f2fs: should not make_bad_inode on f2fs_link failure
If -ENOSPC is met during f2fs_link, we should not make the inode as bad.
The inode is still alive.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Tue, 21 May 2013 23:20:01 +0000 (08:20 +0900)]
f2fs: fix to handle do_recover_data errors
This patch adds error handling codes of check_index_in_prev_nodes and its
caller, do_recover_data.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Tue, 21 May 2013 23:02:02 +0000 (08:02 +0900)]
f2fs: reuse the locked dnode page and its inode
This patch fixes the following deadlock bug during the recovery.
INFO: task mount:1322 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
mount D
ffffffff81125870 0 1322 1266 0x00000000
ffff8801207e39d8 0000000000000046 ffff88012ab1dee0 0000000000000046
ffff8801207e3a08 ffff880115903f40 ffff8801207e3fd8 ffff8801207e3fd8
ffff8801207e3fd8 ffff880115903f40 ffff8801207e39d8 ffff88012fc94520
Call Trace:
[<
ffffffff81125870>] ? __lock_page+0x70/0x70
[<
ffffffff816a92d9>] schedule+0x29/0x70
[<
ffffffff816a93af>] io_schedule+0x8f/0xd0
[<
ffffffff8112587e>] sleep_on_page+0xe/0x20
[<
ffffffff816a649a>] __wait_on_bit_lock+0x5a/0xc0
[<
ffffffff81125867>] __lock_page+0x67/0x70
[<
ffffffff8106c7b0>] ? autoremove_wake_function+0x40/0x40
[<
ffffffff81126857>] find_lock_page+0x67/0x80
[<
ffffffff8112698f>] find_or_create_page+0x3f/0xb0
[<
ffffffffa03901a8>] ? sync_inode_page+0xa8/0xd0 [f2fs]
[<
ffffffffa038fdf7>] get_node_page+0x67/0x180 [f2fs]
[<
ffffffffa039818b>] recover_fsync_data+0xacb/0xff0 [f2fs]
[<
ffffffff816aaa1e>] ? _raw_spin_unlock+0x3e/0x40
[<
ffffffffa0389634>] f2fs_fill_super+0x7d4/0x850 [f2fs]
[<
ffffffff81184cf9>] mount_bdev+0x1c9/0x210
[<
ffffffffa0388e60>] ? validate_superblock+0x180/0x180 [f2fs]
[<
ffffffffa0387635>] f2fs_mount+0x15/0x20 [f2fs]
[<
ffffffff81185a13>] mount_fs+0x43/0x1b0
[<
ffffffff81145ba0>] ? __alloc_percpu+0x10/0x20
[<
ffffffff811a0796>] vfs_kern_mount+0x76/0x120
[<
ffffffff811a2cb7>] do_mount+0x237/0xa10
[<
ffffffff81140b9b>] ? strndup_user+0x5b/0x80
[<
ffffffff811a3520>] SyS_mount+0x90/0xe0
[<
ffffffff816b3502>] system_call_fastpath+0x16/0x1b
The bug is triggered when check_index_in_prev_nodes tries to get the direct
node page by calling get_node_page.
At this point, if the direct node page is already locked by get_dnode_of_data,
its caller, we got a deadlock condition.
This patch adds additional condition check for the reuse of locked direct node
pages prior to the get_node_page call.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Tue, 21 May 2013 01:17:56 +0000 (10:17 +0900)]
f2fs: fix wrong condition check
While an orphan inode has zero link_count, f2fs_gc is able to select the inode
for foreground gc.
- f2fs_gc
- do_garbage_collect
- gc_data_segment
: f2fs_iget is failed
: get_valid_blocks() != 0, so that retry
--> here we got the infinite loop.
This patch resolved this issue.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 20 May 2013 11:28:47 +0000 (20:28 +0900)]
f2fs: add f2fs_readonly()
Introduce a simple macro function for readability.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 20 May 2013 07:15:22 +0000 (16:15 +0900)]
f2fs: avoid RECLAIM_FS-ON-W: deadlock
This patch tries to avoid the following deadlock condition of which the reclaim
path can trigger f2fs_balance_fs again.
=================================
[ INFO: inconsistent lock state ]
---------------------------------
inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage.
kswapd0/41 [HC0[0]:SC0[0]:HE1:SE1] takes:
(&sbi->gc_mutex){+.+.?.}, at: f2fs_balance_fs+0xe6/0x100 [f2fs]
{RECLAIM_FS-ON-W} state was registered at:
[<
ffffffff810aa5a9>] mark_held_locks+0xb9/0x140
[<
ffffffff810aae85>] lockdep_trace_alloc+0x85/0xf0
[<
ffffffff8113ab2c>] __alloc_pages_nodemask+0x7c/0x9b0
[<
ffffffff81175aa8>] alloc_pages_current+0xb8/0x180
[<
ffffffff811319cf>] __page_cache_alloc+0xaf/0xd0
[<
ffffffff8113225c>] find_or_create_page+0x4c/0xb0
[<
ffffffffa021359e>] find_data_page+0x14e/0x210 [f2fs]
[<
ffffffffa021161b>] f2fs_gc+0x9eb/0xd90 [f2fs]
[<
ffffffffa0218fae>] f2fs_balance_fs+0xee/0x100 [f2fs]
[<
ffffffffa020848c>] f2fs_setattr+0x6c/0x200 [f2fs]
[<
ffffffff811ae51b>] notify_change+0x1db/0x3a0
[<
ffffffff8118fbd0>] do_truncate+0x60/0xa0
[<
ffffffff8118fd95>] vfs_truncate+0x185/0x1b0
[<
ffffffff8118fe1c>] do_sys_truncate+0x5c/0xa0
[<
ffffffff8118ffee>] SyS_truncate+0xe/0x10
[<
ffffffff816e2b42>] system_call_fastpath+0x16/0x1b
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 20 May 2013 05:48:49 +0000 (14:48 +0900)]
f2fs: don't do checkpoint if error is occurred
If we met an error during the dentry recovery, we should not conduct checkpoint.
Otherwise, some errorneous dentry blocks overwrites the existing blocks that
contain the remaining recovery information.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 20 May 2013 01:26:09 +0000 (10:26 +0900)]
f2fs: fix to unlock page before exit
If we got an error after lock_page, we should unlock it before exit.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Jaegeuk Kim [Mon, 20 May 2013 01:23:40 +0000 (10:23 +0900)]
f2fs: remove unnecessary kmap/kunmap operations
The allocated page used by the recovery is not on HIGHMEM, so that we don't
need to use kmap/kunmap.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Namjae Jeon [Sun, 28 Apr 2013 00:04:18 +0000 (09:04 +0900)]
f2fs: reorganize f2fs_vm_page_mkwrite
Few things can be changed in the default mkwrite function
1) Make file_update_time at the start before acquiring any lock
2) the condition page_offset(page) >= i_size_read(inode) should be
changed to page_offset(page) > i_size_read
3) Move wait_on_page_writeback.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
majianpeng [Tue, 14 May 2013 12:06:46 +0000 (20:06 +0800)]
f2fs: use list_for_each_entry rather than list_for_each_entry_safe
We can do this, since now we use a global mutex, f2fs_stat_mutex to protect its
list operations.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
[Jaegeuk Kim: add description]
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Haicheng Li [Tue, 14 May 2013 10:20:28 +0000 (18:20 +0800)]
f2fs: remove unecessary variable and code
Code cleanup without behavior changed.
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>