From patchwork Tue Jun 11 02:11:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 17761 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9A76E25DFB for ; Tue, 11 Jun 2013 02:11:41 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id ha12sf2293337vcb.0 for ; Mon, 10 Jun 2013 19:11:41 -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=0ME0TlPiK5Xn713YmT0+VFKS2XEZJ8JPmCu+OB8f6E8=; b=LeRpVu6F5X33M9EuW8fXlod6wMG8aMx2RP7pJt2UiCLXDdKOswLQtvWS3qfQ9ISs/J 3xRzJIxgDnuQ5Riom05uDSt3pgWDL/PS0ApNl7QYXVWf5eWizRM9PukiJMCP0JZSw1FJ 7LKPclAgLuSkGLweASzpl8sq0atelsP7OEgYtett2IYqjzNLu3hLSpC/HEyztwDuImhN aLb7xEy6+iDFUZABlcnWml/sYaHXhon2pB+Cyv9UMiL+ZBWtVjVfdlgKdB+tmAkDY9B1 LGDrPe0I8oXoVRTd7a42Eb9ho1n389EjHJrcYI2QHkqCfxQbxq2JJAzK+h2XRxASM8rK 2JCA== X-Received: by 10.224.205.138 with SMTP id fq10mr9859733qab.1.1370916701304; Mon, 10 Jun 2013 19:11:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.39.3 with SMTP id l3ls742948qek.62.gmail; Mon, 10 Jun 2013 19:11:41 -0700 (PDT) X-Received: by 10.220.246.136 with SMTP id ly8mr7162639vcb.58.1370916701048; Mon, 10 Jun 2013 19:11:41 -0700 (PDT) Received: from mail-ve0-x234.google.com (mail-ve0-x234.google.com [2607:f8b0:400c:c01::234]) by mx.google.com with ESMTPS id e8si6220382vcy.18.2013.06.10.19.11.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 19:11:41 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::234 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:c01::234; Received: by mail-ve0-f180.google.com with SMTP id pa12so5295722veb.39 for ; Mon, 10 Jun 2013 19:11:41 -0700 (PDT) X-Received: by 10.52.53.36 with SMTP id y4mr5996216vdo.51.1370916700938; Mon, 10 Jun 2013 19:11:40 -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.221.10.206 with SMTP id pb14csp90901vcb; Mon, 10 Jun 2013 19:11:40 -0700 (PDT) X-Received: by 10.66.164.199 with SMTP id ys7mr16458006pab.104.1370916699432; Mon, 10 Jun 2013 19:11:39 -0700 (PDT) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by mx.google.com with ESMTPS id iw6si859331pac.101.2013.06.10.19.11.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 19:11:39 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.180 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.180; Received: by mail-pd0-f180.google.com with SMTP id 10so8042792pdi.39 for ; Mon, 10 Jun 2013 19:11:39 -0700 (PDT) X-Received: by 10.66.149.5 with SMTP id tw5mr16625343pab.87.1370916699048; Mon, 10 Jun 2013 19:11:39 -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 nt2sm12427175pbc.17.2013.06.10.19.11.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 19:11:38 -0700 (PDT) From: John Stultz To: minchan.kim@lge.com Cc: John Stultz , Minchan Kim Subject: [PATCH 02/13] vrange: Add vrange support for file address_spaces Date: Mon, 10 Jun 2013 19:11:21 -0700 Message-Id: <1370916692-9576-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1370916692-9576-1-git-send-email-john.stultz@linaro.org> References: <1370916692-9576-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQls2uCHW0yTysVO6ohWE+oR5UUuWMOkYYOMSQKw7jRfU9D8uIAhZL+SwEGYMcx/ojVr1mNE X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::234 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. 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 */