Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' into for-3.2/core

+29 -118
+2
block/blk-core.c
··· 1769 1769 where = ELEVATOR_INSERT_FLUSH; 1770 1770 1771 1771 add_acct_request(q, rq, where); 1772 + if (where == ELEVATOR_INSERT_FLUSH) 1773 + __blk_run_queue(q); 1772 1774 spin_unlock_irqrestore(q->queue_lock, flags); 1773 1775 1774 1776 return 0;
+1 -2
block/blk-flush.c
··· 320 320 return; 321 321 } 322 322 323 - BUG_ON(!rq->bio || rq->bio != rq->biotail); 323 + BUG_ON(rq->bio != rq->biotail); /*assumes zero or single bio rq */ 324 324 325 325 /* 326 326 * If there's data but flush is not necessary, the request can be ··· 330 330 if ((policy & REQ_FSEQ_DATA) && 331 331 !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { 332 332 list_add_tail(&rq->queuelist, &q->queue_head); 333 - blk_run_queue_async(q); 334 333 return; 335 334 } 336 335
+26 -115
drivers/block/loop.c
··· 203 203 } 204 204 205 205 /** 206 - * do_lo_send_aops - helper for writing data to a loop device 207 - * 208 - * This is the fast version for backing filesystems which implement the address 209 - * space operations write_begin and write_end. 210 - */ 211 - static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec, 212 - loff_t pos, struct page *unused) 213 - { 214 - struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */ 215 - struct address_space *mapping = file->f_mapping; 216 - pgoff_t index; 217 - unsigned offset, bv_offs; 218 - int len, ret; 219 - 220 - mutex_lock(&mapping->host->i_mutex); 221 - index = pos >> PAGE_CACHE_SHIFT; 222 - offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1); 223 - bv_offs = bvec->bv_offset; 224 - len = bvec->bv_len; 225 - while (len > 0) { 226 - sector_t IV; 227 - unsigned size, copied; 228 - int transfer_result; 229 - struct page *page; 230 - void *fsdata; 231 - 232 - IV = ((sector_t)index << (PAGE_CACHE_SHIFT - 9))+(offset >> 9); 233 - size = PAGE_CACHE_SIZE - offset; 234 - if (size > len) 235 - size = len; 236 - 237 - ret = pagecache_write_begin(file, mapping, pos, size, 0, 238 - &page, &fsdata); 239 - if (ret) 240 - goto fail; 241 - 242 - file_update_time(file); 243 - 244 - transfer_result = lo_do_transfer(lo, WRITE, page, offset, 245 - bvec->bv_page, bv_offs, size, IV); 246 - copied = size; 247 - if (unlikely(transfer_result)) 248 - copied = 0; 249 - 250 - ret = pagecache_write_end(file, mapping, pos, size, copied, 251 - page, fsdata); 252 - if (ret < 0 || ret != copied) 253 - goto fail; 254 - 255 - if (unlikely(transfer_result)) 256 - goto fail; 257 - 258 - bv_offs += copied; 259 - len -= copied; 260 - offset = 0; 261 - index++; 262 - pos += copied; 263 - } 264 - ret = 0; 265 - out: 266 - mutex_unlock(&mapping->host->i_mutex); 267 - return ret; 268 - fail: 269 - ret = -1; 270 - goto out; 271 - } 272 - 273 - /** 274 206 * __do_lo_send_write - helper for writing data to a loop device 275 207 * 276 208 * This helper just factors out common code between do_lo_send_direct_write() ··· 229 297 /** 230 298 * do_lo_send_direct_write - helper for writing data to a loop device 231 299 * 232 - * This is the fast, non-transforming version for backing filesystems which do 233 - * not implement the address space operations write_begin and write_end. 234 - * It uses the write file operation which should be present on all writeable 235 - * filesystems. 300 + * This is the fast, non-transforming version that does not need double 301 + * buffering. 236 302 */ 237 303 static int do_lo_send_direct_write(struct loop_device *lo, 238 304 struct bio_vec *bvec, loff_t pos, struct page *page) ··· 246 316 /** 247 317 * do_lo_send_write - helper for writing data to a loop device 248 318 * 249 - * This is the slow, transforming version for filesystems which do not 250 - * implement the address space operations write_begin and write_end. It 251 - * uses the write file operation which should be present on all writeable 252 - * filesystems. 253 - * 254 - * Using fops->write is slower than using aops->{prepare,commit}_write in the 255 - * transforming case because we need to double buffer the data as we cannot do 256 - * the transformations in place as we do not have direct access to the 257 - * destination pages of the backing file. 319 + * This is the slow, transforming version that needs to double buffer the 320 + * data as it cannot do the transformations in place without having direct 321 + * access to the destination pages of the backing file. 258 322 */ 259 323 static int do_lo_send_write(struct loop_device *lo, struct bio_vec *bvec, 260 324 loff_t pos, struct page *page) ··· 274 350 struct page *page = NULL; 275 351 int i, ret = 0; 276 352 277 - do_lo_send = do_lo_send_aops; 278 - if (!(lo->lo_flags & LO_FLAGS_USE_AOPS)) { 353 + if (lo->transfer != transfer_none) { 354 + page = alloc_page(GFP_NOIO | __GFP_HIGHMEM); 355 + if (unlikely(!page)) 356 + goto fail; 357 + kmap(page); 358 + do_lo_send = do_lo_send_write; 359 + } else { 279 360 do_lo_send = do_lo_send_direct_write; 280 - if (lo->transfer != transfer_none) { 281 - page = alloc_page(GFP_NOIO | __GFP_HIGHMEM); 282 - if (unlikely(!page)) 283 - goto fail; 284 - kmap(page); 285 - do_lo_send = do_lo_send_write; 286 - } 287 361 } 362 + 288 363 bio_for_each_segment(bvec, bio, i) { 289 364 ret = do_lo_send(lo, bvec, pos, page); 290 365 if (ret < 0) ··· 771 848 mapping = file->f_mapping; 772 849 inode = mapping->host; 773 850 774 - if (!(file->f_mode & FMODE_WRITE)) 775 - lo_flags |= LO_FLAGS_READ_ONLY; 776 - 777 851 error = -EINVAL; 778 - if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) { 779 - const struct address_space_operations *aops = mapping->a_ops; 780 - 781 - if (aops->write_begin) 782 - lo_flags |= LO_FLAGS_USE_AOPS; 783 - if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write) 784 - lo_flags |= LO_FLAGS_READ_ONLY; 785 - 786 - lo_blocksize = S_ISBLK(inode->i_mode) ? 787 - inode->i_bdev->bd_block_size : PAGE_SIZE; 788 - 789 - error = 0; 790 - } else { 852 + if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode)) 791 853 goto out_putf; 792 - } 793 854 794 - size = get_loop_size(lo, file); 795 - 796 - if ((loff_t)(sector_t)size != size) { 797 - error = -EFBIG; 798 - goto out_putf; 799 - } 800 - 801 - if (!(mode & FMODE_WRITE)) 855 + if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) || 856 + !file->f_op->write) 802 857 lo_flags |= LO_FLAGS_READ_ONLY; 858 + 859 + lo_blocksize = S_ISBLK(inode->i_mode) ? 860 + inode->i_bdev->bd_block_size : PAGE_SIZE; 861 + 862 + error = -EFBIG; 863 + size = get_loop_size(lo, file); 864 + if ((loff_t)(sector_t)size != size) 865 + goto out_putf; 866 + 867 + error = 0; 803 868 804 869 set_device_ro(bdev, (lo_flags & LO_FLAGS_READ_ONLY) != 0); 805 870
-1
include/linux/loop.h
··· 73 73 */ 74 74 enum { 75 75 LO_FLAGS_READ_ONLY = 1, 76 - LO_FLAGS_USE_AOPS = 2, 77 76 LO_FLAGS_AUTOCLEAR = 4, 78 77 }; 79 78