Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (69 commits)
  fix handling of offsets in cris eeprom.c, get rid of fake on-stack files
  get rid of home-grown mutex in cris eeprom.c
  switch ecryptfs_write() to struct inode *, kill on-stack fake files
  switch ecryptfs_get_locked_page() to struct inode *
  simplify access to ecryptfs inodes in ->readpage() and friends
  AFS: Don't put struct file on the stack
  Ban ecryptfs over ecryptfs
  logfs: replace inode uid,gid,mode initialization with helper function
  ufs: replace inode uid,gid,mode initialization with helper function
  udf: replace inode uid,gid,mode init with helper
  ubifs: replace inode uid,gid,mode initialization with helper function
  sysv: replace inode uid,gid,mode initialization with helper function
  reiserfs: replace inode uid,gid,mode initialization with helper function
  ramfs: replace inode uid,gid,mode initialization with helper function
  omfs: replace inode uid,gid,mode initialization with helper function
  bfs: replace inode uid,gid,mode initialization with helper function
  ocfs2: replace inode uid,gid,mode initialization with helper function
  nilfs2: replace inode uid,gid,mode initialization with helper function
  minix: replace inode uid,gid,mode init with helper
  ext4: replace inode uid,gid,mode init with helper
  ...

Trivial conflict in fs/fs-writeback.c (mark bitfields unsigned)
  • Loading branch information
torvalds committed May 22, 2010
2 parents 6109e2c + 82f3952 commit e8bebe2
Show file tree
Hide file tree
Showing 119 changed files with 907 additions and 1,294 deletions.
48 changes: 15 additions & 33 deletions arch/cris/arch-v10/drivers/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ struct eeprom_type
int adapt_state; /* 1 = To high , 0 = Even, -1 = To low */

/* this one is to keep the read/write operations atomic */
wait_queue_head_t wait_q;
volatile int busy;
struct mutex lock;
int retry_cnt_addr; /* Used to keep track of number of retries for
adaptive timing adjustments */
int retry_cnt_read;
Expand Down Expand Up @@ -115,8 +114,7 @@ const struct file_operations eeprom_fops =

int __init eeprom_init(void)
{
init_waitqueue_head(&eeprom.wait_q);
eeprom.busy = 0;
mutex_init(&eeprom.lock);

#ifdef CONFIG_ETRAX_I2C_EEPROM_PROBE
#define EETEXT "Found"
Expand Down Expand Up @@ -439,10 +437,7 @@ static loff_t eeprom_lseek(struct file * file, loff_t offset, int orig)

static int eeprom_read_buf(loff_t addr, char * buf, int count)
{
struct file f;

f.f_pos = addr;
return eeprom_read(&f, buf, count, &addr);
return eeprom_read(NULL, buf, count, &addr);
}


Expand All @@ -452,7 +447,7 @@ static int eeprom_read_buf(loff_t addr, char * buf, int count)
static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t *off)
{
int read=0;
unsigned long p = file->f_pos;
unsigned long p = *off;

unsigned char page;

Expand All @@ -461,12 +456,9 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
return -EFAULT;
}

wait_event_interruptible(eeprom.wait_q, !eeprom.busy);
if (signal_pending(current))
if (mutex_lock_interruptible(&eeprom.lock))
return -EINTR;

eeprom.busy++;

page = (unsigned char) (p >> 8);

if(!eeprom_address(p))
Expand All @@ -476,8 +468,7 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
i2c_stop();

/* don't forget to wake them up */
eeprom.busy--;
wake_up_interruptible(&eeprom.wait_q);
mutex_unlock(&eeprom.lock);
return -EFAULT;
}

Expand All @@ -501,23 +492,18 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t

if(read > 0)
{
file->f_pos += read;
*off += read;
}

eeprom.busy--;
wake_up_interruptible(&eeprom.wait_q);
mutex_unlock(&eeprom.lock);
return read;
}

/* Writes data to eeprom. */

static int eeprom_write_buf(loff_t addr, const char * buf, int count)
{
struct file f;

f.f_pos = addr;

return eeprom_write(&f, buf, count, &addr);
return eeprom_write(NULL, buf, count, &addr);
}


