From: Andrew Morton <akpm@osdl.org>
To: David Howells <dhowells@redhat.com>
Cc: aviro@redhat.com, sct@redhat.com, nfsv4@linux-nfs.org,
steved@redhat.com, linux-kernel@vger.kernel.org,
torvalds@osdl.org, linux-cachefs@redhat.com,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 7/7] FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem
Date: Thu, 20 Apr 2006 18:16:16 -0700 [thread overview]
Message-ID: <20060420181616.0f167b1d.akpm@osdl.org> (raw)
In-Reply-To: <20060420165941.9968.13602.stgit@warthog.cambridge.redhat.com>
David Howells <dhowells@redhat.com> wrote:
>
> ...
>
> + ret = 0;
> + }
> + else if (cachefiles_has_space(cache, 1) == 0) {
} else if (cachefiles_has_space(cache, 1) == 0) {
> + /* there's space in the cache we can use */
> + pagevec_add(&pagevec, page);
> + cookie->def->mark_pages_cached(cookie->netfs_data,
> + page->mapping, &pagevec);
> + ret = -ENODATA;
> + }
> + else {
} else {
(many instances)
> +unsigned long cachefiles_debug = 0;
Unneeded initialisation.
> +static int cachefiles_init(void)
__init?
> +#if 0
> +void __cyg_profile_func_enter (void *this_fn, void *call_site)
> +__attribute__((no_instrument_function));
> +
> +void __cyg_profile_func_enter (void *this_fn, void *call_site)
> +{
> + asm volatile(" movl %%esp,%%edi \n"
> + " andl %0,%%edi \n"
> + " addl %1,%%edi \n"
> + " movl %%esp,%%ecx \n"
> + " subl %%edi,%%ecx \n"
> + " shrl $2,%%ecx \n"
> + " movl $0xedededed,%%eax \n"
> + " rep stosl \n"
> + :
> + : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
> + : "eax", "ecx", "edi", "memory", "cc"
> + );
> +}
> +
> +void __cyg_profile_func_exit(void *this_fn, void *call_site)
> +__attribute__((no_instrument_function));
> +
> +void __cyg_profile_func_exit(void *this_fn, void *call_site)
> +{
> + asm volatile(" movl %%esp,%%edi \n"
> + " andl %0,%%edi \n"
> + " addl %1,%%edi \n"
> + " movl %%esp,%%ecx \n"
> + " subl %%edi,%%ecx \n"
> + " shrl $2,%%ecx \n"
> + " movl $0xdadadada,%%eax \n"
> + " rep stosl \n"
> + :
> + : "i"(~(THREAD_SIZE-1)), "i"(sizeof(struct thread_info))
> + : "eax", "ecx", "edi", "memory", "cc"
> + );
> +}
> +#endif
removeable?
> +/*
> + * delete an object representation from the cache
> + * - file backed objects are unlinked
> + * - directory backed objects are stuffed into the graveyard for userspace to
> + * delete
> + * - unlocks the directory mutex
> + */
> +static int cachefiles_bury_object(struct cachefiles_cache *cache,
> + struct dentry *dir,
> + struct dentry *rep)
> +{
> + struct dentry *grave, *alt, *trap;
> + struct qstr name;
> + const char *old_name;
> + char nbuffer[8 + 8 + 1];
> + int ret;
> +
> + _enter(",'%*.*s','%*.*s'",
> + dir->d_name.len, dir->d_name.len, dir->d_name.name,
> + rep->d_name.len, rep->d_name.len, rep->d_name.name);
> +
> + /* non-directories can just be unlinked */
> + if (!S_ISDIR(rep->d_inode->i_mode)) {
> + _debug("unlink stale object");
> + ret = dir->d_inode->i_op->unlink(dir->d_inode, rep);
> +
> + mutex_unlock(&dir->d_inode->i_mutex);
hm, what's going on here? It's strange for a callee to undo an i_mutex
which some caller took.
> EXPORT_SYMBOL(generic_file_buffered_write);
>
> +int
> +generic_file_buffered_write_one_kernel_page(struct file *file,
> + pgoff_t index,
> + struct page *src)
Some covering comments would be nice.
> +{
> + struct address_space *mapping = file->f_mapping;
> + struct address_space_operations *a_ops = mapping->a_ops;
> + struct pagevec lru_pvec;
> + struct page *page, *cached_page = NULL;
> + void *from, *to;
> + long status = 0;
> +
> + pagevec_init(&lru_pvec, 0);
> +
> + page = __grab_cache_page(mapping, index, &cached_page, &lru_pvec);
> + if (!page) {
> + BUG_ON(cached_page);
> + return -ENOMEM;
> + }
> +
> + status = a_ops->prepare_write(file, page, 0, PAGE_CACHE_SIZE);
> + if (unlikely(status)) {
> + loff_t isize = i_size_read(mapping->host);
If the hosts's i_mutex is held (it should be, but there are no comments)
then we can read inode->i_size directly. Minor thing.
> +
> + from = kmap_atomic(src, KM_USER0);
> + to = kmap_atomic(page, KM_USER1);
> + copy_page(to, from);
> + kunmap_atomic(from, KM_USER0);
> + kunmap_atomic(to, KM_USER1);
that's copy_highpage().
Sigh. It's all a huge pile of new code. And it's only used by AFS, the
number of users of which can be counted on the fingers of one foot. An NFS
implementation would make a testing phase much more useful.
next prev parent reply other threads:[~2006-04-21 1:16 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-20 16:59 [PATCH 1/7] FS-Cache: Provide a filesystem-specific sync'able page bit David Howells
2006-04-20 16:59 ` [PATCH 2/7] FS-Cache: Add notification of page becoming writable to VMA ops David Howells
2006-04-20 17:40 ` Zach Brown
2006-04-20 18:27 ` Anton Altaparmakov
2006-04-20 16:59 ` [PATCH 3/7] FS-Cache: Avoid ENFILE checking for kernel-specific open files David Howells
2006-04-20 17:18 ` Christoph Hellwig
2006-04-20 18:06 ` David Howells
2006-04-21 0:11 ` Andrew Morton
2006-04-21 10:57 ` David Howells
2006-04-21 0:07 ` Andrew Morton
2006-04-21 12:33 ` David Howells
2006-04-21 18:22 ` Andrew Morton
2006-04-21 19:29 ` David Howells
2006-04-20 16:59 ` [PATCH 4/7] FS-Cache: Export find_get_pages() David Howells
2006-04-20 17:19 ` Christoph Hellwig
2006-04-20 17:45 ` David Howells
2006-04-21 0:15 ` Andrew Morton
2006-04-21 13:02 ` David Howells
2006-04-20 16:59 ` [PATCH 5/7] FS-Cache: Generic filesystem caching facility David Howells
2006-04-21 0:46 ` Andrew Morton
2006-04-21 14:15 ` David Howells
2006-04-21 18:38 ` Andrew Morton
2006-04-21 19:33 ` David Howells
2006-04-20 16:59 ` [PATCH 6/7] FS-Cache: Make kAFS use FS-Cache David Howells
2006-04-20 16:59 ` [PATCH 7/7] FS-Cache: CacheFiles: A cache that backs onto a mounted filesystem David Howells
2006-04-21 0:57 ` Andrew Morton
2006-04-21 1:16 ` Andrew Morton [this message]
2006-04-21 14:49 ` David Howells
2006-04-21 0:12 ` [PATCH 1/7] FS-Cache: Provide a filesystem-specific sync'able page bit Andrew Morton
2006-04-21 10:22 ` David Howells
2006-04-21 10:33 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060420181616.0f167b1d.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=aviro@redhat.com \
--cc=dhowells@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
--cc=sct@redhat.com \
--cc=steved@redhat.com \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).