platform/kernel/linux-3.10.git
9 years agof2fs: use seq_puts()/seq_putc() rather than seq_printf() where possible
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>
9 years agof2fs: fix i_name during f2fs_sync_file
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>
9 years agof2fs: update file name in the inode block during f2fs_rename
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>
9 years agof2fs: introduce help function F2FS_NODE()
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>
9 years agof2fs: add a help func F2FS_STAT() to get the f2fs_stat_info
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>
9 years agof2fs: add proc entry to monitor current usage of segments
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>
9 years agof2fs: add description for fsck.f2fs and dump.f2fs
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>
9 years agof2fs: recover date requested by fdatasync
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>
9 years agoARM: dts: Add dts file for exynos4412-redwoodlte board
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>
9 years agof2fs: fix to recover i_size from roll-forward
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>
9 years agof2fs: remove the unused argument "sbi" of func destroy_fsync_dnodes()
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>
9 years agof2fs: remove reusing any prefree segments
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>
9 years agof2fs: code cleanup and simplify in func {find/add}_gc_inode
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>
9 years agof2fs: optimize the init_dirty_segmap function
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>
9 years agof2fs: fix an endian conversion bug detected by sparse
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>
9 years agof2fs: fix crc endian conversion
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>
9 years agof2fs: add remount_fs callback support
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>
9 years agof2fs: recover wrong pino after checkpoint during fsync
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>
9 years agof2fs: optimize do_write_data_page()
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>
9 years agof2fs: make locate_dirty_segment() as static
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>
9 years agof2fs: remove unnecessary parameter "offset" from __add_sum_entry()
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>
9 years agof2fs: avoid freqeunt write_inode calls
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>
9 years agof2fs: optimise the truncate_data_blocks_range() range
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>
9 years agof2fs: use the F2FS specific flags in f2fs_ioctl()
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>
9 years agof2fs: sync dir->i_size with its block allocation
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>
9 years agof2fs: fix i_blocks translation on various types of files
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>
9 years agof2fs: set sb->s_fs_info before calling parse_options()
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>
9 years agof2fs: support xattr security labels
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>
9 years agof2fs: fix iget/iput of dir during recovery
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>
9 years agof2fs: reorganise the function get_victim_by_default
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>
9 years agof2fs: handle errors from get_node_page calls
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>
9 years agof2fs: cover cp_file information with ilock
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>
9 years agof2fs: fix incorrect iputs during the dentry recovery
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>
9 years agof2fs: fix dentry recovery routine
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>
9 years agof2fs: iput only if whole data blocks are flushed
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>
9 years agof2fs: return proper error from start_gc_thread
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>
9 years agof2fs: optimize several routines in node.h
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>
9 years agof2fs: remove unneeded initializations in f2fs_parent_dir
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>
9 years agof2fs: push some variables to debug part
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>
9 years agof2fs: align data types between on-disk and in-memory block addresses
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>
9 years agof2fs: dereferencing an ERR_PTR
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>
9 years agof2fs: use ihold
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>
9 years agof2fs: should not make_bad_inode on f2fs_link failure
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>
9 years agof2fs: fix to handle do_recover_data errors
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>
9 years agof2fs: reuse the locked dnode page and its inode
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>
9 years agof2fs: fix wrong condition check
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>
9 years agof2fs: add f2fs_readonly()
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>
9 years agof2fs: avoid RECLAIM_FS-ON-W: deadlock
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>
9 years agof2fs: don't do checkpoint if error is occurred
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>
9 years agof2fs: fix to unlock page before exit
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>
9 years agof2fs: remove unnecessary kmap/kunmap operations
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>
9 years agof2fs: reorganize f2fs_vm_page_mkwrite
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>
9 years agof2fs: use list_for_each_entry rather than list_for_each_entry_safe
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>
9 years agof2fs: remove unecessary variable and code
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>
9 years agof2fs, lockdep: annotate mutex_lock_all()
Peter Zijlstra [Thu, 16 May 2013 18:03:12 +0000 (20:03 +0200)]
f2fs, lockdep: annotate mutex_lock_all()

