]> git.notmuchmail.org Git - notmuch/blob - test/corpora/lkml/cur/1382298587.001892:2,
test: add 'lkml' corpus
[notmuch] / test / corpora / lkml / cur / 1382298587.001892:2,
1 From: Jeff Layton <jlayton-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org>
2 Subject: Re: [RFC][PATCH 04/10] cifs: define server-level cache index
3  objects and register them with FS-Cache
4 Date: Tue, 22 Jun 2010 17:52:14 -0400
5 Lines: 204
6 Message-ID: <20100622175214.4c56234f@corrin.poochiereds.net>
7 References: <yes>
8         <1277220198-3522-1-git-send-email-sjayaraman@suse.de>
9 Mime-Version: 1.0
10 Content-Type: text/plain; charset=US-ASCII
11 Content-Transfer-Encoding: 7bit
12 Cc: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
13         linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
14         David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
15 To: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
16 X-From: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Tue Jun 22 23:50:23 2010
17 Return-path: <linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
18 Envelope-to: glkc-linux-cifs-1dZseelyfdZg9hUCZPvPmw@public.gmane.org
19 Received: from vger.kernel.org ([209.132.180.67])
20         by lo.gmane.org with esmtp (Exim 4.69)
21         (envelope-from <linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>)
22         id 1ORBMJ-0005WJ-Lj
23         for glkc-linux-cifs-1dZseelyfdZg9hUCZPvPmw@public.gmane.org; Tue, 22 Jun 2010 23:50:20 +0200
24 Received: (majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org) by vger.kernel.org via listexpand
25         id S1750777Ab0FVVuS (ORCPT <rfc822;glkc-linux-cifs@m.gmane.org>);
26         Tue, 22 Jun 2010 17:50:18 -0400
27 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:55670 "EHLO
28         cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
29         with ESMTP id S1750749Ab0FVVuR (ORCPT
30         <rfc822;linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>); Tue, 22 Jun 2010 17:50:17 -0400
31 X-Authority-Analysis: v=1.1 cv=8MuG1bpxLlSbaYWWtODGdBCK7StbFcRsMXhWm1NVx/I= c=1 sm=0 a=wpY4Lvx3kJcA:10 a=UBIxAjGgU1YA:10 a=kj9zAlcOel0A:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=VwQbUJbxAAAA:8 a=qYub2k57AAAA:8 a=uYIlwBZcjrF9BUCsR4kA:9 a=OO1ZLbZb6q4TPdC5pcAA:7 a=jFshslHAf8hJVDYUYRlYN4n-w5YA:4 a=CjuIK1q_8ugA:10 a=x8gzFH9gYPwA:10 a=0kPLrQdw3YYA:10 a=jBoGP612-tUA:10 a=t5DF_bUGhurCx8LQ:21 a=W6P_Gh1y2IibdbqZ:21 a=ld/erqUjW76FpBUqCqkKeA==:117
32 X-Cloudmark-Score: 0
33 X-Originating-IP: 71.70.153.3
34 Received: from [71.70.153.3] ([71.70.153.3:59154] helo=mail.poochiereds.net)
35         by cdptpa-oedge03.mail.rr.com (envelope-from <jlayton-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org>)
36         (ecelerity 2.2.2.39 r()) with ESMTP
37         id AC/10-00502-710312C4; Tue, 22 Jun 2010 21:50:16 +0000
38 Received: from corrin.poochiereds.net (unknown [65.88.2.5])
39         by mail.poochiereds.net (Postfix) with ESMTPSA id 03B11580F4;
40         Tue, 22 Jun 2010 17:50:14 -0400 (EDT)
41 In-Reply-To: <1277220198-3522-1-git-send-email-sjayaraman-l3A5Bk7waGM@public.gmane.org>
42 X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-redhat-linux-gnu)
43 Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
44 Precedence: bulk
45 List-ID: <linux-cifs.vger.kernel.org>
46 X-Mailing-List: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
47 Archived-At: <http://permalink.gmane.org/gmane.linux.kernel/1001918>
48
49 On Tue, 22 Jun 2010 20:53:18 +0530
50 Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org> wrote:
51
52 > Define server-level cache index objects (as managed by TCP_ServerInfo structs).
53 > Each server object is created in the CIFS top-level index object and is itself
54 > an index into which superblock-level objects are inserted.
55
56 > Currently, the server objects are keyed by hostname.
57
58 > Signed-off-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
59 > ---
60 >  fs/cifs/Makefile   |    2 +-
61 >  fs/cifs/cache.c    |   25 +++++++++++++++++++++++++
62 >  fs/cifs/cifsglob.h |    3 +++
63 >  fs/cifs/connect.c  |    4 ++++
64 >  fs/cifs/fscache.c  |   47 +++++++++++++++++++++++++++++++++++++++++++++++
65 >  fs/cifs/fscache.h  |   12 ++++++++++++
66 >  6 files changed, 92 insertions(+), 1 deletion(-)
67 >  create mode 100644 fs/cifs/fscache.c
68
69 > Index: cifs-2.6/fs/cifs/Makefile
70 > ===================================================================
71 > --- cifs-2.6.orig/fs/cifs/Makefile
72 > +++ cifs-2.6/fs/cifs/Makefile
73 > @@ -12,4 +12,4 @@ cifs-$(CONFIG_CIFS_UPCALL) += cifs_spneg
74 >  
75 >  cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o
76 >  
77 > -cifs-$(CONFIG_CIFS_FSCACHE) += cache.o
78 > +cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o
79 > Index: cifs-2.6/fs/cifs/cache.c
80 > ===================================================================
81 > --- cifs-2.6.orig/fs/cifs/cache.c
82 > +++ cifs-2.6/fs/cifs/cache.c
83 > @@ -51,3 +51,28 @@ void cifs_fscache_unregister(void)
84 >       fscache_unregister_netfs(&cifs_fscache_netfs);
85 >  }
86 >  
87 > +/*
88 > + * Server object currently keyed by hostname
89 > + */
90 > +static uint16_t cifs_server_get_key(const void *cookie_netfs_data,
91 > +                                void *buffer, uint16_t maxbuf)
92 > +{
93 > +     const struct TCP_Server_Info *server = cookie_netfs_data;
94 > +     uint16_t len = strnlen(server->hostname, sizeof(server->hostname));
95 > +
96
97 Would a tuple of address/family/port be a better choice here? Imagine I
98 mount "foo" and then later mount "foor.bar.baz". If they are the same
99 address and only the UNC differs, then you won't get the benefit of
100 the cache, right?
101
102 > +     if (len > maxbuf)
103 > +             return 0;
104 > +
105 > +     memcpy(buffer, server->hostname, len);
106 > +
107 > +     return len;
108 > +}
109 > +
110 > +/*
111 > + * Server object for FS-Cache
112 > + */
113 > +const struct fscache_cookie_def cifs_fscache_server_index_def = {
114 > +     .name = "CIFS.server",
115 > +     .type = FSCACHE_COOKIE_TYPE_INDEX,
116 > +     .get_key = cifs_server_get_key,
117 > +};
118 > Index: cifs-2.6/fs/cifs/cifsglob.h
119 > ===================================================================
120 > --- cifs-2.6.orig/fs/cifs/cifsglob.h
121 > +++ cifs-2.6/fs/cifs/cifsglob.h
122 > @@ -193,6 +193,9 @@ struct TCP_Server_Info {
123 >       bool    sec_mskerberos;         /* supports legacy MS Kerberos */
124 >       bool    sec_kerberosu2u;        /* supports U2U Kerberos */
125 >       bool    sec_ntlmssp;            /* supports NTLMSSP */
126 > +#ifdef CONFIG_CIFS_FSCACHE
127 > +     struct fscache_cookie   *fscache; /* client index cache cookie */
128 > +#endif
129 >  };
130 >  
131 >  /*
132 > Index: cifs-2.6/fs/cifs/connect.c
133 > ===================================================================
134 > --- cifs-2.6.orig/fs/cifs/connect.c
135 > +++ cifs-2.6/fs/cifs/connect.c
136 > @@ -48,6 +48,7 @@
137 >  #include "nterr.h"
138 >  #include "rfc1002pdu.h"
139 >  #include "cn_cifs.h"
140 > +#include "fscache.h"
141 >  
142 >  #define CIFS_PORT 445
143 >  #define RFC1001_PORT 139
144 > @@ -1453,6 +1454,8 @@ cifs_put_tcp_session(struct TCP_Server_I
145 >               return;
146 >       }
147 >  
148 > +     cifs_fscache_release_client_cookie(server);
149 > +
150 >       list_del_init(&server->tcp_ses_list);
151 >       write_unlock(&cifs_tcp_ses_lock);
152 >  
153 > @@ -1572,6 +1575,7 @@ cifs_get_tcp_session(struct smb_vol *vol
154 >               goto out_err;
155 >       }
156 >  
157 > +     cifs_fscache_get_client_cookie(tcp_ses);
158 >       /* thread spawned, put it on the list */
159 >       write_lock(&cifs_tcp_ses_lock);
160 >       list_add(&tcp_ses->tcp_ses_list, &cifs_tcp_ses_list);
161 > Index: cifs-2.6/fs/cifs/fscache.c
162 > ===================================================================
163 > --- /dev/null
164 > +++ cifs-2.6/fs/cifs/fscache.c
165 > @@ -0,0 +1,47 @@
166 > +/*
167 > + *   fs/cifs/fscache.c - CIFS filesystem cache interface
168 > + *
169 > + *   Copyright (c) 2010 Novell, Inc.
170 > + *   Authors(s): Suresh Jayaraman (sjayaraman-l3A5Bk7waGM@public.gmane.org>
171 > + *
172 > + *   This library is free software; you can redistribute it and/or modify
173 > + *   it under the terms of the GNU Lesser General Public License as published
174 > + *   by the Free Software Foundation; either version 2.1 of the License, or
175 > + *   (at your option) any later version.
176 > + *
177 > + *   This library is distributed in the hope that it will be useful,
178 > + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
179 > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
180 > + *   the GNU Lesser General Public License for more details.
181 > + *
182 > + *   You should have received a copy of the GNU Lesser General Public License
183 > + *   along with this library; if not, write to the Free Software
184 > + *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
185 > + */
186 > +#include <linux/init.h>
187 > +#include <linux/kernel.h>
188 > +#include <linux/sched.h>
189 > +#include <linux/mm.h>
190 > +#include <linux/in6.h>
191 > +
192 > +#include "fscache.h"
193 > +#include "cifsglob.h"
194 > +#include "cifs_debug.h"
195 > +
196 > +void cifs_fscache_get_client_cookie(struct TCP_Server_Info *server)
197 > +{
198 > +     server->fscache =
199 > +             fscache_acquire_cookie(cifs_fscache_netfs.primary_index,
200 > +                             &cifs_fscache_server_index_def, server);
201 > +     cFYI(1, "CIFS: get client cookie (0x%p/0x%p)\n",
202 > +                             server, server->fscache);
203 > +}
204 > +
205 > +void cifs_fscache_release_client_cookie(struct TCP_Server_Info *server)
206 > +{
207 > +     cFYI(1, "CIFS: release client cookie (0x%p/0x%p)\n",
208 > +                             server, server->fscache);
209 > +     fscache_relinquish_cookie(server->fscache, 0);
210 > +     server->fscache = NULL;
211 > +}
212 > +
213 > Index: cifs-2.6/fs/cifs/fscache.h
214 > ===================================================================
215 > --- cifs-2.6.orig/fs/cifs/fscache.h
216 > +++ cifs-2.6/fs/cifs/fscache.h
217 > @@ -27,14 +27,26 @@
218 >  #ifdef CONFIG_CIFS_FSCACHE
219 >  
220 >  extern struct fscache_netfs cifs_fscache_netfs;
221 > +extern const struct fscache_cookie_def cifs_fscache_server_index_def;
222 >  
223 >  extern int cifs_fscache_register(void);
224 >  extern void cifs_fscache_unregister(void);
225 >  
226 > +/*
227 > + * fscache.c
228 > + */
229 > +extern void cifs_fscache_get_client_cookie(struct TCP_Server_Info *);
230 > +extern void cifs_fscache_release_client_cookie(struct TCP_Server_Info *);
231 > +
232 >  #else /* CONFIG_CIFS_FSCACHE */
233 >  static inline int cifs_fscache_register(void) { return 0; }
234 >  static inline void cifs_fscache_unregister(void) {}
235 >  
236 > +static inline void
237 > +cifs_fscache_get_client_cookie(struct TCP_Server_Info *server) {}
238 > +static inline void
239 > +cifs_fscache_get_client_cookie(struct TCP_Server_Info *server); {}
240 > +
241 >  #endif /* CONFIG_CIFS_FSCACHE */
242 >  
243 >  #endif /* _CIFS_FSCACHE_H */
244 > --
245 > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
246 > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
247 > More majordomo info at  http://vger.kernel.org/majordomo-info.html
248
249
250
251 -- 
252 Jeff Layton <jlayton-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org>
253
254