From patchwork Wed Jun 12 04:22:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 17805 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5857E25DFB for ; Wed, 12 Jun 2013 04:23:19 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id hu16sf168376qab.8 for ; Tue, 11 Jun 2013 21:23:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=OAkBExbxIH2SoAArosPxaf5tdj+jon+CowNEvxiBbBg=; b=hLIivQVsCBTRbpvyChSINgFs15zBzyEWRm5XGMeSZC7h8Id3x01QFjgelZFzC/VvXJ Kwi1x/98f56G40D7556rYtJ4aYWLywx/DQWF74GIuaMXxMsa3RouSiunPxVGXQDcSFWo 8ZFAN3BnsmJjS82LMRzVygNc2rBX39ucv8gAfCyVJ8yJob+d010y5U3aPZr6KLzJbuPu szQB6mSCC7fGic05pMlp4RHzPuQLmoEA/8sAGEBFU1w00HPicY2fCDyXQ/9DixEZDs+F txyLTo7EVtBqUxR3OpkixQ6pcueH43Ke7a5MnZKkCiHm0aur0gnyvutCqtHh6Q4lwCAZ P9sQ== X-Received: by 10.224.42.141 with SMTP id s13mr12438153qae.3.1371010999045; Tue, 11 Jun 2013 21:23:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.129.69 with SMTP id nu5ls1226961qeb.88.gmail; Tue, 11 Jun 2013 21:23:18 -0700 (PDT) X-Received: by 10.220.161.2 with SMTP id p2mr9105462vcx.72.1371010998880; Tue, 11 Jun 2013 21:23:18 -0700 (PDT) Received: from mail-vb0-x22e.google.com (mail-vb0-x22e.google.com [2607:f8b0:400c:c02::22e]) by mx.google.com with ESMTPS id to9si8019305vdc.123.2013.06.11.21.23.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 21:23:18 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22e; Received: by mail-vb0-f46.google.com with SMTP id 10so5712057vbe.5 for ; Tue, 11 Jun 2013 21:23:18 -0700 (PDT) X-Received: by 10.52.53.36 with SMTP id y4mr7560959vdo.51.1371010998696; Tue, 11 Jun 2013 21:23:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.191.99 with SMTP id gx3csp130068vec; Tue, 11 Jun 2013 21:23:18 -0700 (PDT) X-Received: by 10.66.138.77 with SMTP id qo13mr13078308pab.172.1371010997692; Tue, 11 Jun 2013 21:23:17 -0700 (PDT) Received: from mail-pb0-x230.google.com (mail-pb0-x230.google.com [2607:f8b0:400e:c01::230]) by mx.google.com with ESMTPS id wu4si8504389pbc.138.2013.06.11.21.23.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 21:23:17 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c01::230 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=2607:f8b0:400e:c01::230; Received: by mail-pb0-f48.google.com with SMTP id ma3so3798866pbc.35 for ; Tue, 11 Jun 2013 21:23:17 -0700 (PDT) X-Received: by 10.69.0.38 with SMTP id av6mr18546993pbd.4.1371010997134; Tue, 11 Jun 2013 21:23:17 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id xe9sm17439221pbc.21.2013.06.11.21.23.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 21:23:16 -0700 (PDT) From: John Stultz To: LKML Cc: John Stultz , Andrew Morton , Android Kernel Team , Robert Love , Mel Gorman , Hugh Dickins , Dave Hansen , Rik van Riel , Dmitry Adamushko , Dave Chinner , Neil Brown , Andrea Righi , Andrea Arcangeli , "Aneesh Kumar K.V" , Mike Hommey , Taras Glek , Dhaval Giani , Jan Kara , KOSAKI Motohiro , Michel Lespinasse , Minchan Kim , "linux-mm@kvack.org" Subject: [PATCH 2/8] vrange: Add vrange support for file address_spaces Date: Tue, 11 Jun 2013 21:22:45 -0700 Message-Id: <1371010971-15647-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1371010971-15647-1-git-send-email-john.stultz@linaro.org> References: <1371010971-15647-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQnDE/QyxnCLCH2K90AXuVZb4PtS7sSvKmKcZzpCgSlXrhCsMrq83e0QM4vbuJAU+CgB51jA X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Modify address_space structures to be able to store vrange trees. This includes logic to clear all volatile ranges when the last file handle is closed. Cc: Andrew Morton Cc: Android Kernel Team Cc: Robert Love Cc: Mel Gorman Cc: Hugh Dickins Cc: Dave Hansen Cc: Rik van Riel Cc: Dmitry Adamushko Cc: Dave Chinner Cc: Neil Brown Cc: Andrea Righi Cc: Andrea Arcangeli Cc: Aneesh Kumar K.V Cc: Mike Hommey Cc: Taras Glek Cc: Dhaval Giani Cc: Jan Kara Cc: KOSAKI Motohiro Cc: Michel Lespinasse Cc: Minchan Kim Cc: linux-mm@kvack.org Signed-off-by: John Stultz Signed-off-by: Minchan Kim [jstultz: Major refactoring of the code] Signed-off-by: John Stultz --- fs/file_table.c | 5 +++++ fs/inode.c | 2 ++ include/linux/fs.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/fs/file_table.c b/fs/file_table.c index cd4d87a..94e2cd3 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -244,6 +245,10 @@ static void __fput(struct file *file) file->f_op->fasync(-1, file, 0); } ima_file_free(file); + + /* drop all vranges on last close */ + vrange_root_cleanup(&inode->i_mapping->vroot); + if (file->f_op && file->f_op->release) file->f_op->release(inode, file); security_file_free(file); diff --git a/fs/inode.c b/fs/inode.c index 00d5fc3..bf32780 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -17,6 +17,7 @@ #include #include /* for inode_has_buffers */ #include +#include #include "internal.h" /* @@ -350,6 +351,7 @@ void address_space_init_once(struct address_space *mapping) spin_lock_init(&mapping->private_lock); mapping->i_mmap = RB_ROOT; INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); + vrange_root_init(&mapping->vroot, VRANGE_FILE); } EXPORT_SYMBOL(address_space_init_once); diff --git a/include/linux/fs.h b/include/linux/fs.h index 43db02e..1cbed73 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -411,6 +412,7 @@ struct address_space { struct rb_root i_mmap; /* tree of private and shared mappings */ struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ struct mutex i_mmap_mutex; /* protect tree, count, list */ + struct vrange_root vroot; /* Protected by tree_lock together with the radix tree */ unsigned long nrpages; /* number of total pages */ pgoff_t writeback_index;/* writeback starts here */