Majianpeng reported a lockdep splat for f2fs. It turns out mutex_lock_all()
acquires an array of locks (in global/local lock style).

Any such operation is always serialized using cp_mutex, therefore there is no
fs_lock[] lock-order issue; tell lockdep about this using the
mutex_lock_nest_lock() primitive.

Reported-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: add debug msgs in the recovery routine
Jaegeuk Kim [Thu, 16 May 2013 06:04:49 +0000 (15:04 +0900)]
f2fs: add debug msgs in the recovery routine

This patch adds some trivial debugging messages in the recovery process.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: update inode page after creation
Jaegeuk Kim [Mon, 20 May 2013 01:10:29 +0000 (10:10 +0900)]
f2fs: update inode page after creation

I found a bug when testing power-off-recovery as follows.

[Bug Scenario]
1. create a file
2. fsync the file
3. reboot w/o any sync
4. try to recover the file
 - found its fsync mark
 - found its dentry mark
   : try to recover its dentry
    - get its file name
    - get its parent inode number
     : here we got zero value

The reason why we get the wrong parent inode number is that we didn't
synchronize the inode page with its newly created inode information perfectly.

Especially, previous f2fs stores fi->i_pino and writes it to the cached
node page in a wrong order, which incurs the zero-valued i_pino during the
recovery.

So, this patch modifies the creation flow to fix the synchronization order of
inode page with its inode.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: change get_new_data_page to pass a locked node page
Jaegeuk Kim [Mon, 20 May 2013 00:55:50 +0000 (09:55 +0900)]
f2fs: change get_new_data_page to pass a locked node page

This patch is for passing a locked node page to get_dnode_of_data.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: skip get_node_page if locked node page is passed
Jaegeuk Kim [Mon, 20 May 2013 00:42:28 +0000 (09:42 +0900)]
f2fs: skip get_node_page if locked node page is passed

If get_dnode_of_data gets a locked node page, let's skip redundant
get_node_page calls.
This is for the futher enhancement.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: remove unnecessary por_doing check
Jaegeuk Kim [Wed, 15 May 2013 23:57:43 +0000 (08:57 +0900)]
f2fs: remove unnecessary por_doing check

This por_doing check is totally not related to the recovery process.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: fix BUG_ON during f2fs_evict_inode(dir)
Jaegeuk Kim [Wed, 15 May 2013 07:40:02 +0000 (16:40 +0900)]
f2fs: fix BUG_ON during f2fs_evict_inode(dir)

During the dentry recovery routine, recover_inode() triggers __f2fs_add_link
with its directory inode.

In the following scenario, a bug is captured.
 1. dir = f2fs_iget(pino)
 2. __f2fs_add_link(dir, name)
 3. iput(dir)
  -> f2fs_evict_inode() faces with BUG_ON(atomic_read(fi->dirty_dents))

Kernel BUG at ffffffffa01c0676 [verbose debug info unavailable]
[<ffffffffa01c0676>] f2fs_evict_inode+0x276/0x300 [f2fs]
Call Trace:
 [<ffffffff8118ea00>] evict+0xb0/0x1b0
 [<ffffffff8118f1c5>] iput+0x105/0x190
 [<ffffffffa01d2dac>] recover_fsync_data+0x3bc/0x1070 [f2fs]
 [<ffffffff81692e8a>] ? io_schedule+0xaa/0xd0
 [<ffffffff81690acb>] ? __wait_on_bit_lock+0x7b/0xc0
 [<ffffffff8111a0e7>] ? __lock_page+0x67/0x70
 [<ffffffff81165e21>] ? kmem_cache_alloc+0x31/0x140
 [<ffffffff8118a502>] ? __d_instantiate+0x92/0xf0
 [<ffffffff812a949b>] ? security_d_instantiate+0x1b/0x30
 [<ffffffff8118a5b4>] ? d_instantiate+0x54/0x70

