]> git.notmuchmail.org Git - notmuch/blob - test/corpora/lkml/cur/1382298770.001733:2,
Import notmuch_0.27.orig.tar.gz
[notmuch] / test / corpora / lkml / cur / 1382298770.001733:2,
1 From: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
2 Subject: [RFC][PATCH 03/10] cifs: register CIFS for caching
3 Date: Tue, 22 Jun 2010 20:53:09 +0530
4 Lines: 174
5 Message-ID: <1277220189-3485-1-git-send-email-sjayaraman@suse.de>
6 References: <yes>
7 Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
8         linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
9 To: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
10 X-From: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Tue Jun 22 17:43:52 2010
11 Return-path: <linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
12 Envelope-to: glkc-linux-cifs-1dZseelyfdZg9hUCZPvPmw@public.gmane.org
13 Received: from vger.kernel.org ([209.132.180.67])
14         by lo.gmane.org with esmtp (Exim 4.69)
15         (envelope-from <linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>)
16         id 1OR5de-0007xC-Ov
17         for glkc-linux-cifs-1dZseelyfdZg9hUCZPvPmw@public.gmane.org; Tue, 22 Jun 2010 17:43:51 +0200
18 Received: (majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org) by vger.kernel.org via listexpand
19         id S1753125Ab0FVPnt (ORCPT <rfc822;glkc-linux-cifs@m.gmane.org>);
20         Tue, 22 Jun 2010 11:43:49 -0400
21 Received: from victor.provo.novell.com ([137.65.250.26]:55866 "EHLO
22         victor.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
23         with ESMTP id S1751261Ab0FVPnt (ORCPT
24         <rfc822;groupwise-SJayaraman-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org:0:0>);
25         Tue, 22 Jun 2010 11:43:49 -0400
26 Received: from localhost (prv-ext-foundry1int.gns.novell.com [137.65.251.240])
27         by victor.provo.novell.com with ESMTP; Tue, 22 Jun 2010 09:23:11 -0600
28 X-Mailer: git-send-email 1.6.4.2
29 In-Reply-To: <yes>
30 Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
31 Precedence: bulk
32 List-ID: <linux-cifs.vger.kernel.org>
33 X-Mailing-List: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
34 Archived-At: <http://permalink.gmane.org/gmane.linux.kernel/1001759>
35
36 Define CIFS for FS-Cache and register for caching. Upon registration the
37 top-level index object cookie will be stuck to the netfs definition by
38 FS-Cache.
39
40 Signed-off-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
41 ---
42  fs/cifs/Makefile  |    2 ++
43  fs/cifs/cache.c   |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
44  fs/cifs/cifsfs.c  |    8 ++++++++
45  fs/cifs/fscache.h |   40 ++++++++++++++++++++++++++++++++++++++++
46  4 files changed, 103 insertions(+), 0 deletions(-)
47  create mode 100644 fs/cifs/cache.c
48  create mode 100644 fs/cifs/fscache.h
49
50 diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile
51 index 9948c00..e2de709 100644
52 --- a/fs/cifs/Makefile
53 +++ b/fs/cifs/Makefile
54 @@ -11,3 +11,5 @@ cifs-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o \
55  cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o
56  
57  cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o
58 +
59 +cifs-$(CONFIG_CIFS_FSCACHE) += cache.o
60 diff --git a/fs/cifs/cache.c b/fs/cifs/cache.c
61 new file mode 100644
62 index 0000000..1080b96
63 --- /dev/null
64 +++ b/fs/cifs/cache.c
65 @@ -0,0 +1,53 @@
66 +/*
67 + *   fs/cifs/cache.c - CIFS filesystem cache index structure definitions
68 + *
69 + *   Copyright (c) 2010 Novell, Inc.
70 + *   Authors(s): Suresh Jayaraman (sjayaraman-l3A5Bk7waGM@public.gmane.org>
71 + *
72 + *   This library is free software; you can redistribute it and/or modify
73 + *   it under the terms of the GNU Lesser General Public License as published
74 + *   by the Free Software Foundation; either version 2.1 of the License, or
75 + *   (at your option) any later version.
76 + *
77 + *   This library is distributed in the hope that it will be useful,
78 + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
79 + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
80 + *   the GNU Lesser General Public License for more details.
81 + *
82 + *   You should have received a copy of the GNU Lesser General Public License
83 + *   along with this library; if not, write to the Free Software
84 + *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
85 + */
86 +#include <linux/init.h>
87 +#include <linux/kernel.h>
88 +#include <linux/sched.h>
89 +#include <linux/mm.h>
90 +
91 +#include "fscache.h"
92 +#include "cifsglob.h"
93 +#include "cifs_debug.h"
94 +
95 +/*
96 + * CIFS filesystem definition for FS-Cache
97 + */
98 +struct fscache_netfs cifs_fscache_netfs = {
99 +       .name = "cifs",
100 +       .version = 0,
101 +};
102 +
103 +/*
104 + * Register CIFS for caching with FS-Cache
105 + */
106 +int cifs_fscache_register(void)
107 +{
108 +       return fscache_register_netfs(&cifs_fscache_netfs);
109 +}
110 +
111 +/*
112 + * Unregister CIFS for caching
113 + */
114 +void cifs_fscache_unregister(void)
115 +{
116 +       fscache_unregister_netfs(&cifs_fscache_netfs);
117 +}
118 +
119 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
120 index 484e52b..c2a7aa9 100644
121 --- a/fs/cifs/cifsfs.c
122 +++ b/fs/cifs/cifsfs.c
123 @@ -47,6 +47,7 @@
124  #include <linux/key-type.h>
125  #include "dns_resolve.h"
126  #include "cifs_spnego.h"
127 +#include "fscache.h"
128  #define CIFS_MAGIC_NUMBER 0xFF534D42   /* the first four bytes of SMB PDUs */
129  
130  int cifsFYI = 0;
131 @@ -902,6 +903,10 @@ init_cifs(void)
132                 cFYI(1, "cifs_max_pending set to max of 256");
133         }
134  
135 +       rc = cifs_fscache_register();
136 +       if (rc)
137 +               goto out;
138 +
139         rc = cifs_init_inodecache();
140         if (rc)
141                 goto out_clean_proc;
142 @@ -949,8 +954,10 @@ init_cifs(void)
143         cifs_destroy_mids();
144   out_destroy_inodecache:
145         cifs_destroy_inodecache();
146 +       cifs_fscache_unregister();
147   out_clean_proc:
148         cifs_proc_clean();
149 + out:
150         return rc;
151  }
152  
153 @@ -959,6 +966,7 @@ exit_cifs(void)
154  {
155         cFYI(DBG2, "exit_cifs");
156         cifs_proc_clean();
157 +       cifs_fscache_unregister();
158  #ifdef CONFIG_CIFS_DFS_UPCALL
159         cifs_dfs_release_automount_timer();
160         unregister_key_type(&key_type_dns_resolver);
161 diff --git a/fs/cifs/fscache.h b/fs/cifs/fscache.h
162 new file mode 100644
163 index 0000000..cec9e2b
164 --- /dev/null
165 +++ b/fs/cifs/fscache.h
166 @@ -0,0 +1,40 @@
167 +/*
168 + *   fs/cifs/fscache.h - CIFS filesystem cache interface definitions
169 + *
170 + *   Copyright (c) 2010 Novell, Inc.
171 + *   Authors(s): Suresh Jayaraman (sjayaraman-l3A5Bk7waGM@public.gmane.org>
172 + *
173 + *   This library is free software; you can redistribute it and/or modify
174 + *   it under the terms of the GNU Lesser General Public License as published
175 + *   by the Free Software Foundation; either version 2.1 of the License, or
176 + *   (at your option) any later version.
177 + *
178 + *   This library is distributed in the hope that it will be useful,
179 + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
180 + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
181 + *   the GNU Lesser General Public License for more details.
182 + *
183 + *   You should have received a copy of the GNU Lesser General Public License
184 + *   along with this library; if not, write to the Free Software
185 + *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
186 + */
187 +#ifndef _CIFS_FSCACHE_H
188 +#define _CIFS_FSCACHE_H
189 +
190 +#include <linux/fscache.h>
191 +#include "cifsglob.h"
192 +
193 +#ifdef CONFIG_CIFS_FSCACHE
194 +
195 +extern struct fscache_netfs cifs_fscache_netfs;
196 +
197 +extern int cifs_fscache_register(void);
198 +extern void cifs_fscache_unregister(void);
199 +
200 +#else /* CONFIG_CIFS_FSCACHE */
201 +static inline int cifs_fscache_register(void) { return 0; }
202 +static inline void cifs_fscache_unregister(void) {}
203 +
204 +#endif /* CONFIG_CIFS_FSCACHE */
205 +
206 +#endif /* _CIFS_FSCACHE_H */
207 -- 
208 1.6.4.2
209
210
211