Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

aio: Kill ki_dtor

sock_aio_dtor() is dead code - and stuff that does need to do cleanup
can simply do it before calling aio_complete().

Signed-off-by: Kent Overstreet <koverstreet@google.com>
Cc: Zach Brown <zab@redhat.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Selvan Mani <smani@micron.com>
Cc: Sam Bradshaw <sbradshaw@micron.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>

authored by

Kent Overstreet and committed by
Benjamin LaHaise
d29c445b 57282d8f

+2 -14
-2
fs/aio.c
··· 705 705 fput(req->ki_filp); 706 706 if (req->ki_eventfd != NULL) 707 707 eventfd_ctx_put(req->ki_eventfd); 708 - if (req->ki_dtor) 709 - req->ki_dtor(req); 710 708 kmem_cache_free(kiocb_cachep, req); 711 709 } 712 710
-1
include/linux/aio.h
··· 33 33 struct file *ki_filp; 34 34 struct kioctx *ki_ctx; /* NULL for sync ops */ 35 35 kiocb_cancel_fn *ki_cancel; 36 - void (*ki_dtor)(struct kiocb *); 37 36 void *private; 38 37 39 38 union {
+2 -11
net/socket.c
··· 854 854 } 855 855 EXPORT_SYMBOL(kernel_recvmsg); 856 856 857 - static void sock_aio_dtor(struct kiocb *iocb) 858 - { 859 - kfree(iocb->private); 860 - } 861 - 862 857 static ssize_t sock_sendpage(struct file *file, struct page *page, 863 858 int offset, size_t size, loff_t *ppos, int more) 864 859 { ··· 884 889 static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb, 885 890 struct sock_iocb *siocb) 886 891 { 887 - if (!is_sync_kiocb(iocb)) { 888 - siocb = kmalloc(sizeof(*siocb), GFP_KERNEL); 889 - if (!siocb) 890 - return NULL; 891 - iocb->ki_dtor = sock_aio_dtor; 892 - } 892 + if (!is_sync_kiocb(iocb)) 893 + BUG(); 893 894 894 895 siocb->kiocb = iocb; 895 896 iocb->private = siocb;