Fix overflow case on truncate path

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix dleaf2_sniff() return value

For right now, sniff has to return for

	1 - valid
	0 - invaid

However, dleaf2_sniff() returns wrong values.

Therefore, dleaf->count == 0 is possible if dleaf2 was merged into
another dleaf2.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Change return valid of ->leaf_sniff()

->leaf_sniff() return value is confusable. So, this changes it as

	0  - valid
	-1 - invalid

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix order of LOG_BNODE_FREE dirty cancel in replay

If log was following order,

	LOG_BNODE_FREE(block-A)
	LOG_BNODE_REDIRECT(old, block-A)

dirty state cancel of LOG_BNODE_FREE must be before LOG_BNODE_REDIRECT
replay.

But, current code is canceling dirty state in stage2. So, regardless
of LOG_BNODE_FREE order, LOG_BNODE_FREE cancels dirty state in
LOG_BNODE_REDIRECT of stage1

This moves the dirty cancel to stage1 to respect order of log
records. Also, LOG_BNODE_MERGE has to be fixed.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix tux3_file_splice_write() for kernel v3.10

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix tux3_invalidatepage() for kernel v3.11

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix tux_readdir() for kernel v3.11

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Add dir_relax() to tux_readdir() for kernel v3.11

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Update userland to convert readdir() to interate()

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix newpage_add_lru() for kernel v3.11

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Add optional handlers in kernel v3.11

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix flusher for kernel v3.11

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix truncate_pagecache() for kernel v3.12

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Update tux3_file_aio_write() for kernel v3.12

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Update __tux3_test_set_page_writeback() for kernel v3.12

Now, cgroup support I/O bandwidth.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Update libklib/err.h for PTR_RET()

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Update clone_page() for kernel kernel v3.13

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix __tux3_set_page_dirty() for kernel v3.14

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Drop codes for older than kernel v3.12

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fix tux3_truncate_inode_pages_range() overflow handling

At 3.11, truncate_inode_pages_range() was changed to support partial
page range. But it doesn't handle corner cases correctly.

loff_t is signed, so loff_t >> shift_bits is invalid operation.
So, we have to care loff_t doesn't overflow signed.

This assumes loff_t >> PAGE_CACHE_SHIFT doesn't overflow pgoff_t (this
is true if loff_t < MAX_LFS_FILESIZE).

With this assumption, this fix overflow cases by just casting to (u64).

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>