aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/conv.c32
-rw-r--r--fs/autofs4/root.c2
-rw-r--r--fs/binfmt_elf.c4
-rw-r--r--fs/binfmt_misc.c2
-rw-r--r--fs/bio.c4
-rw-r--r--fs/buffer.c6
-rw-r--r--fs/char_dev.c96
-rw-r--r--fs/compat.c4
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/exec.c6
-rw-r--r--fs/ext2/namei.c5
-rw-r--r--fs/ext3/namei.c5
-rw-r--r--fs/fcntl.c2
-rw-r--r--fs/hugetlbfs/inode.c2
-rw-r--r--fs/isofs/namei.c5
-rw-r--r--fs/jffs2/build.c2
-rw-r--r--fs/jffs2/nodelist.c4
-rw-r--r--fs/lockd/xdr.c6
-rw-r--r--fs/mbcache.c6
-rw-r--r--fs/namei.c16
-rw-r--r--fs/ncpfs/inode.c19
-rw-r--r--fs/ncpfs/ioctl.c20
-rw-r--r--fs/nfsd/nfsxdr.c4
-rw-r--r--fs/pipe.c4
-rw-r--r--fs/proc/proc_devtree.c24
-rw-r--r--fs/proc/proc_misc.c160
-rw-r--r--fs/quota_v2.c3
-rw-r--r--fs/reiserfs/namei.c6
-rw-r--r--fs/smbfs/Makefile1
-rw-r--r--fs/smbfs/inode.c32
-rw-r--r--fs/smbfs/request.c13
-rw-r--r--fs/ufs/balloc.c19
-rw-r--r--fs/ufs/ialloc.c4
-rw-r--r--fs/ufs/inode.c11
-rw-r--r--fs/ufs/super.c57
-rw-r--r--fs/ufs/util.h28
36 files changed, 397 insertions, 219 deletions
diff --git a/fs/9p/conv.c b/fs/9p/conv.c
index 55ccfa10ee9e..32a9f99154e2 100644
--- a/fs/9p/conv.c
+++ b/fs/9p/conv.c
@@ -56,7 +56,7 @@ static inline int buf_check_overflow(struct cbuf *buf)
56 return buf->p > buf->ep; 56 return buf->p > buf->ep;
57} 57}
58 58
59static inline int buf_check_size(struct cbuf *buf, int len) 59static int buf_check_size(struct cbuf *buf, int len)
60{ 60{
61 if (buf->p + len > buf->ep) { 61 if (buf->p + len > buf->ep) {
62 if (buf->p < buf->ep) { 62 if (buf->p < buf->ep) {
@@ -72,7 +72,7 @@ static inline int buf_check_size(struct cbuf *buf, int len)
72 return 1; 72 return 1;
73} 73}
74 74
75static inline void *buf_alloc(struct cbuf *buf, int len) 75static void *buf_alloc(struct cbuf *buf, int len)
76{ 76{
77 void *ret = NULL; 77 void *ret = NULL;
78 78
@@ -84,7 +84,7 @@ static inline void *buf_alloc(struct cbuf *buf, int len)
84 return ret; 84 return ret;
85} 85}
86 86
87static inline void buf_put_int8(struct cbuf *buf, u8 val) 87static void buf_put_int8(struct cbuf *buf, u8 val)
88{ 88{
89 if (buf_check_size(buf, 1)) { 89 if (buf_check_size(buf, 1)) {
90 buf->p[0] = val; 90 buf->p[0] = val;
@@ -92,7 +92,7 @@ static inline void buf_put_int8(struct cbuf *buf, u8 val)
92 } 92 }
93} 93}
94 94
95static inline void buf_put_int16(struct cbuf *buf, u16 val) 95static void buf_put_int16(struct cbuf *buf, u16 val)
96{ 96{
97 if (buf_check_size(buf, 2)) { 97 if (buf_check_size(buf, 2)) {
98 *(__le16 *) buf->p = cpu_to_le16(val); 98 *(__le16 *) buf->p = cpu_to_le16(val);
@@ -100,7 +100,7 @@ static inline void buf_put_int16(struct cbuf *buf, u16 val)
100 } 100 }
101} 101}
102 102
103static inline void buf_put_int32(struct cbuf *buf, u32 val) 103static void buf_put_int32(struct cbuf *buf, u32 val)
104{ 104{
105 if (buf_check_size(buf, 4)) { 105 if (buf_check_size(buf, 4)) {
106 *(__le32 *)buf->p = cpu_to_le32(val); 106 *(__le32 *)buf->p = cpu_to_le32(val);
@@ -108,7 +108,7 @@ static inline void buf_put_int32(struct cbuf *buf, u32 val)
108 } 108 }
109} 109}
110 110
111static inline void buf_put_int64(struct cbuf *buf, u64 val) 111static void buf_put_int64(struct cbuf *buf, u64 val)
112{ 112{
113 if (buf_check_size(buf, 8)) { 113 if (buf_check_size(buf, 8)) {
114 *(__le64 *)buf->p = cpu_to_le64(val); 114 *(__le64 *)buf->p = cpu_to_le64(val);
@@ -116,7 +116,7 @@ static inline void buf_put_int64(struct cbuf *buf, u64 val)
116 } 116 }
117} 117}
118 118
119static inline void buf_put_stringn(struct cbuf *buf, const char *s, u16 slen) 119static void buf_put_stringn(struct cbuf *buf, const char *s, u16 slen)
120{ 120{
121 if (buf_check_size(buf, slen + 2)) { 121 if (buf_check_size(buf, slen + 2)) {
122 buf_put_int16(buf, slen); 122 buf_put_int16(buf, slen);
@@ -130,7 +130,7 @@ static inline void buf_put_string(struct cbuf *buf, const char *s)
130 buf_put_stringn(buf, s, strlen(s)); 130 buf_put_stringn(buf, s, strlen(s));
131} 131}
132 132
133static inline u8 buf_get_int8(struct cbuf *buf) 133static u8 buf_get_int8(struct cbuf *buf)
134{ 134{
135 u8 ret = 0; 135 u8 ret = 0;
136 136
@@ -142,7 +142,7 @@ static inline u8 buf_get_int8(struct cbuf *buf)
142 return ret; 142 return ret;
143} 143}
144 144
145static inline u16 buf_get_int16(struct cbuf *buf) 145static u16 buf_get_int16(struct cbuf *buf)
146{ 146{
147 u16 ret = 0; 147 u16 ret = 0;
148 148
@@ -154,7 +154,7 @@ static inline u16 buf_get_int16(struct cbuf *buf)
154 return ret; 154 return ret;
155} 155}
156 156
157static inline u32 buf_get_int32(struct cbuf *buf) 157static u32 buf_get_int32(struct cbuf *buf)
158{ 158{
159 u32 ret = 0; 159 u32 ret = 0;
160 160
@@ -166,7 +166,7 @@ static inline u32 buf_get_int32(struct cbuf *buf)
166 return ret; 166 return ret;
167} 167}
168 168
169static inline u64 buf_get_int64(struct cbuf *buf) 169static u64 buf_get_int64(struct cbuf *buf)
170{ 170{
171 u64 ret = 0; 171 u64 ret = 0;
172 172
@@ -178,7 +178,7 @@ static inline u64 buf_get_int64(struct cbuf *buf)
178 return ret; 178 return ret;
179} 179}
180 180
181static inline void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr) 181static void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr)
182{ 182{
183 vstr->len = buf_get_int16(buf); 183 vstr->len = buf_get_int16(buf);
184 if (!buf_check_overflow(buf) && buf_check_size(buf, vstr->len)) { 184 if (!buf_check_overflow(buf) && buf_check_size(buf, vstr->len)) {
@@ -190,7 +190,7 @@ static inline void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr)
190 } 190 }
191} 191}
192 192
193static inline void buf_get_qid(struct cbuf *bufp, struct v9fs_qid *qid) 193static void buf_get_qid(struct cbuf *bufp, struct v9fs_qid *qid)
194{ 194{
195 qid->type = buf_get_int8(bufp); 195 qid->type = buf_get_int8(bufp);
196 qid->version = buf_get_int32(bufp); 196 qid->version = buf_get_int32(bufp);
@@ -254,7 +254,7 @@ static int v9fs_size_wstat(struct v9fs_wstat *wstat, int extended)
254 * 254 *
255 */ 255 */
256 256
257static inline void 257static void
258buf_get_stat(struct cbuf *bufp, struct v9fs_stat *stat, int extended) 258buf_get_stat(struct cbuf *bufp, struct v9fs_stat *stat, int extended)
259{ 259{
260 stat->size = buf_get_int16(bufp); 260 stat->size = buf_get_int16(bufp);
@@ -427,7 +427,7 @@ static inline void v9fs_put_int64(struct cbuf *bufp, u64 val, u64 * p)
427 buf_put_int64(bufp, val); 427 buf_put_int64(bufp, val);
428} 428}
429 429
430static inline void 430static void
431v9fs_put_str(struct cbuf *bufp, char *data, struct v9fs_str *str) 431v9fs_put_str(struct cbuf *bufp, char *data, struct v9fs_str *str)
432{ 432{
433 if (data) { 433 if (data) {
@@ -441,7 +441,7 @@ v9fs_put_str(struct cbuf *bufp, char *data, struct v9fs_str *str)
441 buf_put_stringn(bufp, data, str->len); 441 buf_put_stringn(bufp, data, str->len);
442} 442}
443 443
444static inline int 444static int
445v9fs_put_user_data(struct cbuf *bufp, const char __user * data, int count, 445v9fs_put_user_data(struct cbuf *bufp, const char __user * data, int count,
446 unsigned char **pdata) 446 unsigned char **pdata)
447{ 447{
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index e93a7ae467c9..62d8d4acb8bb 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -195,6 +195,8 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
195 if (!empty) 195 if (!empty)
196 d_invalidate(dentry); 196 d_invalidate(dentry);
197 197
198 nd.dentry = dentry;
199 nd.mnt = mnt;
198 nd.flags = LOOKUP_DIRECTORY; 200 nd.flags = LOOKUP_DIRECTORY;
199 status = (dentry->d_op->d_revalidate)(dentry, &nd); 201 status = (dentry->d_op->d_revalidate)(dentry, &nd);
200 202
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index f979ebbce49c..1b117a441298 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1218,7 +1218,7 @@ static int writenote(struct memelfnote *men, struct file *file)
1218 if (!dump_seek(file, (off))) \ 1218 if (!dump_seek(file, (off))) \
1219 goto end_coredump; 1219 goto end_coredump;
1220 1220
1221static inline void fill_elf_header(struct elfhdr *elf, int segs) 1221static void fill_elf_header(struct elfhdr *elf, int segs)
1222{ 1222{
1223 memcpy(elf->e_ident, ELFMAG, SELFMAG); 1223 memcpy(elf->e_ident, ELFMAG, SELFMAG);
1224 elf->e_ident[EI_CLASS] = ELF_CLASS; 1224 elf->e_ident[EI_CLASS] = ELF_CLASS;
@@ -1243,7 +1243,7 @@ static inline void fill_elf_header(struct elfhdr *elf, int segs)
1243 return; 1243 return;
1244} 1244}
1245 1245
1246static inline void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, off_t offset) 1246static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, off_t offset)
1247{ 1247{
1248 phdr->p_type = PT_NOTE; 1248 phdr->p_type = PT_NOTE;
1249 phdr->p_offset = offset; 1249 phdr->p_offset = offset;
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 9ccc7d8275b8..6a7b730c206b 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -264,7 +264,7 @@ static int unquote(char *from)
264 return p - from; 264 return p - from;
265} 265}
266 266
267static inline char * check_special_flags (char * sfs, Node * e) 267static char * check_special_flags (char * sfs, Node * e)
268{ 268{
269 char * p = sfs; 269 char * p = sfs;
270 int cont = 1; 270 int cont = 1;
diff --git a/fs/bio.c b/fs/bio.c
index 7b3069589951..bbc442b8c867 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -123,7 +123,7 @@ static void bio_fs_destructor(struct bio *bio)
123 bio_free(bio, fs_bio_set); 123 bio_free(bio, fs_bio_set);
124} 124}
125 125
126inline void bio_init(struct bio *bio) 126void bio_init(struct bio *bio)
127{ 127{
128 bio->bi_next = NULL; 128 bio->bi_next = NULL;
129 bio->bi_bdev = NULL; 129 bio->bi_bdev = NULL;
@@ -253,7 +253,7 @@ inline int bio_hw_segments(request_queue_t *q, struct bio *bio)
253 * the actual data it points to. Reference count of returned 253 * the actual data it points to. Reference count of returned
254 * bio will be one. 254 * bio will be one.
255 */ 255 */
256inline void __bio_clone(struct bio *bio, struct bio *bio_src) 256void __bio_clone(struct bio *bio, struct bio *bio_src)
257{ 257{
258 request_queue_t *q = bdev_get_queue(bio_src->bi_bdev); 258 request_queue_t *q = bdev_get_queue(bio_src->bi_bdev);
259 259
diff --git a/fs/buffer.c b/fs/buffer.c
index b9bb7ad6897b..7cdf48a9a501 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1165,7 +1165,7 @@ failed:
1165 * some of those buffers may be aliases of filesystem data. 1165 * some of those buffers may be aliases of filesystem data.
1166 * grow_dev_page() will go BUG() if this happens. 1166 * grow_dev_page() will go BUG() if this happens.
1167 */ 1167 */
1168static inline int 1168static int
1169grow_buffers(struct block_device *bdev, sector_t block, int size) 1169grow_buffers(struct block_device *bdev, sector_t block, int size)
1170{ 1170{
1171 struct page *page; 1171 struct page *page;
@@ -1391,7 +1391,7 @@ static void bh_lru_install(struct buffer_head *bh)
1391/* 1391/*
1392 * Look up the bh in this cpu's LRU. If it's there, move it to the head. 1392 * Look up the bh in this cpu's LRU. If it's there, move it to the head.
1393 */ 1393 */
1394static inline struct buffer_head * 1394static struct buffer_head *
1395lookup_bh_lru(struct block_device *bdev, sector_t block, int size) 1395lookup_bh_lru(struct block_device *bdev, sector_t block, int size)
1396{ 1396{
1397 struct buffer_head *ret = NULL; 1397 struct buffer_head *ret = NULL;
@@ -1541,7 +1541,7 @@ EXPORT_SYMBOL(set_bh_page);
1541/* 1541/*
1542 * Called when truncating a buffer on a page completely. 1542 * Called when truncating a buffer on a page completely.
1543 */ 1543 */
1544static inline void discard_buffer(struct buffer_head * bh) 1544static void discard_buffer(struct buffer_head * bh)
1545{ 1545{
1546 lock_buffer(bh); 1546 lock_buffer(bh);
1547 clear_buffer_dirty(bh); 1547 clear_buffer_dirty(bh);
diff --git a/fs/char_dev.c b/fs/char_dev.c
index 3b1b1eefdbb0..21195c481637 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -35,7 +35,7 @@ static struct char_device_struct {
35 unsigned int major; 35 unsigned int major;
36 unsigned int baseminor; 36 unsigned int baseminor;
37 int minorct; 37 int minorct;
38 const char *name; 38 char name[64];
39 struct file_operations *fops; 39 struct file_operations *fops;
40 struct cdev *cdev; /* will die */ 40 struct cdev *cdev; /* will die */
41} *chrdevs[MAX_PROBE_HASH]; 41} *chrdevs[MAX_PROBE_HASH];
@@ -46,34 +46,84 @@ static inline int major_to_index(int major)
46 return major % MAX_PROBE_HASH; 46 return major % MAX_PROBE_HASH;
47} 47}
48 48
49/* get char device names in somewhat random order */ 49struct chrdev_info {
50int get_chrdev_list(char *page) 50 int index;
51{
52 struct char_device_struct *cd; 51 struct char_device_struct *cd;
53 int i, len; 52};
54 53
55 len = sprintf(page, "Character devices:\n"); 54void *get_next_chrdev(void *dev)
55{
56 struct chrdev_info *info;
56 57
58 if (dev == NULL) {
59 info = kmalloc(sizeof(*info), GFP_KERNEL);
60 if (!info)
61 goto out;
62 info->index=0;
63 info->cd = chrdevs[info->index];
64 if (info->cd)
65 goto out;
66 } else {
67 info = dev;
68 }
69
70 while (info->index < ARRAY_SIZE(chrdevs)) {
71 if (info->cd)
72 info->cd = info->cd->next;
73 if (info->cd)
74 goto out;
75 /*
76 * No devices on this chain, move to the next
77 */
78 info->index++;
79 info->cd = (info->index < ARRAY_SIZE(chrdevs)) ?
80 chrdevs[info->index] : NULL;
81 if (info->cd)
82 goto out;
83 }
84
85out:
86 return info;
87}
88
89void *acquire_chrdev_list(void)
90{
57 down(&chrdevs_lock); 91 down(&chrdevs_lock);
92 return get_next_chrdev(NULL);
93}
94
95void release_chrdev_list(void *dev)
96{
97 up(&chrdevs_lock);
98 kfree(dev);
99}
100
101
102int count_chrdev_list(void)
103{
104 struct char_device_struct *cd;
105 int i, count;
106
107 count = 0;
108
58 for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) { 109 for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) {
59 for (cd = chrdevs[i]; cd; cd = cd->next) { 110 for (cd = chrdevs[i]; cd; cd = cd->next)
60 /* 111 count++;
61 * if the current name, plus the 5 extra characters
62 * in the device line for this entry
63 * would run us off the page, we're done
64 */
65 if ((len+strlen(cd->name) + 5) >= PAGE_SIZE)
66 goto page_full;
67
68
69 len += sprintf(page+len, "%3d %s\n",
70 cd->major, cd->name);
71 }
72 } 112 }
73page_full:
74 up(&chrdevs_lock);
75 113
76 return len; 114 return count;
115}
116
117int get_chrdev_info(void *dev, int *major, char **name)
118{
119 struct chrdev_info *info = dev;
120
121 if (info->cd == NULL)
122 return 1;
123
124 *major = info->cd->major;
125 *name = info->cd->name;
126 return 0;
77} 127}
78 128
79/* 129/*
@@ -121,7 +171,7 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
121 cd->major = major; 171 cd->major = major;
122 cd->baseminor = baseminor; 172 cd->baseminor = baseminor;
123 cd->minorct = minorct; 173 cd->minorct = minorct;
124 cd->name = name; 174 strncpy(cd->name,name, 64);
125 175
126 i = major_to_index(major); 176 i = major_to_index(major);
127 177
diff --git a/fs/compat.c b/fs/compat.c
index 271b75d1597f..2468ac1df2f0 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1537,7 +1537,7 @@ out_ret:
1537 * Ooo, nasty. We need here to frob 32-bit unsigned longs to 1537 * Ooo, nasty. We need here to frob 32-bit unsigned longs to
1538 * 64-bit unsigned longs. 1538 * 64-bit unsigned longs.
1539 */ 1539 */
1540static inline 1540static
1541int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, 1541int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
1542 unsigned long *fdset) 1542 unsigned long *fdset)
1543{ 1543{
@@ -1570,7 +1570,7 @@ int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
1570 return 0; 1570 return 0;
1571} 1571}
1572 1572
1573static inline 1573static
1574void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, 1574void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
1575 unsigned long *fdset) 1575 unsigned long *fdset)
1576{ 1576{
diff --git a/fs/dcache.c b/fs/dcache.c
index 134d6775183f..86bdb93789c6 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -94,7 +94,7 @@ static void d_free(struct dentry *dentry)
94 * d_iput() operation if defined. 94 * d_iput() operation if defined.
95 * Called with dcache_lock and per dentry lock held, drops both. 95 * Called with dcache_lock and per dentry lock held, drops both.
96 */ 96 */
97static inline void dentry_iput(struct dentry * dentry) 97static void dentry_iput(struct dentry * dentry)
98{ 98{
99 struct inode *inode = dentry->d_inode; 99 struct inode *inode = dentry->d_inode;
100 if (inode) { 100 if (inode) {
diff --git a/fs/exec.c b/fs/exec.c
index b5bcf1aae0ab..62b40af68cc4 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -575,7 +575,7 @@ static int exec_mmap(struct mm_struct *mm)
575 * disturbing other processes. (Other processes might share the signal 575 * disturbing other processes. (Other processes might share the signal
576 * table via the CLONE_SIGHAND option to clone().) 576 * table via the CLONE_SIGHAND option to clone().)
577 */ 577 */
578static inline int de_thread(struct task_struct *tsk) 578static int de_thread(struct task_struct *tsk)
579{ 579{
580 struct signal_struct *sig = tsk->signal; 580 struct signal_struct *sig = tsk->signal;
581 struct sighand_struct *newsighand, *oldsighand = tsk->sighand; 581 struct sighand_struct *newsighand, *oldsighand = tsk->sighand;
@@ -780,7 +780,7 @@ no_thread_group:
780 * so that a new one can be started 780 * so that a new one can be started
781 */ 781 */
782 782
783static inline void flush_old_files(struct files_struct * files) 783static void flush_old_files(struct files_struct * files)
784{ 784{
785 long j = -1; 785 long j = -1;
786 struct fdtable *fdt; 786 struct fdtable *fdt;
@@ -964,7 +964,7 @@ int prepare_binprm(struct linux_binprm *bprm)
964 964
965EXPORT_SYMBOL(prepare_binprm); 965EXPORT_SYMBOL(prepare_binprm);
966 966
967static inline int unsafe_exec(struct task_struct *p) 967static int unsafe_exec(struct task_struct *p)
968{ 968{
969 int unsafe = 0; 969 int unsafe = 0;
970 if (p->ptrace & PT_PTRACED) { 970 if (p->ptrace & PT_PTRACED) {
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index c5513953c825..ad1432a2a62e 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -83,10 +83,7 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str
83 if (!inode) 83 if (!inode)
84 return ERR_PTR(-EACCES); 84 return ERR_PTR(-EACCES);
85 } 85 }
86 if (inode) 86 return d_splice_alias(inode, dentry);
87 return d_splice_alias(inode, dentry);
88 d_add(dentry, inode);
89 return NULL;
90} 87}
91 88
92struct dentry *ext2_get_parent(struct dentry *child) 89struct dentry *ext2_get_parent(struct dentry *child)
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index af193a304ee5..8bd8ac077704 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1005,10 +1005,7 @@ static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, str
1005 if (!inode) 1005 if (!inode)
1006 return ERR_PTR(-EACCES); 1006 return ERR_PTR(-EACCES);
1007 } 1007 }
1008 if (inode) 1008 return d_splice_alias(inode, dentry);
1009 return d_splice_alias(inode, dentry);
1010 d_add(dentry, inode);
1011 return NULL;
1012} 1009}
1013 1010
1014 1011
diff --git a/fs/fcntl.c b/fs/fcntl.c
index d0767fe58362..5f96786d1c73 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -36,7 +36,7 @@ void fastcall set_close_on_exec(unsigned int fd, int flag)
36 spin_unlock(&files->file_lock); 36 spin_unlock(&files->file_lock);
37} 37}
38 38
39static inline int get_close_on_exec(unsigned int fd) 39static int get_close_on_exec(unsigned int fd)
40{ 40{
41 struct files_struct *files = current->files; 41 struct files_struct *files = current->files;
42 struct fdtable *fdt; 42 struct fdtable *fdt;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index ab4c3a9d51b8..f568102da1e8 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -402,7 +402,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
402 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; 402 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
403 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 403 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
404 info = HUGETLBFS_I(inode); 404 info = HUGETLBFS_I(inode);
405 mpol_shared_policy_init(&info->policy); 405 mpol_shared_policy_init(&info->policy, MPOL_DEFAULT, NULL);
406 switch (mode & S_IFMT) { 406 switch (mode & S_IFMT) {
407 default: 407 default:
408 init_special_inode(inode, mode, dev); 408 init_special_inode(inode, mode, dev);
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index e37e82b7cbf0..e7ba0c30e071 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -185,8 +185,5 @@ struct dentry *isofs_lookup(struct inode * dir, struct dentry * dentry, struct n
185 } 185 }
186 } 186 }
187 unlock_kernel(); 187 unlock_kernel();
188 if (inode) 188 return d_splice_alias(inode, dentry);
189 return d_splice_alias(inode, dentry);
190 d_add(dentry, inode);
191 return NULL;
192} 189}
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c
index fff108bb118b..70f7a896c04a 100644
--- a/fs/jffs2/build.c
+++ b/fs/jffs2/build.c
@@ -47,7 +47,7 @@ next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c)
47 ic = next_inode(&i, ic, (c))) 47 ic = next_inode(&i, ic, (c)))
48 48
49 49
50static inline void jffs2_build_inode_pass1(struct jffs2_sb_info *c, 50static void jffs2_build_inode_pass1(struct jffs2_sb_info *c,
51 struct jffs2_inode_cache *ic) 51 struct jffs2_inode_cache *ic)
52{ 52{
53 struct jffs2_full_dirent *fd; 53 struct jffs2_full_dirent *fd;
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index c79eebb8ab32..b635e167a3fa 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -134,7 +134,7 @@ static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_
134/* 134/*
135 * Allocate and initializes a new fragment. 135 * Allocate and initializes a new fragment.
136 */ 136 */
137static inline struct jffs2_node_frag * new_fragment(struct jffs2_full_dnode *fn, uint32_t ofs, uint32_t size) 137static struct jffs2_node_frag * new_fragment(struct jffs2_full_dnode *fn, uint32_t ofs, uint32_t size)
138{ 138{
139 struct jffs2_node_frag *newfrag; 139 struct jffs2_node_frag *newfrag;
140 140
@@ -513,7 +513,7 @@ free_out:
513 * 513 *
514 * Checks the node if we are in the checking stage. 514 * Checks the node if we are in the checking stage.
515 */ 515 */
516static inline int check_node(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_tmp_dnode_info *tn) 516static int check_node(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_tmp_dnode_info *tn)
517{ 517{
518 int ret; 518 int ret;
519 519
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index f01e9c0d2677..200fbda2c6d1 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -44,7 +44,7 @@ loff_t_to_s32(loff_t offset)
44/* 44/*
45 * XDR functions for basic NLM types 45 * XDR functions for basic NLM types
46 */ 46 */
47static inline u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c) 47static u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c)
48{ 48{
49 unsigned int len; 49 unsigned int len;
50 50
@@ -79,7 +79,7 @@ nlm_encode_cookie(u32 *p, struct nlm_cookie *c)
79 return p; 79 return p;
80} 80}
81 81
82static inline u32 * 82static u32 *
83nlm_decode_fh(u32 *p, struct nfs_fh *f) 83nlm_decode_fh(u32 *p, struct nfs_fh *f)
84{ 84{
85 unsigned int len; 85 unsigned int len;
@@ -119,7 +119,7 @@ nlm_encode_oh(u32 *p, struct xdr_netobj *oh)
119 return xdr_encode_netobj(p, oh); 119 return xdr_encode_netobj(p, oh);
120} 120}
121 121
122static inline u32 * 122static u32 *
123nlm_decode_lock(u32 *p, struct nlm_lock *lock) 123nlm_decode_lock(u32 *p, struct nlm_lock *lock)
124{ 124{
125 struct file_lock *fl = &lock->fl; 125 struct file_lock *fl = &lock->fl;
diff --git a/fs/mbcache.c b/fs/mbcache.c
index 0f1e4530670f..f5bbe4c97c58 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -126,7 +126,7 @@ __mb_cache_entry_is_hashed(struct mb_cache_entry *ce)
126} 126}
127 127
128 128
129static inline void 129static void
130__mb_cache_entry_unhash(struct mb_cache_entry *ce) 130__mb_cache_entry_unhash(struct mb_cache_entry *ce)
131{ 131{
132 int n; 132 int n;
@@ -139,7 +139,7 @@ __mb_cache_entry_unhash(struct mb_cache_entry *ce)
139} 139}
140 140
141 141
142static inline void 142static void
143__mb_cache_entry_forget(struct mb_cache_entry *ce, gfp_t gfp_mask) 143__mb_cache_entry_forget(struct mb_cache_entry *ce, gfp_t gfp_mask)
144{ 144{
145 struct mb_cache *cache = ce->e_cache; 145 struct mb_cache *cache = ce->e_cache;
@@ -158,7 +158,7 @@ __mb_cache_entry_forget(struct mb_cache_entry *ce, gfp_t gfp_mask)
158} 158}
159 159
160 160
161static inline void 161static void
162__mb_cache_entry_release_unlock(struct mb_cache_entry *ce) 162__mb_cache_entry_release_unlock(struct mb_cache_entry *ce)
163{ 163{
164 /* Wake up all processes queuing for this cache entry. */ 164 /* Wake up all processes queuing for this cache entry. */
diff --git a/fs/namei.c b/fs/namei.c
index 1e5746eb1380..33fb5bd34a81 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -113,7 +113,7 @@
113 * POSIX.1 2.4: an empty pathname is invalid (ENOENT). 113 * POSIX.1 2.4: an empty pathname is invalid (ENOENT).
114 * PATH_MAX includes the nul terminator --RR. 114 * PATH_MAX includes the nul terminator --RR.
115 */ 115 */
116static inline int do_getname(const char __user *filename, char *page) 116static int do_getname(const char __user *filename, char *page)
117{ 117{
118 int retval; 118 int retval;
119 unsigned long len = PATH_MAX; 119 unsigned long len = PATH_MAX;
@@ -396,7 +396,7 @@ static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name,
396 * short-cut DAC fails, then call permission() to do more 396 * short-cut DAC fails, then call permission() to do more
397 * complete permission check. 397 * complete permission check.
398 */ 398 */
399static inline int exec_permission_lite(struct inode *inode, 399static int exec_permission_lite(struct inode *inode,
400 struct nameidata *nd) 400 struct nameidata *nd)
401{ 401{
402 umode_t mode = inode->i_mode; 402 umode_t mode = inode->i_mode;
@@ -486,7 +486,7 @@ static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, s
486static int __emul_lookup_dentry(const char *, struct nameidata *); 486static int __emul_lookup_dentry(const char *, struct nameidata *);
487 487
488/* SMP-safe */ 488/* SMP-safe */
489static inline int 489static __always_inline int
490walk_init_root(const char *name, struct nameidata *nd) 490walk_init_root(const char *name, struct nameidata *nd)
491{ 491{
492 read_lock(&current->fs->lock); 492 read_lock(&current->fs->lock);
@@ -504,7 +504,7 @@ walk_init_root(const char *name, struct nameidata *nd)
504 return 1; 504 return 1;
505} 505}
506 506
507static inline int __vfs_follow_link(struct nameidata *nd, const char *link) 507static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *link)
508{ 508{
509 int res = 0; 509 int res = 0;
510 char *name; 510 char *name;
@@ -544,7 +544,7 @@ struct path {
544 struct dentry *dentry; 544 struct dentry *dentry;
545}; 545};
546 546
547static inline int __do_follow_link(struct path *path, struct nameidata *nd) 547static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd)
548{ 548{
549 int error; 549 int error;
550 void *cookie; 550 void *cookie;
@@ -690,7 +690,7 @@ int follow_down(struct vfsmount **mnt, struct dentry **dentry)
690 return 0; 690 return 0;
691} 691}
692 692
693static inline void follow_dotdot(struct nameidata *nd) 693static __always_inline void follow_dotdot(struct nameidata *nd)
694{ 694{
695 while(1) { 695 while(1) {
696 struct vfsmount *parent; 696 struct vfsmount *parent;
@@ -1294,7 +1294,7 @@ static inline int check_sticky(struct inode *dir, struct inode *inode)
1294 * 10. We don't allow removal of NFS sillyrenamed files; it's handled by 1294 * 10. We don't allow removal of NFS sillyrenamed files; it's handled by
1295 * nfs_async_unlink(). 1295 * nfs_async_unlink().
1296 */ 1296 */
1297static inline int may_delete(struct inode *dir,struct dentry *victim,int isdir) 1297static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
1298{ 1298{
1299 int error; 1299 int error;
1300 1300
@@ -2315,7 +2315,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2315 return error; 2315 return error;
2316} 2316}
2317 2317
2318static inline int do_rename(const char * oldname, const char * newname) 2318static int do_rename(const char * oldname, const char * newname)
2319{ 2319{
2320 int error = 0; 2320 int error = 0;
2321 struct dentry * old_dir, * new_dir; 2321 struct dentry * old_dir, * new_dir;
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 8c8839203cd5..d277a58bd128 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -716,10 +716,8 @@ static void ncp_put_super(struct super_block *sb)
716 fput(server->ncp_filp); 716 fput(server->ncp_filp);
717 kill_proc(server->m.wdog_pid, SIGTERM, 1); 717 kill_proc(server->m.wdog_pid, SIGTERM, 1);
718 718
719 if (server->priv.data) 719 kfree(server->priv.data);
720 ncp_kfree_s(server->priv.data, server->priv.len); 720 kfree(server->auth.object_name);
721 if (server->auth.object_name)
722 ncp_kfree_s(server->auth.object_name, server->auth.object_name_len);
723 vfree(server->packet); 721 vfree(server->packet);
724 sb->s_fs_info = NULL; 722 sb->s_fs_info = NULL;
725 kfree(server); 723 kfree(server);
@@ -958,11 +956,6 @@ out:
958 return result; 956 return result;
959} 957}
960 958
961#ifdef DEBUG_NCP_MALLOC
962int ncp_malloced;
963int ncp_current_malloced;
964#endif
965
966static struct super_block *ncp_get_sb(struct file_system_type *fs_type, 959static struct super_block *ncp_get_sb(struct file_system_type *fs_type,
967 int flags, const char *dev_name, void *data) 960 int flags, const char *dev_name, void *data)
968{ 961{
@@ -981,10 +974,6 @@ static int __init init_ncp_fs(void)
981 int err; 974 int err;
982 DPRINTK("ncpfs: init_module called\n"); 975 DPRINTK("ncpfs: init_module called\n");
983 976
984#ifdef DEBUG_NCP_MALLOC
985 ncp_malloced = 0;
986 ncp_current_malloced = 0;
987#endif
988 err = init_inodecache(); 977 err = init_inodecache();
989 if (err) 978 if (err)
990 goto out1; 979 goto out1;
@@ -1003,10 +992,6 @@ static void __exit exit_ncp_fs(void)
1003 DPRINTK("ncpfs: cleanup_module called\n"); 992 DPRINTK("ncpfs: cleanup_module called\n");
1004 unregister_filesystem(&ncp_fs_type); 993 unregister_filesystem(&ncp_fs_type);
1005 destroy_inodecache(); 994 destroy_inodecache();
1006#ifdef DEBUG_NCP_MALLOC
1007 PRINTK("ncp_malloced: %d\n", ncp_malloced);
1008 PRINTK("ncp_current_malloced: %d\n", ncp_current_malloced);
1009#endif
1010} 995}
1011 996
1012module_init(init_ncp_fs) 997module_init(init_ncp_fs)
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index d6e0c089e1b1..eb3813ad136f 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -518,10 +518,11 @@ outrel:
518 if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) 518 if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN)
519 return -ENOMEM; 519 return -ENOMEM;
520 if (user.object_name_len) { 520 if (user.object_name_len) {
521 newname = ncp_kmalloc(user.object_name_len, GFP_USER); 521 newname = kmalloc(user.object_name_len, GFP_USER);
522 if (!newname) return -ENOMEM; 522 if (!newname)
523 return -ENOMEM;
523 if (copy_from_user(newname, user.object_name, user.object_name_len)) { 524 if (copy_from_user(newname, user.object_name, user.object_name_len)) {
524 ncp_kfree_s(newname, user.object_name_len); 525 kfree(newname);
525 return -EFAULT; 526 return -EFAULT;
526 } 527 }
527 } else { 528 } else {
@@ -540,8 +541,8 @@ outrel:
540 server->priv.len = 0; 541 server->priv.len = 0;
541 server->priv.data = NULL; 542 server->priv.data = NULL;
542 /* leave critical section */ 543 /* leave critical section */
543 if (oldprivate) ncp_kfree_s(oldprivate, oldprivatelen); 544 kfree(oldprivate);
544 if (oldname) ncp_kfree_s(oldname, oldnamelen); 545 kfree(oldname);
545 return 0; 546 return 0;
546 } 547 }
547 case NCP_IOC_GETPRIVATEDATA: 548 case NCP_IOC_GETPRIVATEDATA:
@@ -581,10 +582,11 @@ outrel:
581 if (user.len > NCP_PRIVATE_DATA_MAX_LEN) 582 if (user.len > NCP_PRIVATE_DATA_MAX_LEN)
582 return -ENOMEM; 583 return -ENOMEM;
583 if (user.len) { 584 if (user.len) {
584 new = ncp_kmalloc(user.len, GFP_USER); 585 new = kmalloc(user.len, GFP_USER);
585 if (!new) return -ENOMEM; 586 if (!new)
587 return -ENOMEM;
586 if (copy_from_user(new, user.data, user.len)) { 588 if (copy_from_user(new, user.data, user.len)) {
587 ncp_kfree_s(new, user.len); 589 kfree(new);
588 return -EFAULT; 590 return -EFAULT;
589 } 591 }
590 } else { 592 } else {
@@ -596,7 +598,7 @@ outrel:
596 server->priv.len = user.len; 598 server->priv.len = user.len;
597 server->priv.data = new; 599 server->priv.data = new;
598 /* leave critical section */ 600 /* leave critical section */
599 if (old) ncp_kfree_s(old, oldlen); 601 kfree(old);
600 return 0; 602 return 0;
601 } 603 }
602 604
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index aa7bb41b293d..e3a0797dd56b 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -37,7 +37,7 @@ static u32 nfs_ftypes[] = {
37/* 37/*
38 * XDR functions for basic NFS types 38 * XDR functions for basic NFS types
39 */ 39 */
40static inline u32 * 40static u32 *
41decode_fh(u32 *p, struct svc_fh *fhp) 41decode_fh(u32 *p, struct svc_fh *fhp)
42{ 42{
43 fh_init(fhp, NFS_FHSIZE); 43 fh_init(fhp, NFS_FHSIZE);
@@ -151,7 +151,7 @@ decode_sattr(u32 *p, struct iattr *iap)
151 return p; 151 return p;
152} 152}
153 153
154static inline u32 * 154static u32 *
155encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, 155encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp,
156 struct kstat *stat) 156 struct kstat *stat)
157{ 157{
diff --git a/fs/pipe.c b/fs/pipe.c
index eef0f29e86ef..d722579df79a 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -50,7 +50,7 @@ void pipe_wait(struct inode * inode)
50 mutex_lock(PIPE_MUTEX(*inode)); 50 mutex_lock(PIPE_MUTEX(*inode));
51} 51}
52 52
53static inline int 53static int
54pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len) 54pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len)
55{ 55{
56 unsigned long copy; 56 unsigned long copy;
@@ -70,7 +70,7 @@ pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len)
70 return 0; 70 return 0;
71} 71}
72 72
73static inline int 73static int
74pipe_iov_copy_to_user(struct iovec *iov, const void *from, unsigned long len) 74pipe_iov_copy_to_user(struct iovec *iov, const void *from, unsigned long len)
75{ 75{
76 unsigned long copy; 76 unsigned long copy;
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c
index fb117b74809e..9bdd077d6f55 100644
--- a/fs/proc/proc_devtree.c
+++ b/fs/proc/proc_devtree.c
@@ -81,6 +81,30 @@ void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop
81 __proc_device_tree_add_prop(pde, prop); 81 __proc_device_tree_add_prop(pde, prop);
82} 82}
83 83
84void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
85 struct property *prop)
86{
87 remove_proc_entry(prop->name, pde);
88}
89
90void proc_device_tree_update_prop(struct proc_dir_entry *pde,
91 struct property *newprop,
92 struct property *oldprop)
93{
94 struct proc_dir_entry *ent;
95
96 for (ent = pde->subdir; ent != NULL; ent = ent->next)
97 if (ent->data == oldprop)
98 break;
99 if (ent == NULL) {
100 printk(KERN_WARNING "device-tree: property \"%s\" "
101 " does not exist\n", oldprop->name);
102 } else {
103 ent->data = newprop;
104 ent->size = newprop->length;
105 }
106}
107
84/* 108/*
85 * Process a node, adding entries for its children and its properties. 109 * Process a node, adding entries for its children and its properties.
86 */ 110 */
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 63bf6c00fa0c..8f8014285a34 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -20,6 +20,7 @@
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/kernel_stat.h> 22#include <linux/kernel_stat.h>
23#include <linux/fs.h>
23#include <linux/tty.h> 24#include <linux/tty.h>
24#include <linux/string.h> 25#include <linux/string.h>
25#include <linux/mman.h> 26#include <linux/mman.h>
@@ -62,7 +63,6 @@
62 */ 63 */
63extern int get_hardware_list(char *); 64extern int get_hardware_list(char *);
64extern int get_stram_list(char *); 65extern int get_stram_list(char *);
65extern int get_chrdev_list(char *);
66extern int get_filesystem_list(char *); 66extern int get_filesystem_list(char *);
67extern int get_exec_domain_list(char *); 67extern int get_exec_domain_list(char *);
68extern int get_dma_list(char *); 68extern int get_dma_list(char *);
@@ -248,6 +248,154 @@ static int cpuinfo_open(struct inode *inode, struct file *file)
248{ 248{
249 return seq_open(file, &cpuinfo_op); 249 return seq_open(file, &cpuinfo_op);
250} 250}
251
252enum devinfo_states {
253 CHR_HDR,
254 CHR_LIST,
255 BLK_HDR,
256 BLK_LIST,
257 DEVINFO_DONE
258};
259
260struct devinfo_state {
261 void *chrdev;
262 void *blkdev;
263 unsigned int num_records;
264 unsigned int cur_record;
265 enum devinfo_states state;
266};
267
268static void *devinfo_start(struct seq_file *f, loff_t *pos)
269{
270 struct devinfo_state *info = f->private;
271
272 if (*pos) {
273 if ((info) && (*pos <= info->num_records))
274 return info;
275 return NULL;
276 }
277 info = kmalloc(sizeof(*info), GFP_KERNEL);
278 f->private = info;
279 info->chrdev = acquire_chrdev_list();
280 info->blkdev = acquire_blkdev_list();
281 info->state = CHR_HDR;
282 info->num_records = count_chrdev_list();
283 info->num_records += count_blkdev_list();
284 info->num_records += 2; /* Character and Block headers */
285 *pos = 1;
286 info->cur_record = *pos;
287 return info;
288}
289
290static void *devinfo_next(struct seq_file *f, void *v, loff_t *pos)
291{
292 int idummy;
293 char *ndummy;
294 struct devinfo_state *info = f->private;
295
296 switch (info->state) {
297 case CHR_HDR:
298 info->state = CHR_LIST;
299 (*pos)++;
300 /*fallthrough*/
301 case CHR_LIST:
302 if (get_chrdev_info(info->chrdev,&idummy,&ndummy)) {
303 /*
304 * The character dev list is complete
305 */
306 info->state = BLK_HDR;
307 } else {
308 info->chrdev = get_next_chrdev(info->chrdev);
309 }
310 (*pos)++;
311 break;
312 case BLK_HDR:
313 info->state = BLK_LIST;
314 (*pos)++;
315 break;
316 case BLK_LIST:
317 if (get_blkdev_info(info->blkdev,&idummy,&ndummy)) {
318 /*
319 * The block dev list is complete
320 */
321 info->state = DEVINFO_DONE;
322 } else {
323 info->blkdev = get_next_blkdev(info->blkdev);
324 }
325 (*pos)++;
326 break;
327 case DEVINFO_DONE:
328 (*pos)++;
329 info->cur_record = *pos;
330 info = NULL;
331 break;
332 default:
333 break;
334 }
335 if (info)
336 info->cur_record = *pos;
337 return info;
338}
339
340static void devinfo_stop(struct seq_file *f, void *v)
341{
342 struct devinfo_state *info = f->private;
343
344 if (info) {
345 release_chrdev_list(info->chrdev);
346 release_blkdev_list(info->blkdev);
347 f->private = NULL;
348 kfree(info);
349 }
350}
351
352static int devinfo_show(struct seq_file *f, void *arg)
353{
354 int major;
355 char *name;
356 struct devinfo_state *info = f->private;
357
358 switch(info->state) {
359 case CHR_HDR:
360 seq_printf(f,"Character devices:\n");
361 /* fallthrough */
362 case CHR_LIST:
363 if (!get_chrdev_info(info->chrdev,&major,&name))
364 seq_printf(f,"%3d %s\n",major,name);
365 break;
366 case BLK_HDR:
367 seq_printf(f,"\nBlock devices:\n");
368 /* fallthrough */
369 case BLK_LIST:
370 if (!get_blkdev_info(info->blkdev,&major,&name))
371 seq_printf(f,"%3d %s\n",major,name);
372 break;
373 default:
374 break;
375 }
376
377 return 0;
378}
379
380static struct seq_operations devinfo_op = {
381 .start = devinfo_start,
382 .next = devinfo_next,
383 .stop = devinfo_stop,
384 .show = devinfo_show,
385};
386
387static int devinfo_open(struct inode *inode, struct file *file)
388{
389 return seq_open(file, &devinfo_op);
390}
391
392static struct file_operations proc_devinfo_operations = {
393 .open = devinfo_open,
394 .read = seq_read,
395 .llseek = seq_lseek,
396 .release = seq_release,
397};
398
251static struct file_operations proc_cpuinfo_operations = { 399static struct file_operations proc_cpuinfo_operations = {
252 .open = cpuinfo_open, 400 .open = cpuinfo_open,
253 .read = seq_read, 401 .read = seq_read,
@@ -450,14 +598,6 @@ static struct file_operations proc_stat_operations = {
450 .release = single_release, 598 .release = single_release,
451}; 599};
452 600
453static int devices_read_proc(char *page, char **start, off_t off,
454 int count, int *eof, void *data)
455{
456 int len = get_chrdev_list(page);
457 len += get_blkdev_list(page+len, len);
458 return proc_calc_metrics(page, start, off, count, eof, len);
459}
460
461/* 601/*
462 * /proc/interrupts 602 * /proc/interrupts
463 */ 603 */
@@ -582,7 +722,6 @@ void __init proc_misc_init(void)
582#ifdef CONFIG_STRAM_PROC 722#ifdef CONFIG_STRAM_PROC
583 {"stram", stram_read_proc}, 723 {"stram", stram_read_proc},
584#endif 724#endif
585 {"devices", devices_read_proc},
586 {"filesystems", filesystems_read_proc}, 725 {"filesystems", filesystems_read_proc},
587 {"cmdline", cmdline_read_proc}, 726 {"cmdline", cmdline_read_proc},
588 {"locks", locks_read_proc}, 727 {"locks", locks_read_proc},
@@ -598,6 +737,7 @@ void __init proc_misc_init(void)
598 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); 737 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
599 if (entry) 738 if (entry)
600 entry->proc_fops = &proc_kmsg_operations; 739 entry->proc_fops = &proc_kmsg_operations;
740 create_seq_entry("devices", 0, &proc_devinfo_operations);
601 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); 741 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
602 create_seq_entry("partitions", 0, &proc_partitions_operations); 742 create_seq_entry("partitions", 0, &proc_partitions_operations);
603 create_seq_entry("stat", 0, &proc_stat_operations); 743 create_seq_entry("stat", 0, &proc_stat_operations);
diff --git a/fs/quota_v2.c b/fs/quota_v2.c
index 7afcbb1b9376..a4ef91bb4f3b 100644
--- a/fs/quota_v2.c
+++ b/fs/quota_v2.c
@@ -35,7 +35,8 @@ static int v2_check_quota_file(struct super_block *sb, int type)
35 35
36 size = sb->s_op->quota_read(sb, type, (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0); 36 size = sb->s_op->quota_read(sb, type, (char *)&dqhead, sizeof(struct v2_disk_dqheader), 0);
37 if (size != sizeof(struct v2_disk_dqheader)) { 37 if (size != sizeof(struct v2_disk_dqheader)) {
38 printk("failed read\n"); 38 printk("quota_v2: failed read expected=%d got=%d\n",
39 sizeof(struct v2_disk_dqheader), size);
39 return 0; 40 return 0;
40 } 41 }
41 if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type] || 42 if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type] ||
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 3549067c42d9..8f8d8d01107c 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -375,11 +375,7 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
375 return ERR_PTR(-EIO); 375 return ERR_PTR(-EIO);
376 } 376 }
377 377
378 if (inode) 378 return d_splice_alias(inode, dentry);
379 return d_splice_alias(inode, dentry);
380
381 d_add(dentry, inode);
382 return NULL;
383} 379}
384 380
385/* 381/*
diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile
index 93246b7dd6fb..6673ee82cb4c 100644
--- a/fs/smbfs/Makefile
+++ b/fs/smbfs/Makefile
@@ -13,7 +13,6 @@ smbfs-objs := proc.o dir.o cache.o sock.o inode.o file.o ioctl.o getopt.o \
13EXTRA_CFLAGS += -DSMBFS_PARANOIA 13EXTRA_CFLAGS += -DSMBFS_PARANOIA
14#EXTRA_CFLAGS += -DSMBFS_DEBUG 14#EXTRA_CFLAGS += -DSMBFS_DEBUG
15#EXTRA_CFLAGS += -DSMBFS_DEBUG_VERBOSE 15#EXTRA_CFLAGS += -DSMBFS_DEBUG_VERBOSE
16#EXTRA_CFLAGS += -DDEBUG_SMB_MALLOC
17#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP 16#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP
18#EXTRA_CFLAGS += -Werror 17#EXTRA_CFLAGS += -Werror
19 18
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c
index 6ec88bf59b2d..02e3e82d465c 100644
--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -487,11 +487,11 @@ smb_put_super(struct super_block *sb)
487 if (server->conn_pid) 487 if (server->conn_pid)
488 kill_proc(server->conn_pid, SIGTERM, 1); 488 kill_proc(server->conn_pid, SIGTERM, 1);
489 489
490 smb_kfree(server->ops); 490 kfree(server->ops);
491 smb_unload_nls(server); 491 smb_unload_nls(server);
492 sb->s_fs_info = NULL; 492 sb->s_fs_info = NULL;
493 smb_unlock_server(server); 493 smb_unlock_server(server);
494 smb_kfree(server); 494 kfree(server);
495} 495}
496 496
497static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) 497static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
@@ -519,11 +519,10 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
519 sb->s_op = &smb_sops; 519 sb->s_op = &smb_sops;
520 sb->s_time_gran = 100; 520 sb->s_time_gran = 100;
521 521
522 server = smb_kmalloc(sizeof(struct smb_sb_info), GFP_KERNEL); 522 server = kzalloc(sizeof(struct smb_sb_info), GFP_KERNEL);
523 if (!server) 523 if (!server)
524 goto out_no_server; 524 goto out_no_server;
525 sb->s_fs_info = server; 525 sb->s_fs_info = server;
526 memset(server, 0, sizeof(struct smb_sb_info));
527 526
528 server->super_block = sb; 527 server->super_block = sb;
529 server->mnt = NULL; 528 server->mnt = NULL;
@@ -542,8 +541,8 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
542 /* FIXME: move these to the smb_sb_info struct */ 541 /* FIXME: move these to the smb_sb_info struct */
543 VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) + 542 VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) +
544 sizeof(struct smb_mount_data_kernel)); 543 sizeof(struct smb_mount_data_kernel));
545 mem = smb_kmalloc(sizeof(struct smb_ops) + 544 mem = kmalloc(sizeof(struct smb_ops) +
546 sizeof(struct smb_mount_data_kernel), GFP_KERNEL); 545 sizeof(struct smb_mount_data_kernel), GFP_KERNEL);
547 if (!mem) 546 if (!mem)
548 goto out_no_mem; 547 goto out_no_mem;
549 548
@@ -621,12 +620,12 @@ out_no_root:
621out_no_smbiod: 620out_no_smbiod:
622 smb_unload_nls(server); 621 smb_unload_nls(server);
623out_bad_option: 622out_bad_option:
624 smb_kfree(mem); 623 kfree(mem);
625out_no_mem: 624out_no_mem:
626 if (!server->mnt) 625 if (!server->mnt)
627 printk(KERN_ERR "smb_fill_super: allocation failure\n"); 626 printk(KERN_ERR "smb_fill_super: allocation failure\n");
628 sb->s_fs_info = NULL; 627 sb->s_fs_info = NULL;
629 smb_kfree(server); 628 kfree(server);
630 goto out_fail; 629 goto out_fail;
631out_wrong_data: 630out_wrong_data:
632 printk(KERN_ERR "smbfs: mount_data version %d is not supported\n", ver); 631 printk(KERN_ERR "smbfs: mount_data version %d is not supported\n", ver);
@@ -782,12 +781,6 @@ out:
782 return error; 781 return error;
783} 782}
784 783
785#ifdef DEBUG_SMB_MALLOC
786int smb_malloced;
787int smb_current_kmalloced;
788int smb_current_vmalloced;
789#endif
790
791static struct super_block *smb_get_sb(struct file_system_type *fs_type, 784static struct super_block *smb_get_sb(struct file_system_type *fs_type,
792 int flags, const char *dev_name, void *data) 785 int flags, const char *dev_name, void *data)
793{ 786{
@@ -807,12 +800,6 @@ static int __init init_smb_fs(void)
807 int err; 800 int err;
808 DEBUG1("registering ...\n"); 801 DEBUG1("registering ...\n");
809 802
810#ifdef DEBUG_SMB_MALLOC
811 smb_malloced = 0;
812 smb_current_kmalloced = 0;
813 smb_current_vmalloced = 0;
814#endif
815
816 err = init_inodecache(); 803 err = init_inodecache();
817 if (err) 804 if (err)
818 goto out_inode; 805 goto out_inode;
@@ -837,11 +824,6 @@ static void __exit exit_smb_fs(void)
837 unregister_filesystem(&smb_fs_type); 824 unregister_filesystem(&smb_fs_type);
838 smb_destroy_request_cache(); 825 smb_destroy_request_cache();
839 destroy_inodecache(); 826 destroy_inodecache();
840#ifdef DEBUG_SMB_MALLOC
841 printk(KERN_DEBUG "smb_malloced: %d\n", smb_malloced);
842 printk(KERN_DEBUG "smb_current_kmalloced: %d\n",smb_current_kmalloced);
843 printk(KERN_DEBUG "smb_current_vmalloced: %d\n",smb_current_vmalloced);
844#endif
845} 827}
846 828
847module_init(init_smb_fs) 829module_init(init_smb_fs)
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c
index a0f296d9928a..c71c375863cc 100644
--- a/fs/smbfs/request.c
+++ b/fs/smbfs/request.c
@@ -68,7 +68,7 @@ static struct smb_request *smb_do_alloc_request(struct smb_sb_info *server,
68 goto out; 68 goto out;
69 69
70 if (bufsize > 0) { 70 if (bufsize > 0) {
71 buf = smb_kmalloc(bufsize, GFP_NOFS); 71 buf = kmalloc(bufsize, GFP_NOFS);
72 if (!buf) { 72 if (!buf) {
73 kmem_cache_free(req_cachep, req); 73 kmem_cache_free(req_cachep, req);
74 return NULL; 74 return NULL;
@@ -124,9 +124,8 @@ static void smb_free_request(struct smb_request *req)
124{ 124{
125 atomic_dec(&req->rq_server->nr_requests); 125 atomic_dec(&req->rq_server->nr_requests);
126 if (req->rq_buffer && !(req->rq_flags & SMB_REQ_STATIC)) 126 if (req->rq_buffer && !(req->rq_flags & SMB_REQ_STATIC))
127 smb_kfree(req->rq_buffer); 127 kfree(req->rq_buffer);
128 if (req->rq_trans2buffer) 128 kfree(req->rq_trans2buffer);
129 smb_kfree(req->rq_trans2buffer);
130 kmem_cache_free(req_cachep, req); 129 kmem_cache_free(req_cachep, req);
131} 130}
132 131
@@ -183,8 +182,7 @@ static int smb_setup_request(struct smb_request *req)
183 req->rq_err = 0; 182 req->rq_err = 0;
184 req->rq_errno = 0; 183 req->rq_errno = 0;
185 req->rq_fragment = 0; 184 req->rq_fragment = 0;
186 if (req->rq_trans2buffer) 185 kfree(req->rq_trans2buffer);
187 smb_kfree(req->rq_trans2buffer);
188 186
189 return 0; 187 return 0;
190} 188}
@@ -647,10 +645,9 @@ static int smb_recv_trans2(struct smb_sb_info *server, struct smb_request *req)
647 goto out_too_long; 645 goto out_too_long;
648 646
649 req->rq_trans2bufsize = buf_len; 647 req->rq_trans2bufsize = buf_len;
650 req->rq_trans2buffer = smb_kmalloc(buf_len, GFP_NOFS); 648 req->rq_trans2buffer = kzalloc(buf_len, GFP_NOFS);
651 if (!req->rq_trans2buffer) 649 if (!req->rq_trans2buffer)
652 goto out_no_mem; 650 goto out_no_mem;
653 memset(req->rq_trans2buffer, 0, buf_len);
654 651
655 req->rq_parm = req->rq_trans2buffer; 652 req->rq_parm = req->rq_trans2buffer;
656 req->rq_data = req->rq_trans2buffer + parm_tot; 653 req->rq_data = req->rq_trans2buffer + parm_tot;
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index a9f4421ddb6f..3ada9dcf55b8 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -49,7 +49,7 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
49 49
50 sb = inode->i_sb; 50 sb = inode->i_sb;
51 uspi = UFS_SB(sb)->s_uspi; 51 uspi = UFS_SB(sb)->s_uspi;
52 usb1 = ubh_get_usb_first(USPI_UBH); 52 usb1 = ubh_get_usb_first(uspi);
53 53
54 UFSD(("ENTER, fragment %u, count %u\n", fragment, count)) 54 UFSD(("ENTER, fragment %u, count %u\n", fragment, count))
55 55
@@ -81,8 +81,9 @@ void ufs_free_fragments (struct inode * inode, unsigned fragment, unsigned count
81 for (i = bit; i < end_bit; i++) { 81 for (i = bit; i < end_bit; i++) {
82 if (ubh_isclr (UCPI_UBH, ucpi->c_freeoff, i)) 82 if (ubh_isclr (UCPI_UBH, ucpi->c_freeoff, i))
83 ubh_setbit (UCPI_UBH, ucpi->c_freeoff, i); 83 ubh_setbit (UCPI_UBH, ucpi->c_freeoff, i);
84 else ufs_error (sb, "ufs_free_fragments", 84 else
85 "bit already cleared for fragment %u", i); 85 ufs_error (sb, "ufs_free_fragments",
86 "bit already cleared for fragment %u", i);
86 } 87 }
87 88
88 DQUOT_FREE_BLOCK (inode, count); 89 DQUOT_FREE_BLOCK (inode, count);
@@ -143,7 +144,7 @@ void ufs_free_blocks (struct inode * inode, unsigned fragment, unsigned count) {
143 144
144 sb = inode->i_sb; 145 sb = inode->i_sb;
145 uspi = UFS_SB(sb)->s_uspi; 146 uspi = UFS_SB(sb)->s_uspi;
146 usb1 = ubh_get_usb_first(USPI_UBH); 147 usb1 = ubh_get_usb_first(uspi);
147 148
148 UFSD(("ENTER, fragment %u, count %u\n", fragment, count)) 149 UFSD(("ENTER, fragment %u, count %u\n", fragment, count))
149 150
@@ -247,7 +248,7 @@ unsigned ufs_new_fragments (struct inode * inode, __fs32 * p, unsigned fragment,
247 248
248 sb = inode->i_sb; 249 sb = inode->i_sb;
249 uspi = UFS_SB(sb)->s_uspi; 250 uspi = UFS_SB(sb)->s_uspi;
250 usb1 = ubh_get_usb_first(USPI_UBH); 251 usb1 = ubh_get_usb_first(uspi);
251 *err = -ENOSPC; 252 *err = -ENOSPC;
252 253
253 lock_super (sb); 254 lock_super (sb);
@@ -407,7 +408,7 @@ ufs_add_fragments (struct inode * inode, unsigned fragment,
407 408
408 sb = inode->i_sb; 409 sb = inode->i_sb;
409 uspi = UFS_SB(sb)->s_uspi; 410 uspi = UFS_SB(sb)->s_uspi;
410 usb1 = ubh_get_usb_first (USPI_UBH); 411 usb1 = ubh_get_usb_first (uspi);
411 count = newcount - oldcount; 412 count = newcount - oldcount;
412 413
413 cgno = ufs_dtog(fragment); 414 cgno = ufs_dtog(fragment);
@@ -490,7 +491,7 @@ static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
490 491
491 sb = inode->i_sb; 492 sb = inode->i_sb;
492 uspi = UFS_SB(sb)->s_uspi; 493 uspi = UFS_SB(sb)->s_uspi;
493 usb1 = ubh_get_usb_first(USPI_UBH); 494 usb1 = ubh_get_usb_first(uspi);
494 oldcg = cgno; 495 oldcg = cgno;
495 496
496 /* 497 /*
@@ -606,7 +607,7 @@ static unsigned ufs_alloccg_block (struct inode * inode,
606 607
607 sb = inode->i_sb; 608 sb = inode->i_sb;
608 uspi = UFS_SB(sb)->s_uspi; 609 uspi = UFS_SB(sb)->s_uspi;
609 usb1 = ubh_get_usb_first(USPI_UBH); 610 usb1 = ubh_get_usb_first(uspi);
610 ucg = ubh_get_ucg(UCPI_UBH); 611 ucg = ubh_get_ucg(UCPI_UBH);
611 612
612 if (goal == 0) { 613 if (goal == 0) {
@@ -663,7 +664,7 @@ static unsigned ufs_bitmap_search (struct super_block * sb,
663 UFSD(("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count)) 664 UFSD(("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count))
664 665
665 uspi = UFS_SB(sb)->s_uspi; 666 uspi = UFS_SB(sb)->s_uspi;
666 usb1 = ubh_get_usb_first (USPI_UBH); 667 usb1 = ubh_get_usb_first (uspi);
667 ucg = ubh_get_ucg(UCPI_UBH); 668 ucg = ubh_get_ucg(UCPI_UBH);
668 669
669 if (goal) 670 if (goal)
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 0938945b9cbc..c7a47ed4f430 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -72,7 +72,7 @@ void ufs_free_inode (struct inode * inode)
72 72
73 sb = inode->i_sb; 73 sb = inode->i_sb;
74 uspi = UFS_SB(sb)->s_uspi; 74 uspi = UFS_SB(sb)->s_uspi;
75 usb1 = ubh_get_usb_first(USPI_UBH); 75 usb1 = ubh_get_usb_first(uspi);
76 76
77 ino = inode->i_ino; 77 ino = inode->i_ino;
78 78
@@ -167,7 +167,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
167 ufsi = UFS_I(inode); 167 ufsi = UFS_I(inode);
168 sbi = UFS_SB(sb); 168 sbi = UFS_SB(sb);
169 uspi = sbi->s_uspi; 169 uspi = sbi->s_uspi;
170 usb1 = ubh_get_usb_first(USPI_UBH); 170 usb1 = ubh_get_usb_first(uspi);
171 171
172 lock_super (sb); 172 lock_super (sb);
173 173
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 55f4aa16e3fc..e0c04e36a051 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -61,7 +61,7 @@ static int ufs_block_to_path(struct inode *inode, sector_t i_block, sector_t off
61 int n = 0; 61 int n = 0;
62 62
63 63
64 UFSD(("ptrs=uspi->s_apb = %d,double_blocks=%d \n",ptrs,double_blocks)); 64 UFSD(("ptrs=uspi->s_apb = %d,double_blocks=%ld \n",ptrs,double_blocks));
65 if (i_block < 0) { 65 if (i_block < 0) {
66 ufs_warning(inode->i_sb, "ufs_block_to_path", "block < 0"); 66 ufs_warning(inode->i_sb, "ufs_block_to_path", "block < 0");
67 } else if (i_block < direct_blocks) { 67 } else if (i_block < direct_blocks) {
@@ -104,7 +104,7 @@ u64 ufs_frag_map(struct inode *inode, sector_t frag)
104 unsigned flags = UFS_SB(sb)->s_flags; 104 unsigned flags = UFS_SB(sb)->s_flags;
105 u64 temp = 0L; 105 u64 temp = 0L;
106 106
107 UFSD((": frag = %lu depth = %d\n",frag,depth)); 107 UFSD((": frag = %llu depth = %d\n", (unsigned long long)frag, depth));
108 UFSD((": uspi->s_fpbshift = %d ,uspi->s_apbmask = %x, mask=%llx\n",uspi->s_fpbshift,uspi->s_apbmask,mask)); 108 UFSD((": uspi->s_fpbshift = %d ,uspi->s_apbmask = %x, mask=%llx\n",uspi->s_fpbshift,uspi->s_apbmask,mask));
109 109
110 if (depth == 0) 110 if (depth == 0)
@@ -365,9 +365,10 @@ repeat:
365 sync_dirty_buffer(bh); 365 sync_dirty_buffer(bh);
366 inode->i_ctime = CURRENT_TIME_SEC; 366 inode->i_ctime = CURRENT_TIME_SEC;
367 mark_inode_dirty(inode); 367 mark_inode_dirty(inode);
368 UFSD(("result %u\n", tmp + blockoff));
368out: 369out:
369 brelse (bh); 370 brelse (bh);
370 UFSD(("EXIT, result %u\n", tmp + blockoff)) 371 UFSD(("EXIT\n"));
371 return result; 372 return result;
372} 373}
373 374
@@ -386,7 +387,7 @@ static int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buf
386 387
387 if (!create) { 388 if (!create) {
388 phys64 = ufs_frag_map(inode, fragment); 389 phys64 = ufs_frag_map(inode, fragment);
389 UFSD(("phys64 = %lu \n",phys64)); 390 UFSD(("phys64 = %llu \n",phys64));
390 if (phys64) 391 if (phys64)
391 map_bh(bh_result, sb, phys64); 392 map_bh(bh_result, sb, phys64);
392 return 0; 393 return 0;
@@ -401,7 +402,7 @@ static int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buf
401 402
402 lock_kernel(); 403 lock_kernel();
403 404
404 UFSD(("ENTER, ino %lu, fragment %u\n", inode->i_ino, fragment)) 405 UFSD(("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment))
405 if (fragment < 0) 406 if (fragment < 0)
406 goto abort_negative; 407 goto abort_negative;
407 if (fragment > 408 if (fragment >
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index e9a42c711a9e..d4aacee593ff 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -221,7 +221,7 @@ void ufs_error (struct super_block * sb, const char * function,
221 va_list args; 221 va_list args;
222 222
223 uspi = UFS_SB(sb)->s_uspi; 223 uspi = UFS_SB(sb)->s_uspi;
224 usb1 = ubh_get_usb_first(USPI_UBH); 224 usb1 = ubh_get_usb_first(uspi);
225 225
226 if (!(sb->s_flags & MS_RDONLY)) { 226 if (!(sb->s_flags & MS_RDONLY)) {
227 usb1->fs_clean = UFS_FSBAD; 227 usb1->fs_clean = UFS_FSBAD;
@@ -253,7 +253,7 @@ void ufs_panic (struct super_block * sb, const char * function,
253 va_list args; 253 va_list args;
254 254
255 uspi = UFS_SB(sb)->s_uspi; 255 uspi = UFS_SB(sb)->s_uspi;
256 usb1 = ubh_get_usb_first(USPI_UBH); 256 usb1 = ubh_get_usb_first(uspi);
257 257
258 if (!(sb->s_flags & MS_RDONLY)) { 258 if (!(sb->s_flags & MS_RDONLY)) {
259 usb1->fs_clean = UFS_FSBAD; 259 usb1->fs_clean = UFS_FSBAD;
@@ -420,21 +420,18 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
420 if (i + uspi->s_fpb > blks) 420 if (i + uspi->s_fpb > blks)
421 size = (blks - i) * uspi->s_fsize; 421 size = (blks - i) * uspi->s_fsize;
422 422
423 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { 423 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
424 ubh = ubh_bread(sb, 424 ubh = ubh_bread(sb,
425 fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_csaddr) + i, size); 425 fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_csaddr) + i, size);
426 if (!ubh) 426 else
427 goto failed;
428 ubh_ubhcpymem (space, ubh, size);
429 sbi->s_csp[ufs_fragstoblks(i)]=(struct ufs_csum *)space;
430 }
431 else {
432 ubh = ubh_bread(sb, uspi->s_csaddr + i, size); 427 ubh = ubh_bread(sb, uspi->s_csaddr + i, size);
433 if (!ubh) 428
434 goto failed; 429 if (!ubh)
435 ubh_ubhcpymem(space, ubh, size); 430 goto failed;
436 sbi->s_csp[ufs_fragstoblks(i)]=(struct ufs_csum *)space; 431
437 } 432 ubh_ubhcpymem (space, ubh, size);
433 sbi->s_csp[ufs_fragstoblks(i)]=(struct ufs_csum *)space;
434
438 space += size; 435 space += size;
439 ubh_brelse (ubh); 436 ubh_brelse (ubh);
440 ubh = NULL; 437 ubh = NULL;
@@ -539,6 +536,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
539 struct inode *inode; 536 struct inode *inode;
540 unsigned block_size, super_block_size; 537 unsigned block_size, super_block_size;
541 unsigned flags; 538 unsigned flags;
539 unsigned super_block_offset;
542 540
543 uspi = NULL; 541 uspi = NULL;
544 ubh = NULL; 542 ubh = NULL;
@@ -586,10 +584,11 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
586 if (!uspi) 584 if (!uspi)
587 goto failed; 585 goto failed;
588 586
587 super_block_offset=UFS_SBLOCK;
588
589 /* Keep 2Gig file limit. Some UFS variants need to override 589 /* Keep 2Gig file limit. Some UFS variants need to override
590 this but as I don't know which I'll let those in the know loosen 590 this but as I don't know which I'll let those in the know loosen
591 the rules */ 591 the rules */
592
593 switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) { 592 switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) {
594 case UFS_MOUNT_UFSTYPE_44BSD: 593 case UFS_MOUNT_UFSTYPE_44BSD:
595 UFSD(("ufstype=44bsd\n")) 594 UFSD(("ufstype=44bsd\n"))
@@ -601,7 +600,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
601 flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD; 600 flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD;
602 break; 601 break;
603 case UFS_MOUNT_UFSTYPE_UFS2: 602 case UFS_MOUNT_UFSTYPE_UFS2:
604 UFSD(("ufstype=ufs2\n")) 603 UFSD(("ufstype=ufs2\n"));
604 super_block_offset=SBLOCK_UFS2;
605 uspi->s_fsize = block_size = 512; 605 uspi->s_fsize = block_size = 512;
606 uspi->s_fmask = ~(512 - 1); 606 uspi->s_fmask = ~(512 - 1);
607 uspi->s_fshift = 9; 607 uspi->s_fshift = 9;
@@ -725,19 +725,16 @@ again:
725 /* 725 /*
726 * read ufs super block from device 726 * read ufs super block from device
727 */ 727 */
728 if ( (flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { 728
729 ubh = ubh_bread_uspi(uspi, sb, uspi->s_sbbase + SBLOCK_UFS2/block_size, super_block_size); 729 ubh = ubh_bread_uspi(uspi, sb, uspi->s_sbbase + super_block_offset/block_size, super_block_size);
730 } 730
731 else {
732 ubh = ubh_bread_uspi(uspi, sb, uspi->s_sbbase + UFS_SBLOCK/block_size, super_block_size);
733 }
734 if (!ubh) 731 if (!ubh)
735 goto failed; 732 goto failed;
736 733
737 734
738 usb1 = ubh_get_usb_first(USPI_UBH); 735 usb1 = ubh_get_usb_first(uspi);
739 usb2 = ubh_get_usb_second(USPI_UBH); 736 usb2 = ubh_get_usb_second(uspi);
740 usb3 = ubh_get_usb_third(USPI_UBH); 737 usb3 = ubh_get_usb_third(uspi);
741 usb = (struct ufs_super_block *) 738 usb = (struct ufs_super_block *)
742 ((struct ufs_buffer_head *)uspi)->bh[0]->b_data ; 739 ((struct ufs_buffer_head *)uspi)->bh[0]->b_data ;
743 740
@@ -1006,8 +1003,8 @@ static void ufs_write_super (struct super_block *sb) {
1006 UFSD(("ENTER\n")) 1003 UFSD(("ENTER\n"))
1007 flags = UFS_SB(sb)->s_flags; 1004 flags = UFS_SB(sb)->s_flags;
1008 uspi = UFS_SB(sb)->s_uspi; 1005 uspi = UFS_SB(sb)->s_uspi;
1009 usb1 = ubh_get_usb_first(USPI_UBH); 1006 usb1 = ubh_get_usb_first(uspi);
1010 usb3 = ubh_get_usb_third(USPI_UBH); 1007 usb3 = ubh_get_usb_third(uspi);
1011 1008
1012 if (!(sb->s_flags & MS_RDONLY)) { 1009 if (!(sb->s_flags & MS_RDONLY)) {
1013 usb1->fs_time = cpu_to_fs32(sb, get_seconds()); 1010 usb1->fs_time = cpu_to_fs32(sb, get_seconds());
@@ -1049,8 +1046,8 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1049 1046
1050 uspi = UFS_SB(sb)->s_uspi; 1047 uspi = UFS_SB(sb)->s_uspi;
1051 flags = UFS_SB(sb)->s_flags; 1048 flags = UFS_SB(sb)->s_flags;
1052 usb1 = ubh_get_usb_first(USPI_UBH); 1049 usb1 = ubh_get_usb_first(uspi);
1053 usb3 = ubh_get_usb_third(USPI_UBH); 1050 usb3 = ubh_get_usb_third(uspi);
1054 1051
1055 /* 1052 /*
1056 * Allow the "check" option to be passed as a remount option. 1053 * Allow the "check" option to be passed as a remount option.
@@ -1124,7 +1121,7 @@ static int ufs_statfs (struct super_block *sb, struct kstatfs *buf)
1124 lock_kernel(); 1121 lock_kernel();
1125 1122
1126 uspi = UFS_SB(sb)->s_uspi; 1123 uspi = UFS_SB(sb)->s_uspi;
1127 usb1 = ubh_get_usb_first (USPI_UBH); 1124 usb1 = ubh_get_usb_first (uspi);
1128 usb = (struct ufs_super_block *) 1125 usb = (struct ufs_super_block *)
1129 ((struct ufs_buffer_head *)uspi)->bh[0]->b_data ; 1126 ((struct ufs_buffer_head *)uspi)->bh[0]->b_data ;
1130 1127
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index b2640076679a..48d6d9bcc157 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -249,18 +249,28 @@ extern void _ubh_memcpyubh_(struct ufs_sb_private_info *, struct ufs_buffer_head
249 249
250 250
251/* 251/*
252 * macros to get important structures from ufs_buffer_head 252 * macros and inline function to get important structures from ufs_sb_private_info
253 */ 253 */
254#define ubh_get_usb_first(ubh) \
255 ((struct ufs_super_block_first *)((ubh)->bh[0]->b_data))
256 254
257#define ubh_get_usb_second(ubh) \ 255static inline void *get_usb_offset(struct ufs_sb_private_info *uspi,
258 ((struct ufs_super_block_second *)(ubh)-> \ 256 unsigned int offset)
259 bh[UFS_SECTOR_SIZE >> uspi->s_fshift]->b_data + (UFS_SECTOR_SIZE & ~uspi->s_fmask)) 257{
258 unsigned int index;
259
260 index = offset >> uspi->s_fshift;
261 offset &= ~uspi->s_fmask;
262 return uspi->s_ubh.bh[index]->b_data + offset;
263}
264
265#define ubh_get_usb_first(uspi) \
266 ((struct ufs_super_block_first *)get_usb_offset((uspi), 0))
267
268#define ubh_get_usb_second(uspi) \
269 ((struct ufs_super_block_second *)get_usb_offset((uspi), UFS_SECTOR_SIZE))
270
271#define ubh_get_usb_third(uspi) \
272 ((struct ufs_super_block_third *)get_usb_offset((uspi), 2*UFS_SECTOR_SIZE))
260 273
261#define ubh_get_usb_third(ubh) \
262 ((struct ufs_super_block_third *)((ubh)-> \
263 bh[UFS_SECTOR_SIZE*2 >> uspi->s_fshift]->b_data + (UFS_SECTOR_SIZE*2 & ~uspi->s_fmask)))
264 274
265#define ubh_get_ucg(ubh) \ 275#define ubh_get_ucg(ubh) \
266 ((struct ufs_cylinder_group *)((ubh)->bh[0]->b_data)) 276 ((struct ufs_cylinder_group *)((ubh)->bh[0]->b_data))