1
0
Fork 0
Commit Graph

14 Commits (09cbfeaf1a5a67bfb3201e0c83c810cecb2efa5a)

Author SHA1 Message Date
Kirill A. Shutemov 09cbfeaf1a mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
ago with promise that one day it will be possible to implement page
cache with bigger chunks than PAGE_SIZE.

This promise never materialized.  And unlikely will.

We have many places where PAGE_CACHE_SIZE assumed to be equal to
PAGE_SIZE.  And it's constant source of confusion on whether
PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
especially on the border between fs and mm.

Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
breakage to be doable.

Let's stop pretending that pages in page cache are special.  They are
not.

The changes are pretty straight-forward:

 - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;

 - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;

 - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

 - page_cache_get() -> get_page();

 - page_cache_release() -> put_page();

This patch contains automated changes generated with coccinelle using
script below.  For some reason, coccinelle doesn't patch header files.
I've called spatch for them manually.

The only adjustment after coccinelle is revert of changes to
PAGE_CAHCE_ALIGN definition: we are going to drop it later.

There are few places in the code where coccinelle didn't reach.  I'll
fix them manually in a separate patch.  Comments and documentation also
will be addressed with the separate patch.

virtual patch

@@
expression E;
@@
- E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E

@@
expression E;
@@
- E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E

@@
@@
- PAGE_CACHE_SHIFT
+ PAGE_SHIFT

@@
@@
- PAGE_CACHE_SIZE
+ PAGE_SIZE

@@
@@
- PAGE_CACHE_MASK
+ PAGE_MASK

@@
expression E;
@@
- PAGE_CACHE_ALIGN(E)
+ PAGE_ALIGN(E)

@@
expression E;
@@
- page_cache_get(E)
+ get_page(E)

@@
expression E;
@@
- page_cache_release(E)
+ put_page(E)

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-04-04 10:41:08 -07:00
Oleg Drokin e15ba45d92 staging/lustre/llite: Fix style vs open parenthesis alignment
This mostly fixes checkpatch complaints about
"Alignment should match open parenthesis"

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-01 19:17:41 -08:00
Oleg Drokin c0894c6cfe staging/lustre/llite: Adjust comments to better conform to coding style
This patch fixes "Block comments use a trailing */ on a separate line"
warnings from checkpatch.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:08:59 -08:00
Oleg Drokin 6e16818b24 staging/lustre/llite: Adjust NULL comparison codestyle
All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

The only exception is ll_update_inode where dropping != NULL
in the construction below would break the logic.
I guess we could change lsm != NULL to !!lsm, but that's uglier.
(lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0)

Also removed some redundant assertions.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:33:11 -08:00
Al Viro 5955102c99 wrappers for ->i_mutex access
parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
inode_foo(inode) being mutex_foo(&inode->i_mutex).

Please, use those for access to ->i_mutex; over the coming cycle
->i_mutex will become rwsem, with ->lookup() done with it held
only shared.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2016-01-22 18:04:28 -05:00
Andreas Dilger 1dc563a682 staging: lustre: update Intel copyright messages 2015
Update copyright messages in files modified by Intel employees
in 2015 by non-trivial patches.  Exclude patches that are only
deleting code, renaming functions, or adding or removing whitespace.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7243
Reviewed-on: http://review.whamcloud.com/16758
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-21 15:38:00 -08:00
Mike Rapoport 106495c41f staging: lustre: remove multiple blank lines
Fixes checkpatch.pl CHECK:LINE_SPACING: Please don't use multiple blank
lines.

The patch is generated using checkpatch.pl --fix-inplace:

for f in $(find drivers/staging/lustre/ -type f) ; do
    ./scripts/checkpatch.pl --types "LINE_SPACING" --test-only=multiple \
    --fix-inplace  -f $f
