linux/drivers/staging
Konstantin Khlebnikov b9ea25152e page_writeback: clean up mess around cancel_dirty_page()
This patch replaces cancel_dirty_page() with a helper function
account_page_cleaned() which only updates counters.  It's called from
truncate_complete_page() and from try_to_free_buffers() (hack for ext3).
Page is locked in both cases, page-lock protects against concurrent
dirtiers: see commit 2d6d7f9828 ("mm: protect set_page_dirty() from
ongoing truncation").

Delete_from_page_cache() shouldn't be called for dirty pages, they must
be handled by caller (either written or truncated).  This patch treats
final dirty accounting fixup at the end of __delete_from_page_cache() as
a debug check and adds WARN_ON_ONCE() around it.  If something removes
dirty pages without proper handling that might be a bug and unwritten
data might be lost.

Hugetlbfs has no dirty pages accounting, ClearPageDirty() is enough
here.

cancel_dirty_page() in nfs_wb_page_cancel() is redundant.  This is
helper for nfs_invalidate_page() and it's called only in case complete
invalidation.

The mess was started in v2.6.20 after commits 46d2277c79 ("Clean up
and make try_to_free_buffers() not race with dirty pages") and
3e67c0987d ("truncate: clear page dirtiness before running
try_to_free_buffers()") first was reverted right in v2.6.20 in commit
ecdfc9787f ("Resurrect 'try_to_free_buffers()' VM hackery"), second in
v2.6.25 commit a2b345642f ("Fix dirty page accounting leak with ext3
data=journal").

Custom fixes were introduced between these points.  NFS in v2.6.23, commit
1b3b4a1a2d ("NFS: Fix a write request leak in nfs_invalidate_page()").
Kludge in __delete_from_page_cache() in v2.6.24, commit 3a6927906f ("Do
dirty page accounting when removing a page from the page cache").  Since
v2.6.25 all of them are redundant.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-14 16:49:01 -07:00
..
android staging: android: ion_test: Add the MODULE_LICENSE macro 2015-04-03 15:13:52 +02:00
board
clocking-wizard
comedi staging: comedi: remove "comedi_fc.h" 2015-04-03 13:14:08 +02:00
dgap
dgnc
emxx_udc
fbtft
fsl-mc staging: fsl-mc: Changed version matching rules for MC object drivers 2015-04-03 13:55:03 +02:00
ft1000 staging: ft1000: Drop unneeded cast on netdev_priv 2015-04-03 14:00:14 +02:00
fwserial
gdm72xx
gdm724x
goldfish
gs_fpgaboot
i2o
iio Merge 4.0-rc7 into staging-next 2015-04-07 11:03:02 +02:00
lustre page_writeback: clean up mess around cancel_dirty_page() 2015-04-14 16:49:01 -07:00
media
mt29f_spinand
netlogic
nvec Staging driver patches for 4.1-rc1 2015-04-13 17:37:33 -07:00
octeon staging: octeon-ethernet: delete cvm_oct_set_carrier() 2015-04-03 13:57:28 +02:00
octeon-usb staging: octeon-usb: make CVMX_WAIT_FOR_FIELD32 to take condition expression 2015-04-03 13:57:28 +02:00
olpc_dcon staging/olpc: drop pci dependencies 2015-04-03 13:56:03 +02:00
ozwpan
panel
rtl8188eu
rtl8192e staging: rtl8192e: Remove dead code 2015-04-03 15:29:31 +02:00
rtl8192u Staging: rtl8192u: use correct array for debug output 2015-04-03 15:40:49 +02:00
rtl8712 staging: rtl8712: Drop unneeded cast on netdev_priv 2015-04-03 15:15:40 +02:00
rtl8723au staging: rtl8723au: Remove unneeded comments 2015-04-03 15:25:47 +02:00
rts5208
skein
slicoss
sm7xxfb staging: sm7xxfb: disable pci device 2015-04-03 13:55:03 +02:00
sm750fb Revert "Staging: sm750fb: Fix C99 Comments" 2015-04-04 12:00:25 +02:00
speakup staging: speakup: Fix warning of line over 80 characters. 2015-04-03 13:43:45 +02:00
ste_rmi4
unisys staging: unisys: remove forward declaration 2015-04-03 13:43:45 +02:00
vme
vt6655 staging: vt6655: use ieee80211_tx_info to select packet type. 2015-04-03 15:12:54 +02:00
vt6656
wlan-ng
xgifb
Kconfig
Makefile
staging.c