summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:10:26 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:10:26 -0800
commitbb5b6e6c4dea4242f6ff75fa7adecea4f34935f1 (patch)
treedbdda6fdd7f0bfadb4c10a997bfb15660f3223c0 /fs
parent0b9ded43ee424791d9283cee2a33dcb4a97da57d (diff)
v2.4.8.4 -> v2.4.9
- David Miller: sparc updates, FAT fs fixes, btaudio build fix - David Gibson: Orinoco driver update - Kevin Fleming: more disks the HPT controller doesn't like - David Miller: "min()/max()" cleanups. Understands signs and sizes. - Ben LaHaise: make vma merging more generous, help Mozilla /proc/<>/maps - Jens Axboe: CD updates - Trond Myklebust: save away NFS credentials in inode, so that mmap can writeout. - Mark Hemment: HIGHMEM ops cleanups - Jes Sorensen: use "unsigned long" for flags in various drivers
Diffstat (limited to 'fs')
-rw-r--r--fs/buffer.c26
-rw-r--r--fs/coda/upcall.c31
-rw-r--r--fs/fat/cache.c2
-rw-r--r--fs/fat/dir.c2
-rw-r--r--fs/jffs/inode-v23.c13
-rw-r--r--fs/jffs/intrep.c29
-rw-r--r--fs/jffs/intrep.h2
-rw-r--r--fs/ncpfs/file.c15
-rw-r--r--fs/ncpfs/mmap.c7
-rw-r--r--fs/ncpfs/ncplib_kernel.c10
-rw-r--r--fs/ncpfs/ncpsign_kernel.c4
-rw-r--r--fs/nfs/file.c10
-rw-r--r--fs/nfs/inode.c38
-rw-r--r--fs/nfs/unlink.c2
-rw-r--r--fs/nfs/write.c22
-rw-r--r--fs/ntfs/attr.c16
-rw-r--r--fs/ntfs/fs.c6
-rw-r--r--fs/ntfs/inode.c6
-rw-r--r--fs/ntfs/macros.h6
-rw-r--r--fs/ntfs/support.c2
-rw-r--r--fs/ntfs/unistr.c2
-rw-r--r--fs/romfs/inode.c17
-rw-r--r--fs/ufs/balloc.c6
-rw-r--r--fs/ufs/truncate.c2
-rw-r--r--fs/ufs/util.c12
-rw-r--r--fs/ufs/util.h9
26 files changed, 139 insertions, 158 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 55c416e8a63c..3a5b99524225 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -794,6 +794,17 @@ void set_blocksize(kdev_t dev, int size)
goto retry;
}
+static void free_more_memory(void)
+{
+ balance_dirty(NODEV);
+ page_launder(GFP_NOFS, 0);
+ wakeup_bdflush();
+ wakeup_kswapd();
+ current->policy |= SCHED_YIELD;
+ __set_current_state(TASK_RUNNING);
+ schedule();
+}
+
/*
* We used to try various strange things. Let's not.
* We'll just try to balance dirty buffers, and possibly
@@ -802,15 +813,8 @@ void set_blocksize(kdev_t dev, int size)
*/
static void refill_freelist(int size)
{
- if (!grow_buffers(size)) {
- balance_dirty(NODEV);
- page_launder(GFP_NOFS, 0);
- wakeup_bdflush();
- wakeup_kswapd();
- current->policy |= SCHED_YIELD;
- __set_current_state(TASK_RUNNING);
- schedule();
- }
+ if (!grow_buffers(size))
+ free_more_memory();
}
void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
@@ -1408,9 +1412,7 @@ no_grow:
*/
run_task_queue(&tq_disk);
- current->policy |= SCHED_YIELD;
- __set_current_state(TASK_RUNNING);
- schedule();
+ free_more_memory();
goto try_again;
}
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index 7c8afc26dc92..dac80dc811cd 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -69,17 +69,9 @@ do {\
outsize = insize; \
} while (0)
-static inline int max(int a, int b)
-{
- if ( a > b )
- return a;
- else
- return b;
-}
-
#define INSIZE(tag) sizeof(struct coda_ ## tag ## _in)
#define OUTSIZE(tag) sizeof(struct coda_ ## tag ## _out)
-#define SIZE(tag) max(INSIZE(tag), OUTSIZE(tag))
+#define SIZE(tag) max(unsigned int, INSIZE(tag), OUTSIZE(tag))
/* the upcalls */
@@ -159,7 +151,7 @@ int venus_lookup(struct super_block *sb, struct ViceFid *fid,
int offset;
offset = INSIZE(lookup);
- insize = max(offset + length +1, OUTSIZE(lookup));
+ insize = max(unsigned int, offset + length +1, OUTSIZE(lookup));
UPARG(CODA_LOOKUP);
inp->coda_lookup.VFid = *fid;
@@ -275,7 +267,7 @@ int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid,
int offset;
offset = INSIZE(mkdir);
- insize = max(offset + length + 1, OUTSIZE(mkdir));
+ insize = max(unsigned int, offset + length + 1, OUTSIZE(mkdir));
UPARG(CODA_MKDIR);
inp->coda_mkdir.VFid = *dirfid;
@@ -306,7 +298,7 @@ int venus_rename(struct super_block *sb, struct ViceFid *old_fid,
int offset, s;
offset = INSIZE(rename);
- insize = max(offset + new_length + old_length + 8,
+ insize = max(unsigned int, offset + new_length + old_length + 8,
OUTSIZE(rename));
UPARG(CODA_RENAME);
@@ -344,7 +336,7 @@ int venus_create(struct super_block *sb, struct ViceFid *dirfid,
int offset;
offset = INSIZE(create);
- insize = max(offset + length + 1, OUTSIZE(create));
+ insize = max(unsigned int, offset + length + 1, OUTSIZE(create));
UPARG(CODA_CREATE);
inp->coda_create.VFid = *dirfid;
@@ -376,7 +368,7 @@ int venus_rmdir(struct super_block *sb, struct ViceFid *dirfid,
int offset;
offset = INSIZE(rmdir);
- insize = max(offset + length + 1, OUTSIZE(rmdir));
+ insize = max(unsigned int, offset + length + 1, OUTSIZE(rmdir));
UPARG(CODA_RMDIR);
inp->coda_rmdir.VFid = *dirfid;
@@ -398,7 +390,7 @@ int venus_remove(struct super_block *sb, struct ViceFid *dirfid,
int error=0, insize, outsize, offset;
offset = INSIZE(remove);
- insize = max(offset + length + 1, OUTSIZE(remove));
+ insize = max(unsigned int, offset + length + 1, OUTSIZE(remove));
UPARG(CODA_REMOVE);
inp->coda_remove.VFid = *dirfid;
@@ -421,7 +413,8 @@ int venus_readlink(struct super_block *sb, struct ViceFid *fid,
int retlen;
char *result;
- insize = max(INSIZE(readlink), OUTSIZE(readlink)+ *length + 1);
+ insize = max(unsigned int,
+ INSIZE(readlink), OUTSIZE(readlink)+ *length + 1);
UPARG(CODA_READLINK);
inp->coda_readlink.VFid = *fid;
@@ -455,7 +448,7 @@ int venus_link(struct super_block *sb, struct ViceFid *fid,
int offset;
offset = INSIZE(link);
- insize = max(offset + len + 1, OUTSIZE(link));
+ insize = max(unsigned int, offset + len + 1, OUTSIZE(link));
UPARG(CODA_LINK);
inp->coda_link.sourceFid = *fid;
@@ -484,7 +477,7 @@ int venus_symlink(struct super_block *sb, struct ViceFid *fid,
int offset, s;
offset = INSIZE(symlink);
- insize = max(offset + len + symlen + 8, OUTSIZE(symlink));
+ insize = max(unsigned int, offset + len + symlen + 8, OUTSIZE(symlink));
UPARG(CODA_SYMLINK);
/* inp->coda_symlink.attr = *tva; XXXXXX */
@@ -624,7 +617,7 @@ int venus_statfs(struct super_block *sb, struct statfs *sfs)
union outputArgs *outp;
int insize, outsize, error;
- insize = max(INSIZE(statfs), OUTSIZE(statfs));
+ insize = max(unsigned int, INSIZE(statfs), OUTSIZE(statfs));
UPARG(CODA_STATFS);
error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
diff --git a/fs/fat/cache.c b/fs/fat/cache.c
index 7240bc8a2e52..f5fea6704d6f 100644
--- a/fs/fat/cache.c
+++ b/fs/fat/cache.c
@@ -15,6 +15,8 @@
#include <linux/stat.h>
#include <linux/fat_cvf.h>
+#include "msbuffer.h"
+
#if 0
# define PRINTK(x) printk x
#else
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 7e83e79f777b..0b047c3bbe05 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -590,7 +590,7 @@ static int vfat_ioctl_fill(
void * buf,
const char * name,
int name_len,
- off_t offset,
+ loff_t offset,
ino_t ino,
unsigned int d_type)
{
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index 7ea3d4a10168..a480ab70b880 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -718,7 +718,7 @@ jffs_readpage(struct file *file, struct page *page)
offset = page->index << PAGE_CACHE_SHIFT;
if (offset < inode->i_size) {
- read_len = jffs_min(inode->i_size - offset, PAGE_SIZE);
+ read_len = min(long, inode->i_size - offset, PAGE_SIZE);
r = jffs_read_data(f, buf, offset, read_len);
if (r == read_len) {
if (read_len < PAGE_SIZE) {
@@ -1373,7 +1373,9 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
goto out_isem;
}
- thiscount = jffs_min(c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode), count);
+ thiscount = min(unsigned int,
+ c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode),
+ count);
if (!(vbuf = kmalloc(thiscount, GFP_KERNEL))) {
D(printk("jffs_file_write(): failed to allocate bounce buffer. Fix me to use page cache\n"));
@@ -1437,7 +1439,8 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
raw_inode.deleted = 0;
if (pos < f->size) {
- node->removed_size = raw_inode.rsize = jffs_min(thiscount, f->size - pos);
+ node->removed_size = raw_inode.rsize =
+ min(unsigned int, thiscount, f->size - pos);
/* If this node is going entirely over the top of old data,
we can allow it to go into the reserved space, because
@@ -1479,7 +1482,9 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
D3(printk("jffs_file_write(): new f_pos %ld.\n", (long)pos));
- thiscount = jffs_min(c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode), count);
+ thiscount = min(unsigned int,
+ c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode),
+ count);
}
out:
D3(printk (KERN_NOTICE "file_write(): up biglock\n"));
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c
index 62af52c92a8b..d8d3c9007795 100644
--- a/fs/jffs/intrep.c
+++ b/fs/jffs/intrep.c
@@ -292,21 +292,6 @@ flash_erase_region(struct mtd_info *mtd, loff_t start,
return 0;
}
-
-inline int
-jffs_min(int a, int b)
-{
- return (a < b ? a : b);
-}
-
-
-inline int
-jffs_max(int a, int b)
-{
- return (a > b ? a : b);
-}
-
-
/* This routine calculates checksums in JFFS. */
__u32
jffs_checksum(const void *data, int size)
@@ -1624,7 +1609,7 @@ jffs_get_node_data(struct jffs_file *f, struct jffs_node *node,
"version: %u, node_offset: %u\n",
f->name, node->ino, node->version, node_offset));
- r = jffs_min(avail, max_size);
+ r = min(u32, avail, max_size);
D3(printk(KERN_NOTICE "jffs_get_node_data\n"));
flash_safe_read(fmc->mtd, pos, buf, r);
@@ -1677,8 +1662,8 @@ jffs_read_data(struct jffs_file *f, unsigned char *buf, __u32 read_offset,
int r;
if (!node->fm) {
/* This node does not refer to real data. */
- r = jffs_min(size - read_data,
- node->data_size - node_offset);
+ r = min(u32, size - read_data,
+ node->data_size - node_offset);
memset(&buf[read_data], 0, r);
}
else if ((r = jffs_get_node_data(f, node, &buf[read_data],
@@ -1919,8 +1904,8 @@ jffs_delete_data(struct jffs_file *f, struct jffs_node *node)
else {
/* No. No need to split the node. Just remove
the end of the node. */
- int r = jffs_min(n->data_offset + n->data_size
- - offset, remove_size);
+ int r = min(u32, n->data_offset + n->data_size
+ - offset, remove_size);
n->data_size -= r;
remove_size -= r;
n = n->range_next;
@@ -2475,7 +2460,7 @@ jffs_rewrite_data(struct jffs_file *f, struct jffs_node *node, int size)
}
while (size) {
- __u32 s = jffs_min(size, PAGE_SIZE);
+ __u32 s = min(int, size, PAGE_SIZE);
if ((r = jffs_read_data(f, (char *)page,
offset, s)) < s) {
free_page((unsigned long)page);
@@ -2836,7 +2821,7 @@ jffs_try_to_erase(struct jffs_control *c)
printk("JFFS: Erase failed! pos = 0x%lx\n",
(long)pos);
jffs_hexdump(fmc->mtd, pos,
- jffs_min(256, end - pos));
+ min(u32, 256, end - pos));
err = -1;
break;
}
diff --git a/fs/jffs/intrep.h b/fs/jffs/intrep.h
index f10a994b4e06..64930d867efe 100644
--- a/fs/jffs/intrep.h
+++ b/fs/jffs/intrep.h
@@ -17,8 +17,6 @@
#ifndef __LINUX_JFFS_INTREP_H__
#define __LINUX_JFFS_INTREP_H__
#include "jffs_fm.h"
-inline int jffs_min(int a, int b);
-inline int jffs_max(int a, int b);
__u32 jffs_checksum(const void *data, int size);
void jffs_cleanup_control(struct jffs_control *c);
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index dd54dea04152..a72ed803d014 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -22,11 +22,6 @@
#include <linux/ncp_fs.h>
#include "ncplib_kernel.h"
-static inline unsigned int min(unsigned int a, unsigned int b)
-{
- return a < b ? a : b;
-}
-
static int ncp_fsync(struct file *file, struct dentry *dentry, int datasync)
{
return 0;
@@ -157,8 +152,9 @@ ncp_file_read(struct file *file, char *buf, size_t count, loff_t *ppos)
/* First read in as much as possible for each bufsize. */
while (already_read < count) {
int read_this_time;
- size_t to_read = min(bufsize - (pos % bufsize),
- count - already_read);
+ size_t to_read = min(unsigned int,
+ bufsize - (pos % bufsize),
+ count - already_read);
error = ncp_read_bounce(NCP_SERVER(inode),
NCP_FINFO(inode)->file_handle,
@@ -238,8 +234,9 @@ ncp_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
}
while (already_written < count) {
int written_this_time;
- size_t to_write = min(bufsize - (pos % bufsize),
- count - already_written);
+ size_t to_write = min(unsigned int,
+ bufsize - (pos % bufsize),
+ count - already_written);
if (copy_from_user(bouncebuffer, buf, to_write)) {
errno = -EFAULT;
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index ed4153dd61ca..ad74d57b8d0b 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -22,11 +22,6 @@
#include <asm/uaccess.h>
#include <asm/system.h>
-static inline int min(int a, int b)
-{
- return a < b ? a : b;
-}
-
/*
* Fill in the supplied page for mmap
*/
@@ -66,7 +61,7 @@ static struct page* ncp_file_mmap_nopage(struct vm_area_struct *area,
to_read = bufsize - (pos % bufsize);
- to_read = min(to_read, count - already_read);
+ to_read = min(unsigned int, to_read, count - already_read);
if (ncp_read_kernel(NCP_SERVER(inode),
NCP_FINFO(inode)->file_handle,
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c
index 6e09c8bf2613..3a0fd85d8f73 100644
--- a/fs/ncpfs/ncplib_kernel.c
+++ b/fs/ncpfs/ncplib_kernel.c
@@ -13,11 +13,6 @@
#include "ncplib_kernel.h"
-static inline int min(int a, int b)
-{
- return a < b ? a : b;
-}
-
static inline void assert_server_locked(struct ncp_server *server)
{
if (server->lock == 0) {
@@ -132,7 +127,7 @@ ncp_negotiate_buffersize(struct ncp_server *server, int size, int *target)
ncp_unlock_server(server);
return result;
}
- *target = min(ntohs(ncp_reply_word(server, 0)), size);
+ *target = min(unsigned int, ntohs(ncp_reply_word(server, 0)), size);
ncp_unlock_server(server);
return 0;
@@ -163,7 +158,8 @@ ncp_negotiate_size_and_options(struct ncp_server *server,
/* NCP over UDP returns 0 (!!!) */
result = ntohs(ncp_reply_word(server, 0));
- if (result >= NCP_BLOCK_SIZE) size=min(result, size);
+ if (result >= NCP_BLOCK_SIZE)
+ size = min(int, result, size);
*ret_size = size;
*ret_options = ncp_reply_byte(server, 4);
diff --git a/fs/ncpfs/ncpsign_kernel.c b/fs/ncpfs/ncpsign_kernel.c
index f945da65798a..ea8482611fcd 100644
--- a/fs/ncpfs/ncpsign_kernel.c
+++ b/fs/ncpfs/ncpsign_kernel.c
@@ -52,8 +52,6 @@ DSET_LH(__u8 * buf, int pos, __u32 val)
#define PUT_LE32(p,v) DSET_LH(p,0,v)
#endif
-#define min(a,b) ((a)<(b)?(a):(b))
-
static void nwsign(char *r_data1, char *r_data2, char *outdata) {
int i;
unsigned int w0,w1,w2,w3;
@@ -102,7 +100,7 @@ void sign_packet(struct ncp_server *server, int *size) {
memcpy(data,server->sign_root,8);
PUT_LE32(data+8,(*size));
memcpy(data+12,server->packet+sizeof(struct ncp_request_header)-1,
- min((*size)-sizeof(struct ncp_request_header)+1,52));
+ min(unsigned int,(*size)-sizeof(struct ncp_request_header)+1,52));
nwsign(server->sign_last,data,server->sign_last);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 66d102bae6de..92ed9fb5ebc6 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -39,7 +39,6 @@ static ssize_t nfs_file_read(struct file *, char *, size_t, loff_t *);
static ssize_t nfs_file_write(struct file *, const char *, size_t, loff_t *);
static int nfs_file_flush(struct file *);
static int nfs_fsync(struct file *, struct dentry *dentry, int datasync);
-static int nfs_file_release(struct inode *, struct file *);
struct file_operations nfs_file_operations = {
llseek: generic_file_llseek,
@@ -48,7 +47,7 @@ struct file_operations nfs_file_operations = {
mmap: nfs_file_mmap,
open: nfs_open,
flush: nfs_file_flush,
- release: nfs_file_release,
+ release: nfs_release,
fsync: nfs_fsync,
lock: nfs_lock,
};
@@ -89,13 +88,6 @@ nfs_file_flush(struct file *file)
return status;
}
-static int
-nfs_file_release(struct inode *inode, struct file *file)
-{
- filemap_fdatasync(inode->i_mapping);
- return nfs_release(inode,file);
-}
-
static ssize_t
nfs_file_read(struct file * file, char * buf, size_t count, loff_t *ppos)
{
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 2d79aefe1940..c48ebbc15c81 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -48,6 +48,7 @@ static void nfs_read_inode(struct inode *);
static void nfs_write_inode(struct inode *,int);
static void nfs_delete_inode(struct inode *);
static void nfs_put_super(struct super_block *);
+static void nfs_clear_inode(struct inode *);
static void nfs_umount_begin(struct super_block *);
static int nfs_statfs(struct super_block *, struct statfs *);
@@ -57,6 +58,7 @@ static struct super_operations nfs_sops = {
delete_inode: nfs_delete_inode,
put_super: nfs_put_super,
statfs: nfs_statfs,
+ clear_inode: nfs_clear_inode,
umount_begin: nfs_umount_begin,
};
@@ -141,6 +143,19 @@ nfs_delete_inode(struct inode * inode)
clear_inode(inode);
}
+/*
+ * For the moment, the only task for the NFS clear_inode method is to
+ * release the mmap credential
+ */
+static void
+nfs_clear_inode(struct inode *inode)
+{
+ struct rpc_cred *cred = NFS_I(inode)->mm_cred;
+
+ if (cred)
+ put_rpccred(cred);
+}
+
void
nfs_put_super(struct super_block *sb)
{
@@ -600,7 +615,6 @@ nfs_fill_inode(struct inode *inode, struct nfs_fh *fh, struct nfs_fattr *fattr)
inode->i_ctime = nfs_time_to_secs(fattr->ctime);
NFS_CACHE_CTIME(inode) = fattr->ctime;
NFS_CACHE_MTIME(inode) = fattr->mtime;
- NFS_CACHE_ATIME(inode) = fattr->atime;
NFS_CACHE_ISIZE(inode) = fattr->size;
NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
@@ -794,6 +808,21 @@ nfs_revalidate(struct dentry *dentry)
}
/*
+ * Ensure that mmap has a recent RPC credential for use when writing out
+ * shared pages
+ */
+static inline void
+nfs_set_mmcred(struct inode *inode, struct rpc_cred *cred)
+{
+ struct rpc_cred **p = &NFS_I(inode)->mm_cred,
+ *oldcred = *p;
+
+ *p = get_rpccred(cred);
+ if (oldcred)
+ put_rpccred(oldcred);
+}
+
+/*
* These are probably going to contain hooks for
* allocating and releasing RPC credentials for
* the file. I'll have to think about Tronds patch
@@ -808,20 +837,20 @@ int nfs_open(struct inode *inode, struct file *filp)
auth = NFS_CLIENT(inode)->cl_auth;
cred = rpcauth_lookupcred(auth, 0);
filp->private_data = cred;
+ if (filp->f_mode & FMODE_WRITE)
+ nfs_set_mmcred(inode, cred);
unlock_kernel();
return 0;
}
int nfs_release(struct inode *inode, struct file *filp)
{
- struct rpc_auth *auth;
struct rpc_cred *cred;
lock_kernel();
- auth = NFS_CLIENT(inode)->cl_auth;
cred = nfs_file_cred(filp);
if (cred)
- rpcauth_releasecred(auth, cred);
+ put_rpccred(cred);
unlock_kernel();
return 0;
}
@@ -976,7 +1005,6 @@ __nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
NFS_CACHE_CTIME(inode) = fattr->ctime;
inode->i_ctime = nfs_time_to_secs(fattr->ctime);
- NFS_CACHE_ATIME(inode) = fattr->atime;
inode->i_atime = nfs_time_to_secs(fattr->atime);
NFS_CACHE_MTIME(inode) = new_mtime;
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 51150971478c..800fc5767459 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -128,7 +128,7 @@ nfs_async_unlink_done(struct rpc_task *task)
dir_i = dir->d_inode;
nfs_zap_caches(dir_i);
NFS_PROTO(dir_i)->unlink_done(dir, &task->tk_msg);
- rpcauth_releasecred(task->tk_auth, data->cred);
+ put_rpccred(data->cred);
data->cred = NULL;
dput(dir);
}
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 3055940692ad..42f5f90677d9 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -181,7 +181,9 @@ nfs_writepage_sync(struct file *file, struct inode *inode, struct page *page,
if (file)
- cred = nfs_file_cred(file);
+ cred = get_rpccred(nfs_file_cred(file));
+ if (!cred)
+ cred = get_rpccred(NFS_I(inode)->mm_cred);
dprintk("NFS: nfs_writepage_sync(%x/%Ld %d@%Ld)\n",
inode->i_dev, (long long)NFS_FILEID(inode),
@@ -226,6 +228,8 @@ nfs_writepage_sync(struct file *file, struct inode *inode, struct page *page,
io_error:
kunmap(page);
+ if (cred)
+ put_rpccred(cred);
return written? written : result;
}
@@ -241,6 +245,9 @@ nfs_writepage_async(struct file *file, struct inode *inode, struct page *page,
status = (IS_ERR(req)) ? PTR_ERR(req) : 0;
if (status < 0)
goto out;
+ if (!req->wb_cred)
+ req->wb_cred = get_rpccred(NFS_I(inode)->mm_cred);
+ nfs_unlock_request(req);
nfs_release_request(req);
nfs_strategy(inode);
out:
@@ -557,13 +564,11 @@ struct nfs_page *nfs_create_request(struct file *file, struct inode *inode,
req->wb_bytes = count;
req->wb_file = file;
- /* If we have a struct file, use its cached credentials
- * else cache the current process' credentials. */
+ /* If we have a struct file, use its cached credentials */
if (file) {
get_file(file);
req->wb_cred = nfs_file_cred(file);
- } else
- req->wb_cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
+ }
req->wb_inode = inode;
req->wb_count = 1;
@@ -608,8 +613,8 @@ nfs_release_request(struct nfs_page *req)
/* Release struct file or cached credential */
if (req->wb_file)
fput(req->wb_file);
- else
- rpcauth_releasecred(NFS_CLIENT(inode)->cl_auth, req->wb_cred);
+ else if (req->wb_cred)
+ put_rpccred(req->wb_cred);
page_cache_release(page);
nfs_page_free(req);
/* wake up anyone waiting to allocate a request */
@@ -927,8 +932,6 @@ nfs_update_request(struct file* file, struct inode *inode, struct page *page,
if (end > rqend)
req->wb_bytes = end - req->wb_offset;
- nfs_unlock_request(req);
-
return req;
}
@@ -1049,6 +1052,7 @@ nfs_updatepage(struct file *file, struct page *page, unsigned int offset, unsign
goto done;
status = 0;
+ nfs_unlock_request(req);
/* If we wrote past the end of the page.
* Call the strategy routine so it can send out a bunch
* of requests.
diff --git a/fs/ntfs/attr.c b/fs/ntfs/attr.c
index 57be1396297f..80706fdf0d0e 100644
--- a/fs/ntfs/attr.c
+++ b/fs/ntfs/attr.c
@@ -148,7 +148,7 @@ int ntfs_new_attr(ntfs_inode *ino, int type, void *name, int namelen,
"attribute non-resident. Bug!\n");
return -EINVAL;
}
- m = memcmp(value, a->d.data, min(value_len, a->size));
+ m = memcmp(value, a->d.data, min(int, value_len, a->size));
if (m > 0)
continue;
if (m < 0) {
@@ -379,7 +379,7 @@ int ntfs_resize_attr(ntfs_inode *ino, ntfs_attribute *attr, __s64 newsize)
ntfs_bzero((char*)attr->d.data + oldsize,
newsize - oldsize);
ntfs_memcpy((char*)attr->d.data, v,
- min(newsize, oldsize));
+ min(s64, newsize, oldsize));
} else
attr->d.data = 0;
ntfs_free(v);
@@ -668,7 +668,7 @@ int ntfs_read_zero(ntfs_io *dest, int size)
if (!sparse)
return -ENOMEM;
while (size) {
- int i = min(size, 512);
+ int i = min(int, size, 512);
dest->fn_put(dest, sparse, i);
size -= i;
}
@@ -723,7 +723,7 @@ int ntfs_read_compressed(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
__s64 l1;
if ((len - (s_vcn - vcn)) & 15)
ntfs_error("Unexpected sparse chunk size.");
- l1 = chunk = min(((__s64)(vcn + len) << clustersizebits)
+ l1 = chunk = min(s64, ((__s64)(vcn + len) << clustersizebits)
- offset, l);
error = ntfs_read_zero(dest, l1);
if (error)
@@ -742,13 +742,13 @@ int ntfs_read_compressed(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
comp1 = comp;
do {
io.param = comp1;
- l1 = min(len - max(s_vcn - vcn, 0), 16 - got);
+ l1 = min(int, len - max(int, s_vcn - vcn, 0), 16 - got);
io.size = (__s64)l1 << clustersizebits;
error = ntfs_getput_clusters(ino->vol, cl1, 0,
&io);
if (error)
goto out;
- if (l1 + max(s_vcn - vcn, 0) == len) {
+ if (l1 + max(int, s_vcn - vcn, 0) == len) {
rnum++;
rl++;
vcn += len;
@@ -779,8 +779,8 @@ int ntfs_read_compressed(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
comp1 = decomp;
}
offs1 = offset - ((__s64)s_vcn << clustersizebits);
- chunk = min((16 << clustersizebits) - offs1, chunk);
- chunk = min(l, chunk);
+ chunk = min(s64, (16 << clustersizebits) - offs1, chunk);
+ chunk = min(s64, l, chunk);
dest->fn_put(dest, comp1 + offs1, chunk);
}
l -= chunk;
diff --git a/fs/ntfs/fs.c b/fs/ntfs/fs.c
index 5a618251951b..42659955ecdc 100644
--- a/fs/ntfs/fs.c
+++ b/fs/ntfs/fs.c
@@ -1048,12 +1048,12 @@ struct super_block * ntfs_read_super(struct super_block *sb, void *options,
set_blocksize(sb->s_dev, sb->s_blocksize);
ntfs_debug(DEBUG_OTHER, "set_blocksize\n");
/* Allocate an MFT record (MFT record can be smaller than a cluster). */
- if (!(vol->mft = ntfs_malloc(max(vol->mft_record_size,
- vol->cluster_size))))
+ if (!(vol->mft = ntfs_malloc(max(int, vol->mft_record_size,
+ vol->cluster_size))))
goto ntfs_read_super_unl;
/* Read at least the MFT record for $Mft. */
- for (i = 0; i < max(vol->mft_clusters_per_record, 1); i++) {
+ for (i = 0; i < max(int, vol->mft_clusters_per_record, 1); i++) {
if (!(bh = bread(sb->s_dev, vol->mft_lcn + i,
vol->cluster_size))) {
ntfs_error("Could not read $Mft record 0\n");
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 06ea87109e47..bf66e1eb969f 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -105,7 +105,7 @@ static int ntfs_extend_mft(ntfs_volume *vol)
* will fall back to the minimal size allocation below. (AIA) */
block = vol->mft_record_size;
blockbits = vol->mft_record_size_bits;
- size = max(size >> 10, mdata->size + vol->mft_record_size);
+ size = max(s64, size >> 10, mdata->size + vol->mft_record_size);
size = (__s64)((size + block - 1) >> blockbits) << blockbits;
/* Require this to be a single chunk. */
error = ntfs_extend_attr(vol->mft_ino, mdata, &size,
@@ -394,7 +394,7 @@ static void ntfs_load_attributes(ntfs_inode* ino)
io.fn_put = ntfs_put;
io.fn_get = 0;
io.param = buf + delta;
- io.size = len = min(datasize, 1024 - delta);
+ io.size = len = min(int, datasize, 1024 - delta);
ntfs_debug(DEBUG_FILE2, "load_attributes %x: len = %i\n",
ino->i_number, len);
ntfs_debug(DEBUG_FILE2, "load_attributes %x: delta = %i\n",
@@ -729,7 +729,7 @@ int ntfs_readwrite_attr(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
cluster = attr->d.r.runlist[rnum].cluster;
len = attr->d.r.runlist[rnum].len;
s_cluster = cluster + s_vcn - vcn;
- chunk = min(((__s64)(vcn + len) << clustersizebits) - offset,
+ chunk = min(s64, ((__s64)(vcn + len) << clustersizebits) - offset,
l);
dest->size = chunk;
error = ntfs_getput_clusters(ino->vol, s_cluster, offset -
diff --git a/fs/ntfs/macros.h b/fs/ntfs/macros.h
index 829da2579f1b..1210de524f47 100644
--- a/fs/ntfs/macros.h
+++ b/fs/ntfs/macros.h
@@ -11,12 +11,6 @@
#define NTFS_INO2VOL(ino) (&((ino)->i_sb->u.ntfs_sb))
#define NTFS_LINO2NINO(ino) (&((ino)->u.ntfs_i))
-/* Classical min and max macros still missing in standard headers... */
-#ifndef min
-#define min(a,b) ((a) <= (b) ? (a) : (b))
-#define max(a,b) ((a) >= (b) ? (a) : (b))
-#endif
-
#define IS_MAGIC(a,b) (*(int*)(a) == *(int*)(b))
#define IS_MFT_RECORD(a) IS_MAGIC((a),"FILE")
#define IS_INDEX_RECORD(a) IS_MAGIC((a),"INDX")
diff --git a/fs/ntfs/support.c b/fs/ntfs/support.c
index de4b82f81c02..962378b0832c 100644
--- a/fs/ntfs/support.c
+++ b/fs/ntfs/support.c
@@ -180,7 +180,7 @@ int ntfs_getput_clusters(ntfs_volume *vol, int cluster, ntfs_size_t start_offs,
error = -EIO;
goto error_ret;
}
- to_copy = min(vol->cluster_size - start_offs, length);
+ to_copy = min(unsigned int, vol->cluster_size - start_offs, length);
lock_buffer(bh);
if (buf->do_read) {
buf->fn_put(buf, bh->b_data + start_offs, to_copy);
diff --git a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c
index 5908765e9508..e9d5a9effdf3 100644
--- a/fs/ntfs/unistr.c
+++ b/fs/ntfs/unistr.c
@@ -96,7 +96,7 @@ int ntfs_collate_names(wchar_t *upcase, __u32 upcase_len,
__u32 cnt;
wchar_t c1, c2;
- for (cnt = 0; cnt < min(name1_len, name2_len); ++cnt)
+ for (cnt = 0; cnt < min(unsigned int, name1_len, name2_len); ++cnt)
{
c1 = le16_to_cpu(*name1++);
c2 = le16_to_cpu(*name2++);
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index df6eb974be06..41e1841d94ab 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -76,11 +76,6 @@
#include <asm/uaccess.h>
-static int inline min(int a, int b)
-{
- return a<b ? a : b;
-}
-
static __s32
romfs_checksum(void *data, int size)
{
@@ -129,7 +124,7 @@ romfs_read_super(struct super_block *s, void *data, int silent)
"%s.\n", kdevname(dev));
goto out;
}
- if (romfs_checksum(rsb, min(sz,512))) {
+ if (romfs_checksum(rsb, min(int, sz, 512))) {
printk ("romfs: bad initial checksum on dev "
"%s.\n", kdevname(dev));
goto out;
@@ -198,7 +193,7 @@ romfs_strnlen(struct inode *i, unsigned long offset, unsigned long count)
return -1; /* error */
avail = ROMBSIZE - (offset & ROMBMASK);
- maxsize = min(count, avail);
+ maxsize = min(unsigned long, count, avail);
res = strnlen(((char *)bh->b_data)+(offset&ROMBMASK), maxsize);
brelse(bh);
@@ -211,7 +206,7 @@ romfs_strnlen(struct inode *i, unsigned long offset, unsigned long count)
bh = bread(i->i_dev, offset>>ROMBSBITS, ROMBSIZE);
if (!bh)
return -1;
- maxsize = min(count-res, ROMBSIZE);
+ maxsize = min(unsigned long, count - res, ROMBSIZE);
avail = strnlen(bh->b_data, maxsize);
res += avail;
brelse(bh);
@@ -236,7 +231,7 @@ romfs_copyfrom(struct inode *i, void *dest, unsigned long offset, unsigned long
return -1; /* error */
avail = ROMBSIZE - (offset & ROMBMASK);
- maxsize = min(count, avail);
+ maxsize = min(unsigned long, count, avail);
memcpy(dest, ((char *)bh->b_data) + (offset & ROMBMASK), maxsize);
brelse(bh);
@@ -249,7 +244,7 @@ romfs_copyfrom(struct inode *i, void *dest, unsigned long offset, unsigned long
bh = bread(i->i_dev, offset>>ROMBSBITS, ROMBSIZE);
if (!bh)
return -1;
- maxsize = min(count-res, ROMBSIZE);
+ maxsize = min(unsigned long, count - res, ROMBSIZE);
memcpy(dest, bh->b_data, maxsize);
brelse(bh);
res += maxsize;
@@ -413,7 +408,7 @@ romfs_readpage(struct file *file, struct page * page)
offset = page->index << PAGE_CACHE_SHIFT;
if (offset < inode->i_size) {
avail = inode->i_size-offset;
- readlen = min(avail, PAGE_SIZE);
+ readlen = min(unsigned long, avail, PAGE_SIZE);
if (romfs_copyfrom(inode, buf, inode->u.romfs_i.i_dataoffset+offset, readlen) == readlen) {
if (readlen < PAGE_SIZE) {
memset(buf + readlen,0,PAGE_SIZE-readlen);
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index fa83ba5bee9a..9aa7a9f31fcf 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -312,7 +312,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment,
*p = SWAB32(result);
*err = 0;
inode->i_blocks += count << uspi->s_nspfshift;
- inode->u.ufs_i.i_lastfrag = max (inode->u.ufs_i.i_lastfrag, fragment + count);
+ inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
NULLIFY_FRAGMENTS
}
unlock_super(sb);
@@ -327,7 +327,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment,
if (result) {
*err = 0;
inode->i_blocks += count << uspi->s_nspfshift;
- inode->u.ufs_i.i_lastfrag = max (inode->u.ufs_i.i_lastfrag, fragment + count);
+ inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
NULLIFY_FRAGMENTS
unlock_super(sb);
UFSD(("EXIT, result %u\n", result))
@@ -380,7 +380,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment,
*p = SWAB32(result);
*err = 0;
inode->i_blocks += count << uspi->s_nspfshift;
- inode->u.ufs_i.i_lastfrag = max (inode->u.ufs_i.i_lastfrag, fragment + count);
+ inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
NULLIFY_FRAGMENTS
unlock_super(sb);
if (newcount < request)
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index d154f58d1687..cae11a7cae69 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -88,7 +88,7 @@ static int ufs_trunc_direct (struct inode * inode)
retry = 0;
frag1 = DIRECT_FRAGMENT;
- frag4 = min (UFS_NDIR_FRAGMENT, inode->u.ufs_i.i_lastfrag);
+ frag4 = min(u32, UFS_NDIR_FRAGMENT, inode->u.ufs_i.i_lastfrag);
frag2 = ((frag1 & uspi->s_fpbmask) ? ((frag1 | uspi->s_fpbmask) + 1) : frag1);
frag3 = frag4 & ~uspi->s_fpbmask;
block1 = block2 = 0;
diff --git a/fs/ufs/util.c b/fs/ufs/util.c
index 54a0ab80f59a..9380ccbc6b17 100644
--- a/fs/ufs/util.c
+++ b/fs/ufs/util.c
@@ -166,11 +166,11 @@ void _ubh_ubhcpymem_(struct ufs_sb_private_info * uspi,
unsigned char * mem, struct ufs_buffer_head * ubh, unsigned size)
{
unsigned len, bhno;
- if ( size > (ubh->count << uspi->s_fshift) )
+ if (size > (ubh->count << uspi->s_fshift))
size = ubh->count << uspi->s_fshift;
bhno = 0;
- while ( size ) {
- len = min (size, uspi->s_fsize);
+ while (size) {
+ len = min(unsigned int, size, uspi->s_fsize);
memcpy (mem, ubh->bh[bhno]->b_data, len);
mem += uspi->s_fsize;
size -= len;
@@ -182,11 +182,11 @@ void _ubh_memcpyubh_(struct ufs_sb_private_info * uspi,
struct ufs_buffer_head * ubh, unsigned char * mem, unsigned size)
{
unsigned len, bhno;
- if ( size > (ubh->count << uspi->s_fshift) )
+ if (size > (ubh->count << uspi->s_fshift))
size = ubh->count << uspi->s_fshift;
bhno = 0;
- while ( size ) {
- len = min (size, uspi->s_fsize);
+ while (size) {
+ len = min(unsigned int, size, uspi->s_fsize);
memcpy (ubh->bh[bhno]->b_data, mem, len);
mem += uspi->s_fsize;
size -= len;
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index 0def49d959a9..a1e5889d0bb5 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -14,10 +14,6 @@
* some useful macros
*/
#define in_range(b,first,len) ((b)>=(first)&&(b)<(first)+(len))
-#define min(x,y) ((x)<(y)?(x):(y))
-#define max(x,y) ((x)>(y)?(x):(y))
-
-
/*
* macros used for retyping
@@ -335,7 +331,7 @@ static inline unsigned _ubh_find_next_zero_bit_(
base = offset >> uspi->s_bpfshift;
offset &= uspi->s_bpfmask;
for (;;) {
- count = min (size + offset, uspi->s_bpf);
+ count = min(unsigned int, size + offset, uspi->s_bpf);
size -= count - offset;
pos = ext2_find_next_zero_bit (ubh->bh[base]->b_data, count, offset);
if (pos < count || !size)
@@ -382,7 +378,8 @@ static inline unsigned _ubh_find_last_zero_bit_(
base = start >> uspi->s_bpfshift;
start &= uspi->s_bpfmask;
for (;;) {
- count = min (size + (uspi->s_bpf - start), uspi->s_bpf)
+ count = min(unsigned int,
+ size + (uspi->s_bpf - start), uspi->s_bpf)
- (uspi->s_bpf - start);
size -= count;
pos = find_last_zero_bit (ubh->bh[base]->b_data,