diff options
author | Steve French <sfrench@us.ibm.com> | 2007-02-06 19:30:38 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-02-06 19:30:38 -0500 |
commit | 1d9564ea0ac72ef7c4068d66fe42ad23af4ff53f (patch) | |
tree | fa63b4c1bbd775252f71d05fef4de6a904eb4448 /fs | |
parent | 87f440e70e07dace7db130f2f9fcea3f132aad8f (diff) | |
parent | dda2ac15d23b38e4335e858848aa8c9a6710304f (diff) |
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs')
-rw-r--r-- | fs/aio.c | 20 | ||||
-rw-r--r-- | fs/block_dev.c | 41 | ||||
-rw-r--r-- | fs/nfsd/nfsfh.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/journal.h | 4 | ||||
-rw-r--r-- | fs/proc/base.c | 12 |
5 files changed, 64 insertions, 15 deletions
@@ -298,17 +298,23 @@ static void wait_for_all_aios(struct kioctx *ctx) | |||
298 | struct task_struct *tsk = current; | 298 | struct task_struct *tsk = current; |
299 | DECLARE_WAITQUEUE(wait, tsk); | 299 | DECLARE_WAITQUEUE(wait, tsk); |
300 | 300 | ||
301 | spin_lock_irq(&ctx->ctx_lock); | ||
301 | if (!ctx->reqs_active) | 302 | if (!ctx->reqs_active) |
302 | return; | 303 | goto out; |
303 | 304 | ||
304 | add_wait_queue(&ctx->wait, &wait); | 305 | add_wait_queue(&ctx->wait, &wait); |
305 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | 306 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); |
306 | while (ctx->reqs_active) { | 307 | while (ctx->reqs_active) { |
308 | spin_unlock_irq(&ctx->ctx_lock); | ||
307 | schedule(); | 309 | schedule(); |
308 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | 310 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); |
311 | spin_lock_irq(&ctx->ctx_lock); | ||
309 | } | 312 | } |
310 | __set_task_state(tsk, TASK_RUNNING); | 313 | __set_task_state(tsk, TASK_RUNNING); |
311 | remove_wait_queue(&ctx->wait, &wait); | 314 | remove_wait_queue(&ctx->wait, &wait); |
315 | |||
316 | out: | ||
317 | spin_unlock_irq(&ctx->ctx_lock); | ||
312 | } | 318 | } |
313 | 319 | ||
314 | /* wait_on_sync_kiocb: | 320 | /* wait_on_sync_kiocb: |
@@ -424,7 +430,6 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx) | |||
424 | ring = kmap_atomic(ctx->ring_info.ring_pages[0], KM_USER0); | 430 | ring = kmap_atomic(ctx->ring_info.ring_pages[0], KM_USER0); |
425 | if (ctx->reqs_active < aio_ring_avail(&ctx->ring_info, ring)) { | 431 | if (ctx->reqs_active < aio_ring_avail(&ctx->ring_info, ring)) { |
426 | list_add(&req->ki_list, &ctx->active_reqs); | 432 | list_add(&req->ki_list, &ctx->active_reqs); |
427 | get_ioctx(ctx); | ||
428 | ctx->reqs_active++; | 433 | ctx->reqs_active++; |
429 | okay = 1; | 434 | okay = 1; |
430 | } | 435 | } |
@@ -536,8 +541,6 @@ int fastcall aio_put_req(struct kiocb *req) | |||
536 | spin_lock_irq(&ctx->ctx_lock); | 541 | spin_lock_irq(&ctx->ctx_lock); |
537 | ret = __aio_put_req(ctx, req); | 542 | ret = __aio_put_req(ctx, req); |
538 | spin_unlock_irq(&ctx->ctx_lock); | 543 | spin_unlock_irq(&ctx->ctx_lock); |
539 | if (ret) | ||
540 | put_ioctx(ctx); | ||
541 | return ret; | 544 | return ret; |
542 | } | 545 | } |
543 | 546 | ||
@@ -779,8 +782,7 @@ static int __aio_run_iocbs(struct kioctx *ctx) | |||
779 | */ | 782 | */ |
780 | iocb->ki_users++; /* grab extra reference */ | 783 | iocb->ki_users++; /* grab extra reference */ |
781 | aio_run_iocb(iocb); | 784 | aio_run_iocb(iocb); |
782 | if (__aio_put_req(ctx, iocb)) /* drop extra ref */ | 785 | __aio_put_req(ctx, iocb); |
783 | put_ioctx(ctx); | ||
784 | } | 786 | } |
785 | if (!list_empty(&ctx->run_list)) | 787 | if (!list_empty(&ctx->run_list)) |
786 | return 1; | 788 | return 1; |
@@ -997,14 +999,10 @@ put_rq: | |||
997 | /* everything turned out well, dispose of the aiocb. */ | 999 | /* everything turned out well, dispose of the aiocb. */ |
998 | ret = __aio_put_req(ctx, iocb); | 1000 | ret = __aio_put_req(ctx, iocb); |
999 | 1001 | ||
1000 | spin_unlock_irqrestore(&ctx->ctx_lock, flags); | ||
1001 | |||
1002 | if (waitqueue_active(&ctx->wait)) | 1002 | if (waitqueue_active(&ctx->wait)) |
1003 | wake_up(&ctx->wait); | 1003 | wake_up(&ctx->wait); |
1004 | 1004 | ||
1005 | if (ret) | 1005 | spin_unlock_irqrestore(&ctx->ctx_lock, flags); |
1006 | put_ioctx(ctx); | ||
1007 | |||
1008 | return ret; | 1006 | return ret; |
1009 | } | 1007 | } |
1010 | 1008 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index d9bdf2b3ade2..fc7028b685f2 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -129,6 +129,46 @@ blkdev_get_block(struct inode *inode, sector_t iblock, | |||
129 | return 0; | 129 | return 0; |
130 | } | 130 | } |
131 | 131 | ||
132 | static int | ||
133 | blkdev_get_blocks(struct inode *inode, sector_t iblock, | ||
134 | struct buffer_head *bh, int create) | ||
135 | { | ||
136 | sector_t end_block = max_block(I_BDEV(inode)); | ||
137 | unsigned long max_blocks = bh->b_size >> inode->i_blkbits; | ||
138 | |||
139 | if ((iblock + max_blocks) > end_block) { | ||
140 | max_blocks = end_block - iblock; | ||
141 | if ((long)max_blocks <= 0) { | ||
142 | if (create) | ||
143 | return -EIO; /* write fully beyond EOF */ | ||
144 | /* | ||
145 | * It is a read which is fully beyond EOF. We return | ||
146 | * a !buffer_mapped buffer | ||
147 | */ | ||
148 | max_blocks = 0; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | bh->b_bdev = I_BDEV(inode); | ||
153 | bh->b_blocknr = iblock; | ||
154 | bh->b_size = max_blocks << inode->i_blkbits; | ||
155 | if (max_blocks) | ||
156 | set_buffer_mapped(bh); | ||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static ssize_t | ||
161 | blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | ||
162 | loff_t offset, unsigned long nr_segs) | ||
163 | { | ||
164 | struct file *file = iocb->ki_filp; | ||
165 | struct inode *inode = file->f_mapping->host; | ||
166 | |||
167 | return blockdev_direct_IO_no_locking(rw, iocb, inode, I_BDEV(inode), | ||
168 | iov, offset, nr_segs, blkdev_get_blocks, NULL); | ||
169 | } | ||
170 | |||
171 | #if 0 | ||
132 | static int blk_end_aio(struct bio *bio, unsigned int bytes_done, int error) | 172 | static int blk_end_aio(struct bio *bio, unsigned int bytes_done, int error) |
133 | { | 173 | { |
134 | struct kiocb *iocb = bio->bi_private; | 174 | struct kiocb *iocb = bio->bi_private; |
@@ -323,6 +363,7 @@ backout: | |||
323 | return PTR_ERR(page); | 363 | return PTR_ERR(page); |
324 | goto completion; | 364 | goto completion; |
325 | } | 365 | } |
366 | #endif | ||
326 | 367 | ||
327 | static int blkdev_writepage(struct page *page, struct writeback_control *wbc) | 368 | static int blkdev_writepage(struct page *page, struct writeback_control *wbc) |
328 | { | 369 | { |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 98338a569dc0..c59d6fbb7a6b 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -269,7 +269,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
269 | "acc=%x, error=%d\n", | 269 | "acc=%x, error=%d\n", |
270 | dentry->d_parent->d_name.name, | 270 | dentry->d_parent->d_name.name, |
271 | dentry->d_name.name, | 271 | dentry->d_name.name, |
272 | access, (error >> 24)); | 272 | access, ntohl(error)); |
273 | } | 273 | } |
274 | out: | 274 | out: |
275 | if (exp && !IS_ERR(exp)) | 275 | if (exp && !IS_ERR(exp)) |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index e1216364d191..d026b4f27757 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -306,8 +306,8 @@ int ocfs2_journal_dirty_data(handle_t *handle, | |||
306 | * for the dinode, one for the new block. */ | 306 | * for the dinode, one for the new block. */ |
307 | #define OCFS2_SIMPLE_DIR_EXTEND_CREDITS (2) | 307 | #define OCFS2_SIMPLE_DIR_EXTEND_CREDITS (2) |
308 | 308 | ||
309 | /* file update (nlink, etc) + dir entry block */ | 309 | /* file update (nlink, etc) + directory mtime/ctime + dir entry block */ |
310 | #define OCFS2_LINK_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) | 310 | #define OCFS2_LINK_CREDITS (2*OCFS2_INODE_UPDATE_CREDITS + 1) |
311 | 311 | ||
312 | /* inode + dir inode (if we unlink a dir), + dir entry block + orphan | 312 | /* inode + dir inode (if we unlink a dir), + dir entry block + orphan |
313 | * dir inode link */ | 313 | * dir inode link */ |
diff --git a/fs/proc/base.c b/fs/proc/base.c index ff7a66850602..1a979ea3b379 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2328,13 +2328,23 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi | |||
2328 | { | 2328 | { |
2329 | struct dentry *dentry = filp->f_path.dentry; | 2329 | struct dentry *dentry = filp->f_path.dentry; |
2330 | struct inode *inode = dentry->d_inode; | 2330 | struct inode *inode = dentry->d_inode; |
2331 | struct task_struct *leader = get_proc_task(inode); | 2331 | struct task_struct *leader = NULL; |
2332 | struct task_struct *task; | 2332 | struct task_struct *task; |
2333 | int retval = -ENOENT; | 2333 | int retval = -ENOENT; |
2334 | ino_t ino; | 2334 | ino_t ino; |
2335 | int tid; | 2335 | int tid; |
2336 | unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */ | 2336 | unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */ |
2337 | 2337 | ||
2338 | task = get_proc_task(inode); | ||
2339 | if (!task) | ||
2340 | goto out_no_task; | ||
2341 | rcu_read_lock(); | ||
2342 | if (pid_alive(task)) { | ||
2343 | leader = task->group_leader; | ||
2344 | get_task_struct(leader); | ||
2345 | } | ||
2346 | rcu_read_unlock(); | ||
2347 | put_task_struct(task); | ||
2338 | if (!leader) | 2348 | if (!leader) |
2339 | goto out_no_task; | 2349 | goto out_no_task; |
2340 | retval = 0; | 2350 | retval = 0; |