file.c (eb5bc2a213f96bd43b5f00a625acb0c669613645) file.c (66ee59af630fd8d5f4f56fb28162857e629aa0ab)
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * file.c
5 *
6 * File open, close, extend, truncate
7 *
8 * Copyright (C) 2002, 2004 Oracle. All rights reserved.

--- 2266 unchanged lines hidden (view full) ---

2275 int unaligned_dio = 0;
2276
2277 trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry,
2278 (unsigned long long)OCFS2_I(inode)->ip_blkno,
2279 file->f_path.dentry->d_name.len,
2280 file->f_path.dentry->d_name.name,
2281 (unsigned int)from->nr_segs); /* GRRRRR */
2282
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * file.c
5 *
6 * File open, close, extend, truncate
7 *
8 * Copyright (C) 2002, 2004 Oracle. All rights reserved.

--- 2266 unchanged lines hidden (view full) ---

2275 int unaligned_dio = 0;
2276
2277 trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry,
2278 (unsigned long long)OCFS2_I(inode)->ip_blkno,
2279 file->f_path.dentry->d_name.len,
2280 file->f_path.dentry->d_name.name,
2281 (unsigned int)from->nr_segs); /* GRRRRR */
2282
2283 if (iocb->ki_nbytes == 0)
2283 if (count == 0)
2284 return 0;
2285
2286 appending = file->f_flags & O_APPEND ? 1 : 0;
2287 direct_io = file->f_flags & O_DIRECT ? 1 : 0;
2288
2289 mutex_lock(&inode->i_mutex);
2290
2291 ocfs2_iocb_clear_sem_locked(iocb);

--- 33 unchanged lines hidden (view full) ---

2325 mlog_errno(ret);
2326 goto out;
2327 }
2328
2329 ocfs2_inode_unlock(inode, 1);
2330 }
2331
2332 can_do_direct = direct_io;
2284 return 0;
2285
2286 appending = file->f_flags & O_APPEND ? 1 : 0;
2287 direct_io = file->f_flags & O_DIRECT ? 1 : 0;
2288
2289 mutex_lock(&inode->i_mutex);
2290
2291 ocfs2_iocb_clear_sem_locked(iocb);

--- 33 unchanged lines hidden (view full) ---

2325 mlog_errno(ret);
2326 goto out;
2327 }
2328
2329 ocfs2_inode_unlock(inode, 1);
2330 }
2331
2332 can_do_direct = direct_io;
2333 ret = ocfs2_prepare_inode_for_write(file, ppos,
2334 iocb->ki_nbytes, appending,
2333 ret = ocfs2_prepare_inode_for_write(file, ppos, count, appending,
2335 &can_do_direct, &has_refcount);
2336 if (ret < 0) {
2337 mlog_errno(ret);
2338 goto out;
2339 }
2340
2341 if (direct_io && !is_sync_kiocb(iocb))
2334 &can_do_direct, &has_refcount);
2335 if (ret < 0) {
2336 mlog_errno(ret);
2337 goto out;
2338 }
2339
2340 if (direct_io && !is_sync_kiocb(iocb))
2342 unaligned_dio = ocfs2_is_io_unaligned(inode, iocb->ki_nbytes,
2343 *ppos);
2341 unaligned_dio = ocfs2_is_io_unaligned(inode, count, *ppos);
2344
2345 /*
2346 * We can't complete the direct I/O as requested, fall back to
2347 * buffered I/O.
2348 */
2349 if (direct_io && !can_do_direct) {
2350 ocfs2_rw_unlock(inode, rw_level);
2351

--- 408 unchanged lines hidden ---
2342
2343 /*
2344 * We can't complete the direct I/O as requested, fall back to
2345 * buffered I/O.
2346 */
2347 if (direct_io && !can_do_direct) {
2348 ocfs2_rw_unlock(inode, rw_level);
2349

--- 408 unchanged lines hidden ---