FreeBSD/sys/fs/nfsclient/nfs_clstate.c
/*
 * Merge the new file layout list into the main one, maintaining it in
 * increasing offset order.
 */
Merge the new file layout list into the main one, maintaining it in
increasing offset order.
Merge the new file layout list into the main one maintaining it in increasing offset order .
static void
nfscl_mergeflayouts(struct nfsclflayouthead *fhlp,
    struct nfsclflayouthead *newfhlp)
{
	struct nfsclflayout *flp, *nflp, *prevflp, *tflp;
	flp = LIST_FIRST(fhlp);
	prevflp = NULL;
	LIST_FOREACH_SAFE(nflp, newfhlp, nfsfl_list, tflp) {
		while (flp != NULL && flp->nfsfl_off < nflp->nfsfl_off) {
			prevflp = flp;
			flp = LIST_NEXT(flp, nfsfl_list);
		}
		if (prevflp == NULL)
			LIST_INSERT_HEAD(fhlp, nflp, nfsfl_list);
		else
			LIST_INSERT_AFTER(prevflp, nflp, nfsfl_list);
		prevflp = nflp;
	}
}
static void nfscl_mergeflayouts ( struct nfsclflayouthead * fhlp , struct nfsclflayouthead * newfhlp ) { struct nfsclflayout * flp , * nflp , * prevflp , * tflp ; flp = LIST_FIRST ( fhlp ) ; prevflp = NULL ; LIST_FOREACH_SAFE ( nflp , newfhlp , nfsfl_list , tflp ) { while ( flp != NULL && flp -> nfsfl_off < nflp -> nfsfl_off ) { prevflp = flp ; flp = LIST_NEXT ( flp , nfsfl_list ) ; } if ( prevflp == NULL ) LIST_INSERT_HEAD ( fhlp , nflp , nfsfl_list ) ; else LIST_INSERT_AFTER ( prevflp , nflp , nfsfl_list ) ; prevflp = nflp ; } }
Merge the new file layout list into the main one, maintaining it in
 increasing offset order.
Merge the new file layout list into the main one maintaining it in increasing offset order .