segment.c (86cb2ec7b22a0a89b8660110dc03321fadbef45f) | segment.c (3b2ce58b0f3c1633750529713be0e467282abd78) |
---|---|
1/* 2 * segment.c - NILFS segment constructor. 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 --- 2284 unchanged lines hidden (view full) --- 2293 * %-ERESTARTSYS - Interrupted. 2294 * 2295 * %-ENOMEM - Insufficient memory available. 2296 */ 2297int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode, 2298 loff_t start, loff_t end) 2299{ 2300 struct nilfs_sb_info *sbi = NILFS_SB(sb); | 1/* 2 * segment.c - NILFS segment constructor. 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 --- 2284 unchanged lines hidden (view full) --- 2293 * %-ERESTARTSYS - Interrupted. 2294 * 2295 * %-ENOMEM - Insufficient memory available. 2296 */ 2297int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode, 2298 loff_t start, loff_t end) 2299{ 2300 struct nilfs_sb_info *sbi = NILFS_SB(sb); |
2301 struct the_nilfs *nilfs = sbi->s_nilfs; |
|
2301 struct nilfs_sc_info *sci = NILFS_SC(sbi); 2302 struct nilfs_inode_info *ii; 2303 struct nilfs_transaction_info ti; 2304 int err = 0; 2305 2306 if (!sci) 2307 return -EROFS; 2308 2309 nilfs_transaction_lock(sbi, &ti, 0); 2310 2311 ii = NILFS_I(inode); 2312 if (test_bit(NILFS_I_INODE_DIRTY, &ii->i_state) || | 2302 struct nilfs_sc_info *sci = NILFS_SC(sbi); 2303 struct nilfs_inode_info *ii; 2304 struct nilfs_transaction_info ti; 2305 int err = 0; 2306 2307 if (!sci) 2308 return -EROFS; 2309 2310 nilfs_transaction_lock(sbi, &ti, 0); 2311 2312 ii = NILFS_I(inode); 2313 if (test_bit(NILFS_I_INODE_DIRTY, &ii->i_state) || |
2313 nilfs_test_opt(sbi, STRICT_ORDER) || | 2314 nilfs_test_opt(nilfs, STRICT_ORDER) || |
2314 test_bit(NILFS_SC_UNCLOSED, &sci->sc_flags) || | 2315 test_bit(NILFS_SC_UNCLOSED, &sci->sc_flags) || |
2315 nilfs_discontinued(sbi->s_nilfs)) { | 2316 nilfs_discontinued(nilfs)) { |
2316 nilfs_transaction_unlock(sbi); 2317 err = nilfs_segctor_sync(sci); 2318 return err; 2319 } 2320 2321 spin_lock(&sbi->s_inode_lock); 2322 if (!test_bit(NILFS_I_QUEUED, &ii->i_state) && 2323 !test_bit(NILFS_I_BUSY, &ii->i_state)) { --- 151 unchanged lines hidden (view full) --- 2475 if (likely(!err)) 2476 break; 2477 2478 nilfs_warning(sb, __func__, 2479 "segment construction failed. (err=%d)", err); 2480 set_current_state(TASK_INTERRUPTIBLE); 2481 schedule_timeout(sci->sc_interval); 2482 } | 2317 nilfs_transaction_unlock(sbi); 2318 err = nilfs_segctor_sync(sci); 2319 return err; 2320 } 2321 2322 spin_lock(&sbi->s_inode_lock); 2323 if (!test_bit(NILFS_I_QUEUED, &ii->i_state) && 2324 !test_bit(NILFS_I_BUSY, &ii->i_state)) { --- 151 unchanged lines hidden (view full) --- 2476 if (likely(!err)) 2477 break; 2478 2479 nilfs_warning(sb, __func__, 2480 "segment construction failed. (err=%d)", err); 2481 set_current_state(TASK_INTERRUPTIBLE); 2482 schedule_timeout(sci->sc_interval); 2483 } |
2483 if (nilfs_test_opt(sbi, DISCARD)) { | 2484 if (nilfs_test_opt(nilfs, DISCARD)) { |
2484 int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs, 2485 sci->sc_nfreesegs); 2486 if (ret) { 2487 printk(KERN_WARNING 2488 "NILFS warning: error %d on discard request, " 2489 "turning discards off for the device\n", ret); | 2485 int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs, 2486 sci->sc_nfreesegs); 2487 if (ret) { 2488 printk(KERN_WARNING 2489 "NILFS warning: error %d on discard request, " 2490 "turning discards off for the device\n", ret); |
2490 nilfs_clear_opt(sbi, DISCARD); | 2491 nilfs_clear_opt(nilfs, DISCARD); |
2491 } 2492 } 2493 2494 out_unlock: 2495 sci->sc_freesegs = NULL; 2496 sci->sc_nfreesegs = 0; 2497 nilfs_mdt_clear_shadow_map(nilfs->ns_dat); 2498 nilfs_transaction_unlock(sbi); --- 343 unchanged lines hidden --- | 2492 } 2493 } 2494 2495 out_unlock: 2496 sci->sc_freesegs = NULL; 2497 sci->sc_nfreesegs = 0; 2498 nilfs_mdt_clear_shadow_map(nilfs->ns_dat); 2499 nilfs_transaction_unlock(sbi); --- 343 unchanged lines hidden --- |