linux/drivers/block
Joonsoo Kim f4659d8e62 zram: support REQ_DISCARD
zram is ram based block device and can be used by backend of filesystem.
When filesystem deletes a file, it normally doesn't do anything on data
block of that file.  It just marks on metadata of that file.  This
behavior has no problem on disk based block device, but has problems on
ram based block device, since we can't free memory used for data block.
To overcome this disadvantage, there is REQ_DISCARD functionality.  If
block device support REQ_DISCARD and filesystem is mounted with discard
option, filesystem sends REQ_DISCARD to block device whenever some data
blocks are discarded.  All we have to do is to handle this request.

This patch implements to flag up QUEUE_FLAG_DISCARD and handle this
REQ_DISCARD request.  With it, we can free memory used by zram if it isn't
used.

[akpm@linux-foundation.org: tweak comments]
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-04-07 16:36:02 -07:00
..
aoe mm: close PageTail race 2014-03-04 07:55:47 -08:00
drbd drbd: Fix future possible NULL pointer dereference 2014-02-21 15:42:34 -08:00
mtip32xx Merge branch 'for-3.15/drivers' of git://git.kernel.dk/linux-block 2014-04-01 19:43:53 -07:00
paride drivers/block/paride/pg.c: underflow bug in pg_write() 2014-01-21 20:16:56 -08:00
rsxx block: Convert bio_for_each_segment() to bvec_iter 2013-11-23 22:33:49 -08:00
xen-blkback xen-blkback: init persistent_purge_work work_struct 2014-02-11 20:34:03 -07:00
zram zram: support REQ_DISCARD 2014-04-07 16:36:02 -07:00
amiflop.c tree-wide: use reinit_completion instead of INIT_COMPLETION 2013-11-15 09:32:21 +09:00
ataflop.c ataflop: fix sleep_on races 2014-03-13 14:56:38 -06:00
brd.c block: Convert bio_for_each_segment() to bvec_iter 2013-11-23 22:33:49 -08:00
cciss_cmd.h
cciss_scsi.c cciss: switch to ->show_info() 2013-04-09 14:13:19 -04:00
cciss_scsi.h
cciss.c cciss: Fallback to MSI rather than to INTx if MSI-X failed 2014-03-13 14:56:39 -06:00
cciss.h
cpqarray.c cpqarray: fix info leak in ida_locked_ioctl() 2013-09-24 17:00:26 -07:00
cpqarray.h
cryptoloop.c move linux/loop.h to drivers/block 2013-06-29 12:46:45 +04:00
DAC960.c DAC960: remove sleep_on usage 2014-03-13 14:56:38 -06:00
DAC960.h
floppy.c floppy: don't use PREPARE_[DELAYED_]WORK 2014-03-07 10:24:48 -05:00
hd.c
ida_cmd.h
ida_ioctl.h
Kconfig zram: promote zram from staging 2014-01-30 16:56:55 -08:00
loop.c drivers/block/loop.c: fix comment typo in loop_config_discard 2014-01-21 20:16:56 -08:00
loop.h move linux/loop.h to drivers/block 2013-06-29 12:46:45 +04:00
Makefile zram: promote zram from staging 2014-01-30 16:56:55 -08:00
mg_disk.c mg_disk: Spelling s/finised/finished/ 2014-01-21 20:34:58 -08:00
nbd.c block: Immutable bio vecs 2013-11-23 22:33:49 -08:00
null_blk.c null_blk: use blk_complete_request and blk_mq_complete_request 2014-02-10 09:27:31 -07:00
nvme-core.c Merge branch 'for-3.15/drivers' of git://git.kernel.dk/linux-block 2014-04-01 19:43:53 -07:00
nvme-scsi.c NVMe: compat SG_IO ioctl 2013-12-16 15:49:40 -05:00
osdblk.c block: replace strict_strtoul() with kstrtoul() 2013-09-11 15:56:56 -07:00
pktcdvd.c pktcdvd: fix error return code 2014-01-03 10:05:34 +01:00
ps3disk.c block: Kill bio_segments()/bi_vcnt usage 2013-11-23 22:33:51 -08:00
ps3vram.c block: Convert bio_for_each_segment() to bvec_iter 2013-11-23 22:33:49 -08:00
rbd_types.h rbd: get rid of RBD_MAX_SEG_NAME_LEN 2012-12-17 08:37:29 -06:00
rbd.c rbd: drop an unsafe assertion 2014-03-29 10:38:14 -07:00
skd_main.c skd: Use pci_enable_msix_range() instead of pci_enable_msix() 2014-02-21 15:45:26 -08:00
skd_s1120.h skd: fix formatting in skd_s1120.h 2013-11-08 09:10:30 -07:00
smart1,2.h
sunvdc.c sunvdc: Fix off-by-one in generic_request(). 2013-02-14 11:49:01 -08:00
swim_asm.S
swim.c drivers/block/swim.c: remove unnecessary platform_set_drvdata() 2013-09-11 15:56:59 -07:00
swim3.c swim3: fix interruptible_sleep_on race 2014-03-13 14:56:38 -06:00
sx8.c drivers/block/sx8.c: remove unnecessary pci_set_drvdata() 2014-01-21 20:16:56 -08:00
umem.c block: Convert drivers to immutable biovecs 2013-11-23 22:33:51 -08:00
umem.h
virtio_blk.c Nothing exciting: virtio-blk users might see a bit of a boost from the 2014-04-02 14:43:17 -07:00
xen-blkfront.c Merge branch 'stable/for-jens-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip into for-linus 2014-02-10 12:52:34 -07:00
xsysace.c xilinx systemace: Fix sparse warnings 2013-07-10 07:47:12 +02:00
z2ram.c block/z2ram: Remove duplicate external declarations 2013-11-26 11:09:10 +01:00