This means that we should flush all the dentry pages between iget and iput().
But, during the recovery routine, it is unallowed due to consistency, so we
have to wait the whole recovery process.
And then, write_checkpoint flushes all the dirty dentry blocks, and nicely we
can put the stale dir inodes from the dirty_dir_inode_list.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: fix por_doing variable coverage
Jaegeuk Kim [Wed, 15 May 2013 07:12:18 +0000 (16:12 +0900)]
f2fs: fix por_doing variable coverage

The reason of using sbi->por_doing is to alleviate data writes during the
recovery.
The find_fsync_dnodes() produces some dirty dentry pages, so we should
cover it too with sbi->por_doing.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: remove redundant assignment
Jaegeuk Kim [Wed, 15 May 2013 01:49:13 +0000 (10:49 +0900)]
f2fs: remove redundant assignment

We don't need to assign a value redundantly.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: fix the inconsistent state of data pages
Jaegeuk Kim [Sun, 12 May 2013 23:38:35 +0000 (08:38 +0900)]
f2fs: fix the inconsistent state of data pages

In get_lock_data_page, if there is a data race between get_dnode_of_data for
node and grab_cache_page for data, f2fs is able to face with the following
BUG_ON(dn.data_blkaddr == NEW_ADDR).

kernel BUG at /home/zeus/f2fs_test/src/fs/f2fs/data.c:251!
 [<ffffffffa044966c>] get_lock_data_page+0x1ec/0x210 [f2fs]
Call Trace:
 [<ffffffffa043b089>] f2fs_readdir+0x89/0x210 [f2fs]
 [<ffffffff811a0920>] ? fillonedir+0x100/0x100
 [<ffffffff811a0920>] ? fillonedir+0x100/0x100
 [<ffffffff811a07f8>] vfs_readdir+0xb8/0xe0
 [<ffffffff811a0b4f>] sys_getdents+0x8f/0x110
 [<ffffffff816d7999>] system_call_fastpath+0x16/0x1b

This bug is able to be occurred when the block address of the data block is
changed after f2fs_put_dnode().
In order to avoid that, this patch fixes the lock order of node and data
blocks in which the node block lock is covered by the data block lock.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agof2fs: fix inconsistency of block count during recovery
Jaegeuk Kim [Tue, 14 May 2013 06:47:43 +0000 (15:47 +0900)]
f2fs: fix inconsistency of block count during recovery

Currently f2fs recovers the dentry of fsynced files.
When power-off-recovery is conducted, this newly recovered inode should increase
node block count as well as inode block count.

This patch resolves this inconsistency that results in:

1. create a file
2. write data
3. fsync
4. reboot without sync
5. mount and recover the file
6. node block count is 1 and inode block count is 2
 : fall into the inconsistent state
7. unlink the file
 : trigger the following BUG_ON

------------[ cut here ]------------
kernel BUG at /home/zeus/f2fs_test/src/fs/f2fs/f2fs.h:716!
Call Trace:
 [<ffffffffa0344100>] ? get_node_page+0x50/0x1a0 [f2fs]
 [<ffffffffa0344bfc>] remove_inode_page+0x8c/0x100 [f2fs]
 [<ffffffffa03380f0>] ? f2fs_evict_inode+0x180/0x2d0 [f2fs]
 [<ffffffffa033812e>] f2fs_evict_inode+0x1be/0x2d0 [f2fs]
 [<ffffffff811c7a67>] evict+0xa7/0x1a0
 [<ffffffff811c82b5>] iput+0x105/0x190
 [<ffffffff811c2b30>] d_kill+0xe0/0x120
 [<ffffffff811c2c57>] dput+0xe7/0x1e0
 [<ffffffff811acc3d>] __fput+0x19d/0x2d0
 [<ffffffff811acd7e>] ____fput+0xe/0x10
 [<ffffffff81070645>] task_work_run+0xb5/0xe0
 [<ffffffff81002941>] do_notify_resume+0x71/0xb0
 [<ffffffff8175f14a>] int_signal+0x12/0x17

