ffs_softdep.c (217326) | ffs_softdep.c (218195) |
---|---|
1/*- 2 * Copyright 1998, 2000 Marshall Kirk McKusick. 3 * Copyright 2009, 2010 Jeffrey W. Roberson <jeff@FreeBSD.org> 4 * All rights reserved. 5 * 6 * The soft updates code is derived from the appendix of a University 7 * of Michigan technical report (Gregory R. Ganger and Yale N. Patt, 8 * "Soft Updates: A Solution to the Metadata Update Problem in File --- 26 unchanged lines hidden (view full) --- 35 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 36 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 37 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 * 39 * from: @(#)ffs_softdep.c 9.59 (McKusick) 6/21/00 40 */ 41 42#include <sys/cdefs.h> | 1/*- 2 * Copyright 1998, 2000 Marshall Kirk McKusick. 3 * Copyright 2009, 2010 Jeffrey W. Roberson <jeff@FreeBSD.org> 4 * All rights reserved. 5 * 6 * The soft updates code is derived from the appendix of a University 7 * of Michigan technical report (Gregory R. Ganger and Yale N. Patt, 8 * "Soft Updates: A Solution to the Metadata Update Problem in File --- 26 unchanged lines hidden (view full) --- 35 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 36 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 37 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 * 39 * from: @(#)ffs_softdep.c 9.59 (McKusick) 6/21/00 40 */ 41 42#include <sys/cdefs.h> |
43__FBSDID("$FreeBSD: head/sys/ufs/ffs/ffs_softdep.c 217326 2011-01-12 19:54:19Z mdf $"); | 43__FBSDID("$FreeBSD: head/sys/ufs/ffs/ffs_softdep.c 218195 2011-02-02 16:35:10Z mdf $"); |
44 45#include "opt_ffs.h" 46#include "opt_ddb.h" 47 48/* 49 * For now we want the safety net that the DEBUG flag provides. 50 */ 51#ifndef DEBUG --- 1285 unchanged lines hidden (view full) --- 1337 * until all the old ones have been purged from the dependency lists. 1338 */ 1339int 1340softdep_process_worklist(mp, full) 1341 struct mount *mp; 1342 int full; 1343{ 1344 struct thread *td = curthread; | 44 45#include "opt_ffs.h" 46#include "opt_ddb.h" 47 48/* 49 * For now we want the safety net that the DEBUG flag provides. 50 */ 51#ifndef DEBUG --- 1285 unchanged lines hidden (view full) --- 1337 * until all the old ones have been purged from the dependency lists. 1338 */ 1339int 1340softdep_process_worklist(mp, full) 1341 struct mount *mp; 1342 int full; 1343{ 1344 struct thread *td = curthread; |
1345 int cnt, matchcnt, loopcount; | 1345 int cnt, matchcnt; |
1346 struct ufsmount *ump; 1347 long starttime; 1348 1349 KASSERT(mp != NULL, ("softdep_process_worklist: NULL mp")); 1350 /* 1351 * Record the process identifier of our caller so that we can give 1352 * this process preferential treatment in request_cleanup below. 1353 */ 1354 matchcnt = 0; 1355 ump = VFSTOUFS(mp); 1356 ACQUIRE_LOCK(&lk); | 1346 struct ufsmount *ump; 1347 long starttime; 1348 1349 KASSERT(mp != NULL, ("softdep_process_worklist: NULL mp")); 1350 /* 1351 * Record the process identifier of our caller so that we can give 1352 * this process preferential treatment in request_cleanup below. 1353 */ 1354 matchcnt = 0; 1355 ump = VFSTOUFS(mp); 1356 ACQUIRE_LOCK(&lk); |
1357 loopcount = 1; | |
1358 starttime = time_second; 1359 softdep_process_journal(mp, full?MNT_WAIT:0); 1360 while (ump->softdep_on_worklist > 0) { 1361 if ((cnt = process_worklist_item(mp, LK_NOWAIT)) == -1) 1362 break; 1363 else 1364 matchcnt += cnt; 1365 /* --- 8 unchanged lines hidden (view full) --- 1374 clear_remove(td); 1375 req_clear_remove -= 1; 1376 wakeup_one(&proc_waiting); 1377 } 1378 /* 1379 * We do not generally want to stop for buffer space, but if 1380 * we are really being a buffer hog, we will stop and wait. 1381 */ | 1357 starttime = time_second; 1358 softdep_process_journal(mp, full?MNT_WAIT:0); 1359 while (ump->softdep_on_worklist > 0) { 1360 if ((cnt = process_worklist_item(mp, LK_NOWAIT)) == -1) 1361 break; 1362 else 1363 matchcnt += cnt; 1364 /* --- 8 unchanged lines hidden (view full) --- 1373 clear_remove(td); 1374 req_clear_remove -= 1; 1375 wakeup_one(&proc_waiting); 1376 } 1377 /* 1378 * We do not generally want to stop for buffer space, but if 1379 * we are really being a buffer hog, we will stop and wait. 1380 */ |
1382 if (loopcount++ % 128 == 0) { | 1381 if (should_yield()) { |
1383 FREE_LOCK(&lk); 1384 uio_yield(); 1385 bwillwrite(); 1386 ACQUIRE_LOCK(&lk); 1387 } 1388 /* 1389 * Never allow processing to run for more than one 1390 * second. Otherwise the other mountpoints may get --- 10249 unchanged lines hidden --- | 1382 FREE_LOCK(&lk); 1383 uio_yield(); 1384 bwillwrite(); 1385 ACQUIRE_LOCK(&lk); 1386 } 1387 /* 1388 * Never allow processing to run for more than one 1389 * second. Otherwise the other mountpoints may get --- 10249 unchanged lines hidden --- |