If filesystem block size is less than the page size, it is possible that the page-out run contains partially clean pages. E.g., the chunk of the page might be bdwrite()-ed, or some thread performed bwrite() on a buffer which references a chunk of the paged out page. As result, the assertion added in r319975, which checked that all pages in the run are dirty, does not hold on such filesystems.
One solution is to remove the assert. I do not like it, because we overwrite the valid on-disk content. I cannot provide a scenario where such write would corrupt the file data, but I do not like it on principle. Another, in my opinion proper, solution is to only write parts of the pages still marked dirty. The patch implements this, it skips clean blocks and only writes the dirty block runs.
Note that due to clustering, write one page might clean other pages in the run, so the next write range must be calculated only after the current range is written out.
More, due to a possible invalidation, and the fact that the object lock is dropped and reacquired before the checks, it is possible that the whole page-out pages run appears to consist of only clean pages. For this reason, it is impossible to assert that there is some work for the pageout method to do (i.e. I cannot assert that there is at least one dirty page in the run). But such clearing can only occur due to invalidation, and not due to a parallel write, because we own the vnode lock exclusive.
I did not decided on the following question yet: should the patch keep the existing vnode_generic_putpages() as is, and create special function vnode_smallfs_putpages(), which would be used when bsize < PAGE_SIZE only. The advantage is that less calculations are performed for the typical case of UFS with its fragments always >= PAGE_SIZE, the disadvantage is the signficant code duplication.