Reported-and-Tested-by: Chris Fries <C.Fries@motorola.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
9 years agoARM: dts:exynos4412-m0: update gpio-keys configuration
Beomho Seo [Fri, 26 Jul 2013 08:01:52 +0000 (17:01 +0900)]
ARM: dts:exynos4412-m0: update gpio-keys configuration

add gpio-keys configuration for support M0 board
supported gpio-keys are volume up, volume down, power and ok key

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agommc: Makefile: change the init sequence for indexing mmcblkX
Jaehoon Chung [Thu, 25 Jul 2013 11:12:08 +0000 (20:12 +0900)]
mmc: Makefile: change the init sequence for indexing mmcblkX

To ensure mmcblk0 for eMMC, must call the dwmmc before calling sdhci.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agoARM: tizen_defconfig: enable unsafe resume config
Jaehoon Chung [Thu, 25 Jul 2013 04:45:27 +0000 (13:45 +0900)]
ARM: tizen_defconfig: enable unsafe resume config

Enabled the unsafe rsume configuration

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agoARM: dts: exynos4412-redwood: Add i2c node for MAX77693
Jonghwa Lee [Mon, 17 Jun 2013 08:21:21 +0000 (17:21 +0900)]
ARM: dts: exynos4412-redwood: Add i2c node for MAX77693

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoextcon: max77693: Fix bug related to MAX77693 irq when set ADC debounce time
Jonghwa Lee [Tue, 18 Jun 2013 06:01:37 +0000 (15:01 +0900)]
extcon: max77693: Fix bug related to MAX77693 irq when set ADC debounce time

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
9 years agodrm/exynos: add runtime pm interfaces to g2d driver
Inki Dae [Wed, 24 Jul 2013 06:28:57 +0000 (15:28 +0900)]
drm/exynos: add runtime pm interfaces to g2d driver

This patch makes g2d power domain and clock to be controlled
with runtime pm interfaces instead of controlling them
respectively.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agoARM: tizen_defconfig: enable the exynos dw-mmc
Jaehoon Chung [Wed, 24 Jul 2013 05:47:31 +0000 (14:47 +0900)]
ARM: tizen_defconfig: enable the exynos dw-mmc

For using dw_mmc-exynos, updated the tizen_defconfig

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agoclock: clk-exynos4: set the CLK_SET_RATE_PARENT for mmc4
Jaehoon Chung [Wed, 24 Jul 2013 05:11:08 +0000 (14:11 +0900)]
clock: clk-exynos4: set the CLK_SET_RATE_PARENT for mmc4

mmc4_clk set to CLK_SET_PARENT with DIV_F().

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agoARM: dts: updated the dwmmc device tree for clk name
Jaehoon Chung [Wed, 3 Jul 2013 06:19:29 +0000 (15:19 +0900)]
ARM: dts: updated the dwmmc device tree for clk name

To get clk for dwmmc, added the clk-name.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agoARM: dts: enable dw-mmc controlle instead of sdhci controller
Jaehoon Chung [Wed, 24 Jul 2013 05:45:33 +0000 (14:45 +0900)]
ARM: dts: enable dw-mmc controlle instead of sdhci controller

Using dw-mmc controller.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agommc: dw_mmc: Add the ability to set the ciu clock frequency
Doug Anderson [Fri, 7 Jun 2013 17:28:30 +0000 (10:28 -0700)]
mmc: dw_mmc: Add the ability to set the ciu clock frequency

As of now we rely on code outside of the driver to set the ciu clock
frequency.  There's no reason to do that.  Add support for setting up
the clock in the driver during probe.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
9 years agommc: dw_mmc: Handle late vmmc regulators with EPROBE_DEFER
Doug Anderson [Fri, 7 Jun 2013 17:28:29 +0000 (10:28 -0700)]
mmc: dw_mmc: Handle late vmmc regulators with EPROBE_DEFER

It is possible to specify a regulator that should be turned on when
dw_mmc is probed.  At the moment dw_mmc will fail to use the regulator
properly if the regulator probes after dw_mmc.  Fix this problem by
honoring EPROBE_DEFER.

