inode.c (d8d3d94b80aa1a1c0ca75c58b8abdc7356f38418) | inode.c (a6cbcd4a4a85e2fdb0b3344b88df2e8b3d526b9e) |
---|---|
1/* 2 * inode.c - NILFS inode operations. 3 * 4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 290 unchanged lines hidden (view full) --- 299 300static ssize_t 301nilfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, 302 loff_t offset) 303{ 304 struct file *file = iocb->ki_filp; 305 struct address_space *mapping = file->f_mapping; 306 struct inode *inode = file->f_mapping->host; | 1/* 2 * inode.c - NILFS inode operations. 3 * 4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 290 unchanged lines hidden (view full) --- 299 300static ssize_t 301nilfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, 302 loff_t offset) 303{ 304 struct file *file = iocb->ki_filp; 305 struct address_space *mapping = file->f_mapping; 306 struct inode *inode = file->f_mapping->host; |
307 size_t count = iov_iter_count(iter); |
|
307 ssize_t size; 308 309 if (rw == WRITE) 310 return 0; 311 312 /* Needs synchronization with the cleaner */ 313 size = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 314 iter->nr_segs, nilfs_get_block); 315 316 /* 317 * In case of error extending write may have instantiated a few 318 * blocks outside i_size. Trim these off again. 319 */ 320 if (unlikely((rw & WRITE) && size < 0)) { 321 loff_t isize = i_size_read(inode); | 308 ssize_t size; 309 310 if (rw == WRITE) 311 return 0; 312 313 /* Needs synchronization with the cleaner */ 314 size = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 315 iter->nr_segs, nilfs_get_block); 316 317 /* 318 * In case of error extending write may have instantiated a few 319 * blocks outside i_size. Trim these off again. 320 */ 321 if (unlikely((rw & WRITE) && size < 0)) { 322 loff_t isize = i_size_read(inode); |
322 loff_t end = offset + iov_length(iter->iov, iter->nr_segs); | 323 loff_t end = offset + count; |
323 324 if (end > isize) 325 nilfs_write_failed(mapping, end); 326 } 327 328 return size; 329} 330 --- 783 unchanged lines hidden --- | 324 325 if (end > isize) 326 nilfs_write_failed(mapping, end); 327 } 328 329 return size; 330} 331 --- 783 unchanged lines hidden --- |