From: yegorslists@googlemail.com
To: barebox@lists.infradead.org
Subject: [PATCH 5/8] fs: ubifs: move dcache related definitions to include/linux/dcache.h
Date: Wed, 27 Jan 2016 12:53:06 +0100 [thread overview]
Message-ID: <1453895589-20941-5-git-send-email-yegorslists@googlemail.com> (raw)
In-Reply-To: <1453895589-20941-1-git-send-email-yegorslists@googlemail.com>
From: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
fs/ubifs/ubifs.h | 47 +-----------------------------
include/linux/dcache.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+), 46 deletions(-)
create mode 100644 include/linux/dcache.h
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 9a2d2f5..424b154 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -37,6 +37,7 @@
#include <linux/fs.h>
#include <linux/pagemap.h>
#include <linux/stat.h>
+#include <linux/dcache.h>
#include <linux/ctype.h>
#include <linux/math64.h>
#include <linux/rbtree.h>
@@ -79,19 +80,6 @@ void iput(struct inode *inode);
/* linux/include/dcache.h */
-/*
- * "quick string" -- eases parameter passing, but more importantly
- * saves "metadata" about the string (ie length and the hash).
- *
- * hash comes first so it snuggles against d_parent in the
- * dentry.
- */
-struct qstr {
- unsigned int hash;
- unsigned int len;
- const char *name;
-};
-
struct file_system_type {
const char *name;
int fs_flags;
@@ -173,39 +161,6 @@ struct file {
*/
#define get_seconds() 0
-/* linux/include/dcache.h */
-
-#define DNAME_INLINE_LEN_MIN 36
-
-struct dentry {
- unsigned int d_flags; /* protected by d_lock */
- spinlock_t d_lock; /* per dentry lock */
- struct inode *d_inode; /* Where the name belongs to - NULL is
- * negative */
- /*
- * The next three fields are touched by __d_lookup. Place them here
- * so they all fit in a cache line.
- */
- struct hlist_node d_hash; /* lookup hash list */
- struct dentry *d_parent; /* parent directory */
- struct qstr d_name;
-
- struct list_head d_lru; /* LRU list */
- /*
- * d_child and d_rcu can share memory
- */
- struct list_head d_subdirs; /* our children */
- struct list_head d_alias; /* inode alias list */
- unsigned long d_time; /* used by d_revalidate */
- struct super_block *d_sb; /* The root of the dentry tree */
- void *d_fsdata; /* fs-specific data */
-#ifdef CONFIG_PROFILING
- struct dcookie_struct *d_cookie; /* cookie, if any */
-#endif
- int d_mounted;
- unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
-};
-
static inline ino_t parent_ino(struct dentry *dentry)
{
ino_t res;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
new file mode 100644
index 0000000..ea69b68
--- /dev/null
+++ b/include/linux/dcache.h
@@ -0,0 +1,77 @@
+#ifndef __LINUX_DCACHE_H
+#define __LINUX_DCACHE_H
+
+/*
+ * linux/include/linux/dcache.h
+ *
+ * Dirent cache data structures
+ *
+ * (C) Copyright 1997 Thomas Schoebel-Theuer,
+ * with heavy changes by Linus Torvalds
+ */
+
+#define IS_ROOT(x) ((x) == (x)->d_parent)
+
+/* The hash is always the low bits of hash_len */
+#ifdef __LITTLE_ENDIAN
+ #define HASH_LEN_DECLARE u32 hash; u32 len
+ #define bytemask_from_count(cnt) (~(~0ul << (cnt)*8))
+#else
+ #define HASH_LEN_DECLARE u32 len; u32 hash
+ #define bytemask_from_count(cnt) (~(~0ul >> (cnt)*8))
+#endif
+
+/*
+ * "quick string" -- eases parameter passing, but more importantly
+ * saves "metadata" about the string (ie length and the hash).
+ *
+ * hash comes first so it snuggles against d_parent in the
+ * dentry.
+ */
+struct qstr {
+ union {
+ struct {
+ HASH_LEN_DECLARE;
+ };
+ u64 hash_len;
+ };
+ const unsigned char *name;
+};
+
+#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
+#define hashlen_hash(hashlen) ((u32) (hashlen))
+#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
+#define hashlen_create(hash,len) (((u64)(len)<<32)|(u32)(hash))
+
+#define DNAME_INLINE_LEN_MIN 36
+
+struct dentry {
+ unsigned int d_flags; /* protected by d_lock */
+ spinlock_t d_lock; /* per dentry lock */
+ struct inode *d_inode; /* Where the name belongs to - NULL is
+ * negative */
+ /*
+ * The next three fields are touched by __d_lookup. Place them here
+ * so they all fit in a cache line.
+ */
+ struct hlist_node d_hash; /* lookup hash list */
+ struct dentry *d_parent; /* parent directory */
+ struct qstr d_name;
+
+ struct list_head d_lru; /* LRU list */
+ /*
+ * d_child and d_rcu can share memory
+ */
+ struct list_head d_subdirs; /* our children */
+ struct list_head d_alias; /* inode alias list */
+ unsigned long d_time; /* used by d_revalidate */
+ struct super_block *d_sb; /* The root of the dentry tree */
+ void *d_fsdata; /* fs-specific data */
+#ifdef CONFIG_PROFILING
+ struct dcookie_struct *d_cookie; /* cookie, if any */
+#endif
+ int d_mounted;
+ unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
+};
+
+#endif /* __LINUX_DCACHE_H */
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-01-27 11:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
2016-01-27 11:53 ` [PATCH 2/8] fs: ubifs: remove redundant macro defines yegorslists
2016-01-27 11:53 ` [PATCH 3/8] fs: use linux/fs.h for file system related definitions yegorslists
2016-01-27 11:53 ` [PATCH 4/8] fs: move pgoff_t definition to include/linux/types.h yegorslists
2016-01-27 11:53 ` yegorslists [this message]
2016-01-27 11:53 ` [PATCH 6/8] fs: ubifs: move vfsmount definition to include/linux/mount.h yegorslists
2016-01-27 11:53 ` [PATCH 7/8] fs: ubifs: move path definition to include/linux/path.h yegorslists
2016-01-27 11:53 ` [PATCH 8/8] fs: ubifs: move file and file_system_type definitions to linux/fs.h yegorslists
2016-01-29 7:08 ` [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h Sascha Hauer
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=1453895589-20941-5-git-send-email-yegorslists@googlemail.com \
--to=yegorslists@googlemail.com \
--cc=barebox@lists.infradead.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