diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-20 17:25:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-20 17:25:39 -0500 |
commit | b5898cd057001336888b6aff601385b5f5e79b01 (patch) | |
tree | 80f456b6b879c84800f7006e98b29e9c6bdd3831 | |
parent | 2a46eed54a28c1e3de701ca4237ce4f8bebf14c6 (diff) | |
parent | 31dec1327e377b6d91a8a6c92b5cd8513939a233 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs bits and pieces from Al Viro:
"Assorted bits that got missed in the first pull request + fixes for a
couple of coredump regressions"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fold try_to_ascend() into the sole remaining caller
dcache.c: get rid of pointless macros
take read_seqbegin_or_lock() and friends to seqlock.h
consolidate simple ->d_delete() instances
gfs2: endianness misannotations
dump_emit(): use __kernel_write(), not vfs_write()
dump_align(): fix the dumb braino
-rw-r--r-- | arch/ia64/kernel/perfmon.c | 8 | ||||
-rw-r--r-- | fs/9p/vfs_dentry.c | 19 | ||||
-rw-r--r-- | fs/configfs/dir.c | 12 | ||||
-rw-r--r-- | fs/coredump.c | 6 | ||||
-rw-r--r-- | fs/dcache.c | 84 | ||||
-rw-r--r-- | fs/efivarfs/super.c | 11 | ||||
-rw-r--r-- | fs/gfs2/lock_dlm.c | 8 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 23 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 4 | ||||
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 11 | ||||
-rw-r--r-- | fs/libfs.c | 12 | ||||
-rw-r--r-- | fs/proc/generic.c | 18 | ||||
-rw-r--r-- | fs/proc/namespaces.c | 8 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/seqlock.h | 29 | ||||
-rw-r--r-- | kernel/cgroup.c | 7 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 11 |
17 files changed, 86 insertions, 187 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 5a9ff1c3c3e9..cb592773c78b 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -2166,12 +2166,6 @@ static const struct file_operations pfm_file_ops = { | |||
2166 | .flush = pfm_flush | 2166 | .flush = pfm_flush |
2167 | }; | 2167 | }; |
2168 | 2168 | ||
2169 | static int | ||
2170 | pfmfs_delete_dentry(const struct dentry *dentry) | ||
2171 | { | ||
2172 | return 1; | ||
2173 | } | ||
2174 | |||
2175 | static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) | 2169 | static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) |
2176 | { | 2170 | { |
2177 | return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", | 2171 | return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", |
@@ -2179,7 +2173,7 @@ static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) | |||
2179 | } | 2173 | } |
2180 | 2174 | ||
2181 | static const struct dentry_operations pfmfs_dentry_operations = { | 2175 | static const struct dentry_operations pfmfs_dentry_operations = { |
2182 | .d_delete = pfmfs_delete_dentry, | 2176 | .d_delete = always_delete_dentry, |
2183 | .d_dname = pfmfs_dname, | 2177 | .d_dname = pfmfs_dname, |
2184 | }; | 2178 | }; |
2185 | 2179 | ||
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index f039b104a98e..b03dd23feda8 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -43,23 +43,6 @@ | |||
43 | #include "fid.h" | 43 | #include "fid.h" |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * v9fs_dentry_delete - called when dentry refcount equals 0 | ||
47 | * @dentry: dentry in question | ||
48 | * | ||
49 | * By returning 1 here we should remove cacheing of unused | ||
50 | * dentry components. | ||
51 | * | ||
52 | */ | ||
53 | |||
54 | static int v9fs_dentry_delete(const struct dentry *dentry) | ||
55 | { | ||
56 | p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n", | ||
57 | dentry->d_name.name, dentry); | ||
58 | |||
59 | return 1; | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * v9fs_cached_dentry_delete - called when dentry refcount equals 0 | 46 | * v9fs_cached_dentry_delete - called when dentry refcount equals 0 |
64 | * @dentry: dentry in question | 47 | * @dentry: dentry in question |
65 | * | 48 | * |
@@ -134,6 +117,6 @@ const struct dentry_operations v9fs_cached_dentry_operations = { | |||
134 | }; | 117 | }; |
135 | 118 | ||
136 | const struct dentry_operations v9fs_dentry_operations = { | 119 | const struct dentry_operations v9fs_dentry_operations = { |
137 | .d_delete = v9fs_dentry_delete, | 120 | .d_delete = always_delete_dentry, |
138 | .d_release = v9fs_dentry_release, | 121 | .d_release = v9fs_dentry_release, |
139 | }; | 122 | }; |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 277bd1be21fd..4522e0755773 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -66,19 +66,9 @@ static void configfs_d_iput(struct dentry * dentry, | |||
66 | iput(inode); | 66 | iput(inode); |
67 | } | 67 | } |
68 | 68 | ||
69 | /* | ||
70 | * We _must_ delete our dentries on last dput, as the chain-to-parent | ||
71 | * behavior is required to clear the parents of default_groups. | ||
72 | */ | ||
73 | static int configfs_d_delete(const struct dentry *dentry) | ||
74 | { | ||
75 | return 1; | ||
76 | } | ||
77 | |||
78 | const struct dentry_operations configfs_dentry_ops = { | 69 | const struct dentry_operations configfs_dentry_ops = { |
79 | .d_iput = configfs_d_iput, | 70 | .d_iput = configfs_d_iput, |
80 | /* simple_delete_dentry() isn't exported */ | 71 | .d_delete = always_delete_dentry, |
81 | .d_delete = configfs_d_delete, | ||
82 | }; | 72 | }; |
83 | 73 | ||
84 | #ifdef CONFIG_LOCKDEP | 74 | #ifdef CONFIG_LOCKDEP |
diff --git a/fs/coredump.c b/fs/coredump.c index 62406b6959b6..bc3fbcd32558 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -695,7 +695,7 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr) | |||
695 | while (nr) { | 695 | while (nr) { |
696 | if (dump_interrupted()) | 696 | if (dump_interrupted()) |
697 | return 0; | 697 | return 0; |
698 | n = vfs_write(file, addr, nr, &pos); | 698 | n = __kernel_write(file, addr, nr, &pos); |
699 | if (n <= 0) | 699 | if (n <= 0) |
700 | return 0; | 700 | return 0; |
701 | file->f_pos = pos; | 701 | file->f_pos = pos; |
@@ -733,7 +733,7 @@ int dump_align(struct coredump_params *cprm, int align) | |||
733 | { | 733 | { |
734 | unsigned mod = cprm->written & (align - 1); | 734 | unsigned mod = cprm->written & (align - 1); |
735 | if (align & (align - 1)) | 735 | if (align & (align - 1)) |
736 | return -EINVAL; | 736 | return 0; |
737 | return mod ? dump_skip(cprm, align - mod) : 0; | 737 | return mod ? dump_skip(cprm, align - mod) : 1; |
738 | } | 738 | } |
739 | EXPORT_SYMBOL(dump_align); | 739 | EXPORT_SYMBOL(dump_align); |
diff --git a/fs/dcache.c b/fs/dcache.c index 0a38ef8d7f00..4bdb300b16e2 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -88,35 +88,6 @@ EXPORT_SYMBOL(rename_lock); | |||
88 | 88 | ||
89 | static struct kmem_cache *dentry_cache __read_mostly; | 89 | static struct kmem_cache *dentry_cache __read_mostly; |
90 | 90 | ||
91 | /** | ||
92 | * read_seqbegin_or_lock - begin a sequence number check or locking block | ||
93 | * @lock: sequence lock | ||
94 | * @seq : sequence number to be checked | ||
95 | * | ||
96 | * First try it once optimistically without taking the lock. If that fails, | ||
97 | * take the lock. The sequence number is also used as a marker for deciding | ||
98 | * whether to be a reader (even) or writer (odd). | ||
99 | * N.B. seq must be initialized to an even number to begin with. | ||
100 | */ | ||
101 | static inline void read_seqbegin_or_lock(seqlock_t *lock, int *seq) | ||
102 | { | ||
103 | if (!(*seq & 1)) /* Even */ | ||
104 | *seq = read_seqbegin(lock); | ||
105 | else /* Odd */ | ||
106 | read_seqlock_excl(lock); | ||
107 | } | ||
108 | |||
109 | static inline int need_seqretry(seqlock_t *lock, int seq) | ||
110 | { | ||
111 | return !(seq & 1) && read_seqretry(lock, seq); | ||
112 | } | ||
113 | |||
114 | static inline void done_seqretry(seqlock_t *lock, int seq) | ||
115 | { | ||
116 | if (seq & 1) | ||
117 | read_sequnlock_excl(lock); | ||
118 | } | ||
119 | |||
120 | /* | 91 | /* |
121 | * This is the single most critical data structure when it comes | 92 | * This is the single most critical data structure when it comes |
122 | * to the dcache: the hashtable for lookups. Somebody should try | 93 | * to the dcache: the hashtable for lookups. Somebody should try |
@@ -125,8 +96,6 @@ static inline void done_seqretry(seqlock_t *lock, int seq) | |||
125 | * This hash-function tries to avoid losing too many bits of hash | 96 | * This hash-function tries to avoid losing too many bits of hash |
126 | * information, yet avoid using a prime hash-size or similar. | 97 | * information, yet avoid using a prime hash-size or similar. |
127 | */ | 98 | */ |
128 | #define D_HASHBITS d_hash_shift | ||
129 | #define D_HASHMASK d_hash_mask | ||
130 | 99 | ||
131 | static unsigned int d_hash_mask __read_mostly; | 100 | static unsigned int d_hash_mask __read_mostly; |
132 | static unsigned int d_hash_shift __read_mostly; | 101 | static unsigned int d_hash_shift __read_mostly; |
@@ -137,8 +106,8 @@ static inline struct hlist_bl_head *d_hash(const struct dentry *parent, | |||
137 | unsigned int hash) | 106 | unsigned int hash) |
138 | { | 107 | { |
139 | hash += (unsigned long) parent / L1_CACHE_BYTES; | 108 | hash += (unsigned long) parent / L1_CACHE_BYTES; |
140 | hash = hash + (hash >> D_HASHBITS); | 109 | hash = hash + (hash >> d_hash_shift); |
141 | return dentry_hashtable + (hash & D_HASHMASK); | 110 | return dentry_hashtable + (hash & d_hash_mask); |
142 | } | 111 | } |
143 | 112 | ||
144 | /* Statistics gathering. */ | 113 | /* Statistics gathering. */ |
@@ -469,7 +438,7 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) | |||
469 | { | 438 | { |
470 | list_del(&dentry->d_u.d_child); | 439 | list_del(&dentry->d_u.d_child); |
471 | /* | 440 | /* |
472 | * Inform try_to_ascend() that we are no longer attached to the | 441 | * Inform d_walk() that we are no longer attached to the |
473 | * dentry tree | 442 | * dentry tree |
474 | */ | 443 | */ |
475 | dentry->d_flags |= DCACHE_DENTRY_KILLED; | 444 | dentry->d_flags |= DCACHE_DENTRY_KILLED; |
@@ -1069,34 +1038,6 @@ void shrink_dcache_sb(struct super_block *sb) | |||
1069 | } | 1038 | } |
1070 | EXPORT_SYMBOL(shrink_dcache_sb); | 1039 | EXPORT_SYMBOL(shrink_dcache_sb); |
1071 | 1040 | ||
1072 | /* | ||
1073 | * This tries to ascend one level of parenthood, but | ||
1074 | * we can race with renaming, so we need to re-check | ||
1075 | * the parenthood after dropping the lock and check | ||
1076 | * that the sequence number still matches. | ||
1077 | */ | ||
1078 | static struct dentry *try_to_ascend(struct dentry *old, unsigned seq) | ||
1079 | { | ||
1080 | struct dentry *new = old->d_parent; | ||
1081 | |||
1082 | rcu_read_lock(); | ||
1083 | spin_unlock(&old->d_lock); | ||
1084 | spin_lock(&new->d_lock); | ||
1085 | |||
1086 | /* | ||
1087 | * might go back up the wrong parent if we have had a rename | ||
1088 | * or deletion | ||
1089 | */ | ||
1090 | if (new != old->d_parent || | ||
1091 | (old->d_flags & DCACHE_DENTRY_KILLED) || | ||
1092 | need_seqretry(&rename_lock, seq)) { | ||
1093 | spin_unlock(&new->d_lock); | ||
1094 | new = NULL; | ||
1095 | } | ||
1096 | rcu_read_unlock(); | ||
1097 | return new; | ||
1098 | } | ||
1099 | |||
1100 | /** | 1041 | /** |
1101 | * enum d_walk_ret - action to talke during tree walk | 1042 | * enum d_walk_ret - action to talke during tree walk |
1102 | * @D_WALK_CONTINUE: contrinue walk | 1043 | * @D_WALK_CONTINUE: contrinue walk |
@@ -1185,9 +1126,24 @@ resume: | |||
1185 | */ | 1126 | */ |
1186 | if (this_parent != parent) { | 1127 | if (this_parent != parent) { |
1187 | struct dentry *child = this_parent; | 1128 | struct dentry *child = this_parent; |
1188 | this_parent = try_to_ascend(this_parent, seq); | 1129 | this_parent = child->d_parent; |
1189 | if (!this_parent) | 1130 | |
1131 | rcu_read_lock(); | ||
1132 | spin_unlock(&child->d_lock); | ||
1133 | spin_lock(&this_parent->d_lock); | ||
1134 | |||
1135 | /* | ||
1136 | * might go back up the wrong parent if we have had a rename | ||
1137 | * or deletion | ||
1138 | */ | ||
1139 | if (this_parent != child->d_parent || | ||
1140 | (child->d_flags & DCACHE_DENTRY_KILLED) || | ||
1141 | need_seqretry(&rename_lock, seq)) { | ||
1142 | spin_unlock(&this_parent->d_lock); | ||
1143 | rcu_read_unlock(); | ||
1190 | goto rename_retry; | 1144 | goto rename_retry; |
1145 | } | ||
1146 | rcu_read_unlock(); | ||
1191 | next = child->d_u.d_child.next; | 1147 | next = child->d_u.d_child.next; |
1192 | goto resume; | 1148 | goto resume; |
1193 | } | 1149 | } |
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index a8766b880c07..becc725a1953 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c | |||
@@ -83,19 +83,10 @@ static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr) | |||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | /* | ||
87 | * Retaining negative dentries for an in-memory filesystem just wastes | ||
88 | * memory and lookup time: arrange for them to be deleted immediately. | ||
89 | */ | ||
90 | static int efivarfs_delete_dentry(const struct dentry *dentry) | ||
91 | { | ||
92 | return 1; | ||
93 | } | ||
94 | |||
95 | static struct dentry_operations efivarfs_d_ops = { | 86 | static struct dentry_operations efivarfs_d_ops = { |
96 | .d_compare = efivarfs_d_compare, | 87 | .d_compare = efivarfs_d_compare, |
97 | .d_hash = efivarfs_d_hash, | 88 | .d_hash = efivarfs_d_hash, |
98 | .d_delete = efivarfs_delete_dentry, | 89 | .d_delete = always_delete_dentry, |
99 | }; | 90 | }; |
100 | 91 | ||
101 | static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) | 92 | static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) |
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index c8423d6de6c3..2a6ba06bee6f 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -466,19 +466,19 @@ static void gdlm_cancel(struct gfs2_glock *gl) | |||
466 | static void control_lvb_read(struct lm_lockstruct *ls, uint32_t *lvb_gen, | 466 | static void control_lvb_read(struct lm_lockstruct *ls, uint32_t *lvb_gen, |
467 | char *lvb_bits) | 467 | char *lvb_bits) |
468 | { | 468 | { |
469 | uint32_t gen; | 469 | __le32 gen; |
470 | memcpy(lvb_bits, ls->ls_control_lvb, GDLM_LVB_SIZE); | 470 | memcpy(lvb_bits, ls->ls_control_lvb, GDLM_LVB_SIZE); |
471 | memcpy(&gen, lvb_bits, sizeof(uint32_t)); | 471 | memcpy(&gen, lvb_bits, sizeof(__le32)); |
472 | *lvb_gen = le32_to_cpu(gen); | 472 | *lvb_gen = le32_to_cpu(gen); |
473 | } | 473 | } |
474 | 474 | ||
475 | static void control_lvb_write(struct lm_lockstruct *ls, uint32_t lvb_gen, | 475 | static void control_lvb_write(struct lm_lockstruct *ls, uint32_t lvb_gen, |
476 | char *lvb_bits) | 476 | char *lvb_bits) |
477 | { | 477 | { |
478 | uint32_t gen; | 478 | __le32 gen; |
479 | memcpy(ls->ls_control_lvb, lvb_bits, GDLM_LVB_SIZE); | 479 | memcpy(ls->ls_control_lvb, lvb_bits, GDLM_LVB_SIZE); |
480 | gen = cpu_to_le32(lvb_gen); | 480 | gen = cpu_to_le32(lvb_gen); |
481 | memcpy(ls->ls_control_lvb, &gen, sizeof(uint32_t)); | 481 | memcpy(ls->ls_control_lvb, &gen, sizeof(__le32)); |
482 | } | 482 | } |
483 | 483 | ||
484 | static int all_jid_bits_clear(char *lvb) | 484 | static int all_jid_bits_clear(char *lvb) |
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 453b50eaddec..98236d0df3ca 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -667,7 +667,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
667 | struct buffer_head *bh; | 667 | struct buffer_head *bh; |
668 | struct page *page; | 668 | struct page *page; |
669 | void *kaddr, *ptr; | 669 | void *kaddr, *ptr; |
670 | struct gfs2_quota q, *qp; | 670 | struct gfs2_quota q; |
671 | int err, nbytes; | 671 | int err, nbytes; |
672 | u64 size; | 672 | u64 size; |
673 | 673 | ||
@@ -683,28 +683,25 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
683 | return err; | 683 | return err; |
684 | 684 | ||
685 | err = -EIO; | 685 | err = -EIO; |
686 | qp = &q; | 686 | be64_add_cpu(&q.qu_value, change); |
687 | qp->qu_value = be64_to_cpu(qp->qu_value); | 687 | qd->qd_qb.qb_value = q.qu_value; |
688 | qp->qu_value += change; | ||
689 | qp->qu_value = cpu_to_be64(qp->qu_value); | ||
690 | qd->qd_qb.qb_value = qp->qu_value; | ||
691 | if (fdq) { | 688 | if (fdq) { |
692 | if (fdq->d_fieldmask & FS_DQ_BSOFT) { | 689 | if (fdq->d_fieldmask & FS_DQ_BSOFT) { |
693 | qp->qu_warn = cpu_to_be64(fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift); | 690 | q.qu_warn = cpu_to_be64(fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift); |
694 | qd->qd_qb.qb_warn = qp->qu_warn; | 691 | qd->qd_qb.qb_warn = q.qu_warn; |
695 | } | 692 | } |
696 | if (fdq->d_fieldmask & FS_DQ_BHARD) { | 693 | if (fdq->d_fieldmask & FS_DQ_BHARD) { |
697 | qp->qu_limit = cpu_to_be64(fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift); | 694 | q.qu_limit = cpu_to_be64(fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift); |
698 | qd->qd_qb.qb_limit = qp->qu_limit; | 695 | qd->qd_qb.qb_limit = q.qu_limit; |
699 | } | 696 | } |
700 | if (fdq->d_fieldmask & FS_DQ_BCOUNT) { | 697 | if (fdq->d_fieldmask & FS_DQ_BCOUNT) { |
701 | qp->qu_value = cpu_to_be64(fdq->d_bcount >> sdp->sd_fsb2bb_shift); | 698 | q.qu_value = cpu_to_be64(fdq->d_bcount >> sdp->sd_fsb2bb_shift); |
702 | qd->qd_qb.qb_value = qp->qu_value; | 699 | qd->qd_qb.qb_value = q.qu_value; |
703 | } | 700 | } |
704 | } | 701 | } |
705 | 702 | ||
706 | /* Write the quota into the quota file on disk */ | 703 | /* Write the quota into the quota file on disk */ |
707 | ptr = qp; | 704 | ptr = &q; |
708 | nbytes = sizeof(struct gfs2_quota); | 705 | nbytes = sizeof(struct gfs2_quota); |
709 | get_a_page: | 706 | get_a_page: |
710 | page = find_or_create_page(mapping, index, GFP_NOFS); | 707 | page = find_or_create_page(mapping, index, GFP_NOFS); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 4d83abdd5635..c8d6161bd682 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1127,7 +1127,7 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd) | |||
1127 | rgd->rd_flags |= (GFS2_RDF_UPTODATE | GFS2_RDF_CHECK); | 1127 | rgd->rd_flags |= (GFS2_RDF_UPTODATE | GFS2_RDF_CHECK); |
1128 | rgd->rd_free_clone = rgd->rd_free; | 1128 | rgd->rd_free_clone = rgd->rd_free; |
1129 | } | 1129 | } |
1130 | if (be32_to_cpu(GFS2_MAGIC) != rgd->rd_rgl->rl_magic) { | 1130 | if (cpu_to_be32(GFS2_MAGIC) != rgd->rd_rgl->rl_magic) { |
1131 | rgd->rd_rgl->rl_unlinked = cpu_to_be32(count_unlinked(rgd)); | 1131 | rgd->rd_rgl->rl_unlinked = cpu_to_be32(count_unlinked(rgd)); |
1132 | gfs2_rgrp_ondisk2lvb(rgd->rd_rgl, | 1132 | gfs2_rgrp_ondisk2lvb(rgd->rd_rgl, |
1133 | rgd->rd_bits[0].bi_bh->b_data); | 1133 | rgd->rd_bits[0].bi_bh->b_data); |
@@ -1161,7 +1161,7 @@ int update_rgrp_lvb(struct gfs2_rgrpd *rgd) | |||
1161 | if (rgd->rd_flags & GFS2_RDF_UPTODATE) | 1161 | if (rgd->rd_flags & GFS2_RDF_UPTODATE) |
1162 | return 0; | 1162 | return 0; |
1163 | 1163 | ||
1164 | if (be32_to_cpu(GFS2_MAGIC) != rgd->rd_rgl->rl_magic) | 1164 | if (cpu_to_be32(GFS2_MAGIC) != rgd->rd_rgl->rl_magic) |
1165 | return gfs2_rgrp_bh_get(rgd); | 1165 | return gfs2_rgrp_bh_get(rgd); |
1166 | 1166 | ||
1167 | rl_flags = be32_to_cpu(rgd->rd_rgl->rl_flags); | 1167 | rl_flags = be32_to_cpu(rgd->rd_rgl->rl_flags); |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 25437280a207..db23ce1bd903 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -33,15 +33,6 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode) | |||
33 | 33 | ||
34 | #define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file)) | 34 | #define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file)) |
35 | 35 | ||
36 | static int hostfs_d_delete(const struct dentry *dentry) | ||
37 | { | ||
38 | return 1; | ||
39 | } | ||
40 | |||
41 | static const struct dentry_operations hostfs_dentry_ops = { | ||
42 | .d_delete = hostfs_d_delete, | ||
43 | }; | ||
44 | |||
45 | /* Changed in hostfs_args before the kernel starts running */ | 36 | /* Changed in hostfs_args before the kernel starts running */ |
46 | static char *root_ino = ""; | 37 | static char *root_ino = ""; |
47 | static int append = 0; | 38 | static int append = 0; |
@@ -925,7 +916,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
925 | sb->s_blocksize_bits = 10; | 916 | sb->s_blocksize_bits = 10; |
926 | sb->s_magic = HOSTFS_SUPER_MAGIC; | 917 | sb->s_magic = HOSTFS_SUPER_MAGIC; |
927 | sb->s_op = &hostfs_sbops; | 918 | sb->s_op = &hostfs_sbops; |
928 | sb->s_d_op = &hostfs_dentry_ops; | 919 | sb->s_d_op = &simple_dentry_operations; |
929 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 920 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
930 | 921 | ||
931 | /* NULL is printed as <NULL> by sprintf: avoid that. */ | 922 | /* NULL is printed as <NULL> by sprintf: avoid that. */ |
diff --git a/fs/libfs.c b/fs/libfs.c index 5de06947ba5e..a1844244246f 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -47,10 +47,16 @@ EXPORT_SYMBOL(simple_statfs); | |||
47 | * Retaining negative dentries for an in-memory filesystem just wastes | 47 | * Retaining negative dentries for an in-memory filesystem just wastes |
48 | * memory and lookup time: arrange for them to be deleted immediately. | 48 | * memory and lookup time: arrange for them to be deleted immediately. |
49 | */ | 49 | */ |
50 | static int simple_delete_dentry(const struct dentry *dentry) | 50 | int always_delete_dentry(const struct dentry *dentry) |
51 | { | 51 | { |
52 | return 1; | 52 | return 1; |
53 | } | 53 | } |
54 | EXPORT_SYMBOL(always_delete_dentry); | ||
55 | |||
56 | const struct dentry_operations simple_dentry_operations = { | ||
57 | .d_delete = always_delete_dentry, | ||
58 | }; | ||
59 | EXPORT_SYMBOL(simple_dentry_operations); | ||
54 | 60 | ||
55 | /* | 61 | /* |
56 | * Lookup the data. This is trivial - if the dentry didn't already | 62 | * Lookup the data. This is trivial - if the dentry didn't already |
@@ -58,10 +64,6 @@ static int simple_delete_dentry(const struct dentry *dentry) | |||
58 | */ | 64 | */ |
59 | struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) | 65 | struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) |
60 | { | 66 | { |
61 | static const struct dentry_operations simple_dentry_operations = { | ||
62 | .d_delete = simple_delete_dentry, | ||
63 | }; | ||
64 | |||
65 | if (dentry->d_name.len > NAME_MAX) | 67 | if (dentry->d_name.len > NAME_MAX) |
66 | return ERR_PTR(-ENAMETOOLONG); | 68 | return ERR_PTR(-ENAMETOOLONG); |
67 | if (!dentry->d_sb->s_d_op) | 69 | if (!dentry->d_sb->s_d_op) |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 737e15615b04..cca93b6fb9a9 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -175,22 +175,6 @@ static const struct inode_operations proc_link_inode_operations = { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | /* | 177 | /* |
178 | * As some entries in /proc are volatile, we want to | ||
179 | * get rid of unused dentries. This could be made | ||
180 | * smarter: we could keep a "volatile" flag in the | ||
181 | * inode to indicate which ones to keep. | ||
182 | */ | ||
183 | static int proc_delete_dentry(const struct dentry * dentry) | ||
184 | { | ||
185 | return 1; | ||
186 | } | ||
187 | |||
188 | static const struct dentry_operations proc_dentry_operations = | ||
189 | { | ||
190 | .d_delete = proc_delete_dentry, | ||
191 | }; | ||
192 | |||
193 | /* | ||
194 | * Don't create negative dentries here, return -ENOENT by hand | 178 | * Don't create negative dentries here, return -ENOENT by hand |
195 | * instead. | 179 | * instead. |
196 | */ | 180 | */ |
@@ -209,7 +193,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, | |||
209 | inode = proc_get_inode(dir->i_sb, de); | 193 | inode = proc_get_inode(dir->i_sb, de); |
210 | if (!inode) | 194 | if (!inode) |
211 | return ERR_PTR(-ENOMEM); | 195 | return ERR_PTR(-ENOMEM); |
212 | d_set_d_op(dentry, &proc_dentry_operations); | 196 | d_set_d_op(dentry, &simple_dentry_operations); |
213 | d_add(dentry, inode); | 197 | d_add(dentry, inode); |
214 | return NULL; | 198 | return NULL; |
215 | } | 199 | } |
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index 49a7fff2e83a..9ae46b87470d 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c | |||
@@ -42,12 +42,6 @@ static const struct inode_operations ns_inode_operations = { | |||
42 | .setattr = proc_setattr, | 42 | .setattr = proc_setattr, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static int ns_delete_dentry(const struct dentry *dentry) | ||
46 | { | ||
47 | /* Don't cache namespace inodes when not in use */ | ||
48 | return 1; | ||
49 | } | ||
50 | |||
51 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | 45 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) |
52 | { | 46 | { |
53 | struct inode *inode = dentry->d_inode; | 47 | struct inode *inode = dentry->d_inode; |
@@ -59,7 +53,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | |||
59 | 53 | ||
60 | const struct dentry_operations ns_dentry_operations = | 54 | const struct dentry_operations ns_dentry_operations = |
61 | { | 55 | { |
62 | .d_delete = ns_delete_dentry, | 56 | .d_delete = always_delete_dentry, |
63 | .d_dname = ns_dname, | 57 | .d_dname = ns_dname, |
64 | }; | 58 | }; |
65 | 59 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index bf5d574ebdf4..121f11f001c0 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2622,7 +2622,9 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping, | |||
2622 | extern int simple_write_end(struct file *file, struct address_space *mapping, | 2622 | extern int simple_write_end(struct file *file, struct address_space *mapping, |
2623 | loff_t pos, unsigned len, unsigned copied, | 2623 | loff_t pos, unsigned len, unsigned copied, |
2624 | struct page *page, void *fsdata); | 2624 | struct page *page, void *fsdata); |
2625 | extern int always_delete_dentry(const struct dentry *); | ||
2625 | extern struct inode *alloc_anon_inode(struct super_block *); | 2626 | extern struct inode *alloc_anon_inode(struct super_block *); |
2627 | extern const struct dentry_operations simple_dentry_operations; | ||
2626 | 2628 | ||
2627 | extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); | 2629 | extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); |
2628 | extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); | 2630 | extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); |
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 1e8a8b6e837d..cf87a24c0f92 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
@@ -354,6 +354,35 @@ static inline void read_sequnlock_excl(seqlock_t *sl) | |||
354 | spin_unlock(&sl->lock); | 354 | spin_unlock(&sl->lock); |
355 | } | 355 | } |
356 | 356 | ||
357 | /** | ||
358 | * read_seqbegin_or_lock - begin a sequence number check or locking block | ||
359 | * @lock: sequence lock | ||
360 | * @seq : sequence number to be checked | ||
361 | * | ||
362 | * First try it once optimistically without taking the lock. If that fails, | ||
363 | * take the lock. The sequence number is also used as a marker for deciding | ||
364 | * whether to be a reader (even) or writer (odd). | ||
365 | * N.B. seq must be initialized to an even number to begin with. | ||
366 | */ | ||
367 | static inline void read_seqbegin_or_lock(seqlock_t *lock, int *seq) | ||
368 | { | ||
369 | if (!(*seq & 1)) /* Even */ | ||
370 | *seq = read_seqbegin(lock); | ||
371 | else /* Odd */ | ||
372 | read_seqlock_excl(lock); | ||
373 | } | ||
374 | |||
375 | static inline int need_seqretry(seqlock_t *lock, int seq) | ||
376 | { | ||
377 | return !(seq & 1) && read_seqretry(lock, seq); | ||
378 | } | ||
379 | |||
380 | static inline void done_seqretry(seqlock_t *lock, int seq) | ||
381 | { | ||
382 | if (seq & 1) | ||
383 | read_sequnlock_excl(lock); | ||
384 | } | ||
385 | |||
357 | static inline void read_seqlock_excl_bh(seqlock_t *sl) | 386 | static inline void read_seqlock_excl_bh(seqlock_t *sl) |
358 | { | 387 | { |
359 | spin_lock_bh(&sl->lock); | 388 | spin_lock_bh(&sl->lock); |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e0839bcd48c8..4c62513fe19f 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -895,11 +895,6 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode) | |||
895 | iput(inode); | 895 | iput(inode); |
896 | } | 896 | } |
897 | 897 | ||
898 | static int cgroup_delete(const struct dentry *d) | ||
899 | { | ||
900 | return 1; | ||
901 | } | ||
902 | |||
903 | static void remove_dir(struct dentry *d) | 898 | static void remove_dir(struct dentry *d) |
904 | { | 899 | { |
905 | struct dentry *parent = dget(d->d_parent); | 900 | struct dentry *parent = dget(d->d_parent); |
@@ -1486,7 +1481,7 @@ static int cgroup_get_rootdir(struct super_block *sb) | |||
1486 | { | 1481 | { |
1487 | static const struct dentry_operations cgroup_dops = { | 1482 | static const struct dentry_operations cgroup_dops = { |
1488 | .d_iput = cgroup_diput, | 1483 | .d_iput = cgroup_diput, |
1489 | .d_delete = cgroup_delete, | 1484 | .d_delete = always_delete_dentry, |
1490 | }; | 1485 | }; |
1491 | 1486 | ||
1492 | struct inode *inode = | 1487 | struct inode *inode = |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index d0d14a04dce1..bf04b30a788a 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -471,15 +471,6 @@ struct rpc_filelist { | |||
471 | umode_t mode; | 471 | umode_t mode; |
472 | }; | 472 | }; |
473 | 473 | ||
474 | static int rpc_delete_dentry(const struct dentry *dentry) | ||
475 | { | ||
476 | return 1; | ||
477 | } | ||
478 | |||
479 | static const struct dentry_operations rpc_dentry_operations = { | ||
480 | .d_delete = rpc_delete_dentry, | ||
481 | }; | ||
482 | |||
483 | static struct inode * | 474 | static struct inode * |
484 | rpc_get_inode(struct super_block *sb, umode_t mode) | 475 | rpc_get_inode(struct super_block *sb, umode_t mode) |
485 | { | 476 | { |
@@ -1266,7 +1257,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent) | |||
1266 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; | 1257 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
1267 | sb->s_magic = RPCAUTH_GSSMAGIC; | 1258 | sb->s_magic = RPCAUTH_GSSMAGIC; |
1268 | sb->s_op = &s_ops; | 1259 | sb->s_op = &s_ops; |
1269 | sb->s_d_op = &rpc_dentry_operations; | 1260 | sb->s_d_op = &simple_dentry_operations; |
1270 | sb->s_time_gran = 1; | 1261 | sb->s_time_gran = 1; |
1271 | 1262 | ||
1272 | inode = rpc_get_inode(sb, S_IFDIR | S_IRUGO | S_IXUGO); | 1263 | inode = rpc_get_inode(sb, S_IFDIR | S_IRUGO | S_IXUGO); |