done

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-13 10:21:10 -07:00
Oleg Drokin 176d1b9643 staging/lustre/llite: Don't set page writeback on non-dirty page
New writeback changes in 4.2-RC1 have exposed that we incorrectly
set page_writeback on a page that is being written synchronously,
which aside from this new crash (dereference of NULL inode->i_wb
from set_page_writeback) likely threw off some related page
statistics in the past.

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000138
 IP: [<ffffffff8140d90a>] __percpu_counter_add+0x1a/0x80
 PGD 0
 Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
 Modules linked in: osc(C) lmv(C) fld(C) mgc(C) lustre(C) mdc(C) fid(C) lov(C) ksocklnd(C) ptlrpc(C) obdclass(C) lnet(C) libcfs(C) loop sha512_generic crc32 rpcsec_gss_krb5 microcode joydev i2c_piix4 acpi_cpufreq pcspkr nfsd syscopyarea sysfillrect sysimgblt drm_kms_helper ttm drm serio_raw virtio_blk [last unloaded: libcfs]
 CPU: 0 PID: 13328 Comm: cvs Tainted: G         C      4.2.0-rc1-vm-nfs+ #30
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 task: ffff8800cc98a400 ti: ffff8801157e8000 task.ti: ffff8801157e8000
 RIP: 0010:[<ffffffff8140d90a>]  [<ffffffff8140d90a>] __percpu_counter_add+0x1a/0x80
 RSP: 0018:ffff8801157eb698  EFLAGS: 00010086
 RAX: 0000000000000003 RBX: ffffea0002b91cc0 RCX: 000000000000001a
 RDX: 0000000000000020 RSI: 0000000000000001 RDI: 00000000000000e8
 RBP: ffff8801157eb6b8 R08: 0000000000000001 R09: 0000000000000000
 R10: 0000000000000000 R11: 0000000000000000 R12: 00000000000000e8
 R13: 0000000000000001 R14: ffff8800673587a8 R15: ffff8800673589b0
 FS:  00007f6718b89800(0000) GS:ffff88011f400000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000138 CR3: 000000009d51c000 CR4: 00000000000007f0
 Stack:
  ffffffff811919e2 ffffea0002b91cc0 ffff880067358998 ffff880119419800
  ffff8801157eb718 ffffffff81191a58 ffff8801157eb788 0000000000000282
  ffff8800ce5ce920 0000000000000000 ffff8800a525af80 ffff880053f68f10
 Call Trace:
  [<ffffffff811919e2>] ? __test_set_page_writeback+0x72/0x240
  [<ffffffff81191a58>] __test_set_page_writeback+0xe8/0x240
  [<ffffffffa04e7a13>] vvp_page_prep_write+0x33/0xb0 [lustre]
  [<ffffffffa028ad87>] cl_page_invoke+0x57/0x90 [obdclass]
  [<ffffffffa028cc8d>] cl_page_prep+0x2d/0x180 [obdclass]
  [<ffffffffa0545d84>] osc_io_submit+0x134/0x4a0 [osc]
  [<ffffffffa02933a3>] cl_io_submit_rw+0x53/0xb0 [obdclass]
  [<ffffffffa0483635>] lov_io_submit+0x3a5/0x570 [lov]
  [<ffffffff810cb7bb>] ? lockdep_init_map+0x5b/0x6d0
  [<ffffffffa02933a3>] cl_io_submit_rw+0x53/0xb0 [obdclass]
  [<ffffffffa029428d>] cl_io_submit_sync+0xed/0x1c0 [obdclass]
  [<ffffffffa04e881d>] vvp_page_sync_io.isra.15+0x4d/0x100 [lustre]
  [<ffffffffa028dd2f>] ? cl_page_clip+0xff/0x130 [obdclass]
  [<ffffffffa04e9f38>] vvp_io_commit_write+0x448/0x500 [lustre]
  [<ffffffffa02939fa>] cl_io_commit_write+0x9a/0x130 [obdclass]
  [<ffffffffa04cb222>] ll_commit_write+0xc2/0x230 [lustre]
  [<ffffffffa04dbdaa>] ll_write_end+0x2a/0x50 [lustre]
  [<ffffffff811851ba>] generic_perform_write+0xfa/0x1b0
  [<ffffffff8121fd2e>] ? dentry_needs_remove_privs.part.16+0x1e/0x30
  [<ffffffff811877d0>] __generic_file_write_iter+0x190/0x1f0
  [<ffffffff8118791a>] generic_file_write_iter+0xea/0x1e0
  [<ffffffffa04e8dd0>] vvp_io_write_start+0xa0/0x1e0 [lustre]
  [<ffffffffa0292469>] cl_io_start+0x49/0x80 [obdclass]
  [<ffffffffa0294803>] cl_io_loop+0x73/0xd0 [obdclass]
  [<ffffffffa04b4ebf>] ll_file_io_generic+0x45f/0x4b0 [lustre]
  [<ffffffffa04b504c>] ll_file_write_iter+0x6c/0xc0 [lustre]
  [<ffffffff8120330a>] __vfs_write+0xaa/0xe0
  [<ffffffff81203969>] vfs_write+0xa9/0x190
  [<ffffffff812046c9>] SyS_write+0x49/0xa0
  [<ffffffff81796572>] entry_SYSCALL_64_fastpath+0x16/0x7a
 Code: 5b 41 5c 41 5d 41 5e 5d c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 55 41 54 53 49 89 fc 49 89 f5 48 83 ec 08 65 ff 05 8e d1 bf 7e <48> 8b 47 50 48 63 ca 65 8b 18 48 63 db 48 01 f3 48 39 cb 7d 0a

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/15610
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6854
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-31 16:03:50 -07:00
Joe Perches 2d00bd17a2 staging: lustre: Coalesce string fragments
Join the string fragments to make it easier to grep.