Expand All @@ -534,16 +520,14 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
return -EFAULT;
}

wait_event_interruptible(eeprom.wait_q, !eeprom.busy);
/* bail out if we get interrupted */
if (signal_pending(current))
if (mutex_lock_interruptible(&eeprom.lock))
return -EINTR;
eeprom.busy++;
for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++)
{
restart = 0;
written = 0;
p = file->f_pos;
p = *off;


while( (written < count) && (p < eeprom.size))
Expand All @@ -556,8 +540,7 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
i2c_stop();

/* don't forget to wake them up */
eeprom.busy--;
wake_up_interruptible(&eeprom.wait_q);
mutex_unlock(&eeprom.lock);
return -EFAULT;
}
#ifdef EEPROM_ADAPTIVE_TIMING
Expand Down Expand Up @@ -669,12 +652,11 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
} /* while */
} /* for */

eeprom.busy--;
wake_up_interruptible(&eeprom.wait_q);
if (written == 0 && file->f_pos >= eeprom.size){
mutex_unlock(&eeprom.lock);
if (written == 0 && p >= eeprom.size){
return -ENOSPC;
}
file->f_pos += written;
*off = p;
return written;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
goto out;
}

ret = vfs_fsync(file, file->f_path.dentry, 0);
ret = vfs_fsync(file, 0);
if (unlikely(ret)) {
ret = -EIO;
goto out;
Expand All @@ -495,7 +495,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
ret = lo_send(lo, bio, pos);

if (barrier && !ret) {
ret = vfs_fsync(file, file->f_path.dentry, 0);
ret = vfs_fsync(file, 0);
if (unlikely(ret))
ret = -EIO;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@ int bitmap_create(mddev_t *mddev)
* and bypass the page cache, we must sync the file
* first.
*/
vfs_fsync(file, file->f_dentry, 1);
vfs_fsync(file, 1);
}
/* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */
if (!mddev->bitmap_info.external)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/storage_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ static int fsg_lun_fsync_sub(struct fsg_lun *curlun)

if (curlun->ro || !filp)
return 0;
return vfs_fsync(filp, filp->f_path.dentry, 1);
return vfs_fsync(filp, 1);
}

static void store_cdrom_address(u8 *dest, int msf, u32 addr)
Expand Down
4 changes: 1 addition & 3 deletions fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
return ERR_PTR(-ENOMEM);
}

inode->i_mode = mode;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
inode_init_owner(inode, NULL, mode);
inode->i_blocks = 0;
inode->i_rdev = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
Expand Down
2 changes: 1 addition & 1 deletion fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ obj-y := open.o read_write.o file_table.o super.o \
attr.o bad_inode.o file.o filesystems.o namespace.o \
seq_file.o xattr.o libfs.o fs-writeback.o \
pnode.o drop_caches.o splice.o sync.o utimes.o \
stack.o fs_struct.o
stack.o fs_struct.o statfs.o

