On Sat, 2012-03-17 at 10:55 -0400, Fred Isaman wrote: > On Mar 16, 2012, at 5:22 PM, Trond Myklebust wrote: > > > > +static int > > +filelayout_scan_ds_commit_list(struct nfs4_fl_commit_bucket *bucket, int max) > > +{ > > + struct list_head *src = &bucket->written; > > + struct list_head *dst = &bucket->committing; > > + struct nfs_page *req, *tmp; > > + int ret = 0; > > + > > need something here like: > > if (max == 0) > return 0; I'll put that in the caller instead. > > + list_for_each_entry_safe(req, tmp, src, wb_list) { > > + if (!nfs_lock_request(req)) > > + continue; > > + nfs_request_remove_commit_list(req); > > + clear_bit(PG_COMMIT_TO_DS, &req->wb_flags); > > + nfs_list_add_request(req, dst); > > + ret++; > > + if (ret == max) > > + break; > > + } > > + return ret; > > +} > > + > > /* Move reqs from written to committing lists, returning count of number moved. > > * Note called with i_lock held. > > */ > > @@ -920,21 +967,16 @@ static int filelayout_scan_commit_lists(struct inode *inode, int max) > > > > lseg = find_only_write_lseg_locked(inode); > > if (!lseg) > > - return 0; > > + goto out_done; > > fl = FILELAYOUT_LSEG(lseg); > > if (fl->commit_through_mds) > > - goto out_put; > > + goto out_done; > > for (i = 0; i < fl->number_of_buckets; i++) { > > - if (list_empty(&fl->commit_buckets[i].written)) > > - continue; > > - cnt = nfs_scan_commit_list(&fl->commit_buckets[i].written, > > - &fl->commit_buckets[i].committing, > > - max); > > + cnt = filelayout_scan_ds_commit_list(&fl->commit_buckets[i], max); > > max -= cnt; > > rv += cnt; > > } > > -out_put: > > - put_lseg(lseg); > > +out_done: > > return rv; > > } > > /* i_lock held by caller */ > > -int > > +static int > > nfs_scan_commit_list(struct list_head *src, struct list_head *dst, int max) > > { > > struct nfs_page *req, *tmp; > > int ret = 0; > > > > again here need > > if (max == 0) > return 0; > Nah... This one is overdesign. We only have one caller, and it uses max=INT_MAX. If we ever get a second caller, then we can put a test in the new caller (if one is needed)... Cheers Trond -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@xxxxxxxxxx www.netapp.com ��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