At the same time move the regulator code out of the slot init code.
We only specify one regulator for the whole device and other parts of
the code (like suspend/resume) assume that the regulator has only been
enabled once.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
9 years agommc: dw_mmc: change the macro name from DTO to DRTO
Jaehoon Chung [Mon, 27 May 2013 04:47:57 +0000 (13:47 +0900)]
mmc: dw_mmc: change the macro name from DTO to DRTO

At Interrupt status register, Bit9 is Data Read Timeout.
But we used macro name as the DTO. It could be confused with the
Data Transfer Over(DTO)-Bit[3].
It's clearly that is changed the DRTO instead of DTO.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
9 years agommc: dw_mmc: clear IDSTS register when initialize IDMAC
Joonyoung Shim [Fri, 26 Apr 2013 06:35:22 +0000 (15:35 +0900)]
mmc: dw_mmc: clear IDSTS register when initialize IDMAC

If pending interrupt for IDMAC exists when initialize IDMAC, it will
call interrupt handler unnecessarily.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
9 years agommc: dw_mmc: fix error return code in dw_mci_probe()
Wei Yongjun [Fri, 19 Apr 2013 01:25:45 +0000 (09:25 +0800)]
mmc: dw_mmc: fix error return code in dw_mci_probe()

Fix to return -ENOMEM in alloc workqueue error case instead
of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
9 years agoARM: dts: exynos4412-slp_pq: add device node for g2d iommu
Inki Dae [Wed, 24 Jul 2013 04:41:34 +0000 (13:41 +0900)]
ARM: dts: exynos4412-slp_pq: add device node for g2d iommu

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: consider common clock framework to g2d driver.
Inki Dae [Wed, 24 Jul 2013 04:40:12 +0000 (13:40 +0900)]
drm/exynos: consider common clock framework to g2d driver.

This patch just changes clk_enable/disable to
clk_prepare_enable/clk_disable_unprepare.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agoARM: configs: update tizen_defconfig
Inki Dae [Tue, 23 Jul 2013 09:00:16 +0000 (18:00 +0900)]
ARM: configs: update tizen_defconfig

Enabling exynos drm iommu support and disabling DRM based
IPP drivers. IPP drivers don't support IOMMU yet.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agoARM: dts: exynos4412-slp_pq: add fimd iommu related properties
Inki Dae [Tue, 23 Jul 2013 08:26:35 +0000 (17:26 +0900)]
ARM: dts: exynos4412-slp_pq: add fimd iommu related properties

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: fix module build error
Inki Dae [Mon, 22 Jul 2013 10:57:05 +0000 (19:57 +0900)]
drm/exynos: fix module build error

Exynos drm drivers don't need to export device tables because
all devices of Exynos drm include in one SoC so they cannot be
plugged in.

P.S. we need to create MODULE_DEVICE_TABLE in case of enabling
the linux-hotplug system to load the driver automatically when
the device is plugged in.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodmabuf-sync: add private backend callbacks
Inki Dae [Mon, 22 Jul 2013 03:52:01 +0000 (12:52 +0900)]
dmabuf-sync: add private backend callbacks

This ops has just a free callback to release resource for each
device driver. free callback will be called when device driver's
sync object is freed. So device drivers should implement this callback
so that their own contexts can be cleaned up regarding sync object.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodmabuf-sync: remove unnecessary the use of mutex lock.
Inki Dae [Mon, 22 Jul 2013 03:47:39 +0000 (12:47 +0900)]
dmabuf-sync: remove unnecessary the use of mutex lock.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodmabuf-sync: fix sync lock to multiple read
Inki Dae [Mon, 22 Jul 2013 03:42:35 +0000 (12:42 +0900)]
dmabuf-sync: fix sync lock to multiple read

This patch fixes the issue that a sync object is unlocked
when shared_cnt is bigger than 1 and sobj->access_type is write.