Ignored all the 80+ column lines.
Added many missing spaces when coalescing formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-23 13:17:57 -08:00
Greg Kroah-Hartman 67a235f5e5 staging: lustre: llite: remove ccflags from Makefile
Fix up the relative paths in the .c files to properly build with the
Makefile change.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: hpdd-discuss <hpdd-discuss@lists.01.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 21:57:19 -07:00
Greg Kroah-Hartman 0a3bdb0071 staging: lustre: remove RETURN macro
We have a kernel-wide function tracing system, so use that instead of
rolling a custom one just for one filesystem.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-03 10:35:28 +08:00
Greg Kroah-Hartman 23f14e79ac staging: lustre: remove EXIT macro
We have a kernel-wide function tracing system, so use that instead of
rolling a custom one just for one filesystem.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-03 06:01:58 +08:00
Greg Kroah-Hartman 29aaf4962a staging: lustre: remove ENTRY macro
We have a kernel-wide function tracing system, so use that instead of
rolling a custom one just for one filesystem.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-02 18:14:51 +08:00
Peng Tao d7e09d0397 staging: add Lustre file system client support
Lustre is the most deployed distributed file system
in the HPC (High Performance Computing) world. The patch
adds its client side support.

The code is not very clean and needs to live in drivers/staging
for some time for continuing cleanup work. See
drivers/staging/lustre/TODO for details.

The code is based on Lustre master commit faefbfc04

commit faefbfc0460bc00f2ee4c1c1c86aa1e39b9eea49
Author: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Date:   Tue Apr 30 23:05:21 2013 +0400

    LU-3244 utils: tunefs.lustre should preserve virgin label

Plus a few under-review patches on Whamcloud gerrit:
3.8 kernel support:
http://review.whamcloud.com/#change,5973
http://review.whamcloud.com/#change,5974
http://review.whamcloud.com/#change,5768
http://review.whamcloud.com/#change,5781
http://review.whamcloud.com/#change,5763
http://review.whamcloud.com/#change,5613
http://review.whamcloud.com/#change,5655

3.9 kernel support:
http://review.whamcloud.com/#change,5898
http://review.whamcloud.com/#change,5899

Kconfig/Kbuild:
http://review.whamcloud.com/#change,4646
http://review.whamcloud.com/#change,4644

libcfs cleanup:
http://review.whamcloud.com/#change,2831
http://review.whamcloud.com/#change,4775
http://review.whamcloud.com/#change,4776
http://review.whamcloud.com/#change,4777
http://review.whamcloud.com/#change,4778
http://review.whamcloud.com/#change,4779
http://review.whamcloud.com/#change,4780

All starting/trailing whitespaces are removed, to match kernel
coding style. Also ran scripts/cleanfile on all lustre source files.

[maked the Kconfig depend on BROKEN as the recent procfs changes causes
this to fail - gregkh]

Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-14 13:54:50 -04:00