ifeq ($(CONFIG_BLOCK),y)
obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o
Expand Down
6 changes: 1 addition & 5 deletions fs/afs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,9 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index,
struct key *key)
{
struct page *page;
struct file file = {
.private_data = key,
};

_enter("{%lu},%lu", dir->i_ino, index);

page = read_mapping_page(dir->i_mapping, index, &file);
page = read_cache_page(dir->i_mapping, index, afs_page_filler, key);
if (!IS_ERR(page)) {
kmap(page);
if (!PageChecked(page))
Expand Down
64 changes: 37 additions & 27 deletions fs/afs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,34 +121,19 @@ static void afs_file_readpage_read_complete(struct page *page,
#endif

/*
* AFS read page from file, directory or symlink
* read page from file, directory or symlink, given a key to use
*/
static int afs_readpage(struct file *file, struct page *page)
int afs_page_filler(void *data, struct page *page)
{
struct afs_vnode *vnode;
struct inode *inode;
struct key *key;
struct inode *inode = page->mapping->host;
struct afs_vnode *vnode = AFS_FS_I(inode);
struct key *key = data;
size_t len;
off_t offset;
int ret;

inode = page->mapping->host;

if (file) {
key = file->private_data;
ASSERT(key != NULL);
} else {
key = afs_request_key(AFS_FS_S(inode->i_sb)->volume->cell);
if (IS_ERR(key)) {
ret = PTR_ERR(key);
goto error_nokey;
}
}

_enter("{%x},{%lu},{%lu}", key_serial(key), inode->i_ino, page->index);

vnode = AFS_FS_I(inode);

BUG_ON(!PageLocked(page));

ret = -ESTALE;
Expand Down Expand Up @@ -214,31 +199,56 @@ static int afs_readpage(struct file *file, struct page *page)
unlock_page(page);
}

if (!file)
key_put(key);
_leave(" = 0");
return 0;

error:
SetPageError(page);
unlock_page(page);
if (!file)
key_put(key);
error_nokey:
_leave(" = %d", ret);
return ret;
}

/*
* read page from file, directory or symlink, given a file to nominate the key
* to be used
*/
static int afs_readpage(struct file *file, struct page *page)
{
struct key *key;
int ret;

if (file) {
key = file->private_data;
ASSERT(key != NULL);
ret = afs_page_filler(key, page);
} else {
struct inode *inode = page->mapping->host;
key = afs_request_key(AFS_FS_S(inode->i_sb)->volume->cell);
if (IS_ERR(key)) {
ret = PTR_ERR(key);
} else {
ret = afs_page_filler(key, page);
key_put(key);
}
}
return ret;
}

/*
* read a set of pages
*/
static int afs_readpages(struct file *file, struct address_space *mapping,
struct list_head *pages, unsigned nr_pages)
{
struct key *key = file->private_data;
struct afs_vnode *vnode;
int ret = 0;

_enter(",{%lu},,%d", mapping->host->i_ino, nr_pages);
_enter("{%d},{%lu},,%d",
key_serial(key), mapping->host->i_ino, nr_pages);

ASSERT(key != NULL);

vnode = AFS_FS_I(mapping->host);
if (vnode->flags & AFS_VNODE_DELETED) {
Expand Down Expand Up @@ -279,7 +289,7 @@ static int afs_readpages(struct file *file, struct address_space *mapping,
}

/* load the missing pages from the network */
ret = read_cache_pages(mapping, pages, (void *) afs_readpage, file);
ret = read_cache_pages(mapping, pages, afs_page_filler, key);

_leave(" = %d [netting]", ret);
return ret;
Expand Down
1 change: 1 addition & 0 deletions fs/afs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ extern const struct file_operations afs_file_operations;

extern int afs_open(struct inode *, struct file *);
extern int afs_release(struct inode *, struct file *);
extern int afs_page_filler(void *, struct page *);

/*
* flock.c
Expand Down
6 changes: 2 additions & 4 deletions fs/afs/mntpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ static unsigned long afs_mntpt_expiry_timeout = 10 * 60;
*/
int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key)
{
struct file file = {
.private_data = key,
};
struct page *page;
size_t size;
char *buf;
Expand All @@ -61,7 +58,8 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key)
vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);

/* read the contents of the symlink into the pagecache */
page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, &file);
page = read_cache_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0,
afs_page_filler, key);
if (IS_ERR(page)) {
ret = PTR_ERR(page);
goto out;
Expand Down
2 changes: 1 addition & 1 deletion fs/anon_inodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static struct inode *anon_inode_mkinode(void)
* that it already _is_ on the dirty list.
*/
inode->i_state = I_DIRTY;
inode->i_mode = S_IRUSR | S_IWUSR;
inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
inode->i_flags |= S_PRIVATE;
Expand Down
4 changes: 1 addition & 3 deletions fs/bfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
}
set_bit(ino, info->si_imap);
info->si_freei--;
inode->i_uid = current_fsuid();
inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current_fsgid();
inode_init_owner(inode, dir, mode);
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
inode->i_blocks = 0;
inode->i_op = &bfs_file_inops;
inode->i_fop = &bfs_file_operations;
inode->i_mapping->a_ops = &bfs_aops;
inode->i_mode = mode;
inode->i_ino = ino;
BFS_I(inode)->i_dsk_ino = ino;
BFS_I(inode)->i_sblock = 0;
Expand Down
Loading

0 comments on commit e8bebe2

Please sign in to comment.