the below number means shared_cnt and three sync objects share
one buffer,
r r r w
when write locked 1 2 3 3 <- blocked
when read unlocked 2
when read unlocked 1
when read unlocked 1 <- waked up

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agocpufreq: exynos: fix section mismatch
Seung-Woo Kim [Fri, 19 Jul 2013 07:52:29 +0000 (16:52 +0900)]
cpufreq: exynos: fix section mismatch

Non init data, exynos_cpufreq_driver references init data,
exynos_cpufreq_probe and exynos_cpufreq_of_match, and this causes
section mismatch.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agomax77693_charger: fix section mismatch
Seung-Woo Kim [Fri, 19 Jul 2013 07:45:57 +0000 (16:45 +0900)]
max77693_charger: fix section mismatch

max77693_charger_of_match with __initconst flag is referenced from
max77693_charger_driver which is non init data and this causes
section mismatch. So flag __initconst is removed.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agoclk: samsung: fix section mismatch from audio subsystem clocks
Seung-Woo Kim [Fri, 19 Jul 2013 07:41:44 +0000 (16:41 +0900)]
clk: samsung: fix section mismatch from audio subsystem clocks

The init function should have __init flag to match reference
sections.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
9 years agodts: arm: add arm-pmu node for exynos4412
Chanho Park [Fri, 19 Jul 2013 07:18:56 +0000 (16:18 +0900)]
dts: arm: add arm-pmu node for exynos4412

This patch enables arm-pmu node of exynos4412. It has 4 cpus. Thus, it also
has 4 performance counter.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
9 years agoperf tools: Add missing liblk.a dependency for python/perf.so
Jiri Olsa [Mon, 15 Apr 2013 03:54:14 +0000 (05:54 +0200)]
perf tools: Add missing liblk.a dependency for python/perf.so

Adding missing liblk.a dependency for python/perf.so.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-26-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Remove '?=' Makefile STRIP assignment
Jiri Olsa [Mon, 15 Apr 2013 02:49:43 +0000 (04:49 +0200)]
perf tools: Remove '?=' Makefile STRIP assignment

No need to use '?=' assignment for STRIP variable, the standard
'=' does the same job without creating confusion.

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: http://lkml.kernel.org/r/1369398928-9809-25-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Replace multiple line assignment with multiple statements
Jiri Olsa [Mon, 15 Apr 2013 02:32:28 +0000 (04:32 +0200)]
perf tools: Replace multiple line assignment with multiple statements

Replacing multiple line assignment with multiple statements.

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-24-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Replace tabs with spaces for all non-commands statements
Jiri Olsa [Mon, 15 Apr 2013 02:06:58 +0000 (04:06 +0200)]
perf tools: Replace tabs with spaces for all non-commands statements

Replacing tabs with spaces for all non-commands statements
in 'Makefile' and 'config/Makefile' files.

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-23-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Add NO_BIONIC variable to confiure bionic setup
Jiri Olsa [Fri, 24 May 2013 12:35:24 +0000 (14:35 +0200)]
perf tools: Add NO_BIONIC variable to confiure bionic setup

Adding NO_BIONIC variable to confiure bionic setup

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-22-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Switch to full path C include directories
Jiri Olsa [Fri, 24 May 2013 12:35:23 +0000 (14:35 +0200)]
perf tools: Switch to full path C include directories

Switching to full path C include directories, to make the includes
clear. Plus little include cleanup.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-21-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Merge all *LDFLAGS* make variable into LDFLAGS
Jiri Olsa [Thu, 21 Mar 2013 10:41:05 +0000 (11:41 +0100)]
perf tools: Merge all *LDFLAGS* make variable into LDFLAGS

Merging all *LDFLAGS* make variable into LDFLAGS to eliminate all
special *LDFLAGS* variables and make the setup clear.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-20-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Merge all *CFLAGS* make variable into CFLAGS
Jiri Olsa [Thu, 21 Mar 2013 10:30:54 +0000 (11:30 +0100)]
perf tools: Merge all *CFLAGS* make variable into CFLAGS

Merging all *CFLAGS* make variable into CFLAGS to eliminate all special
*_CFLAGS_* variables and make the setup clear.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-19-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>