Re: [Fwd: [PATCH] consolidate generic_writepages and mpage_writepages]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> >Maybe cifs_writepages() too can use this infrastructure, but I'm not
> >touching that with a ten-foot pole.
> >  
> >
> The cifs case ought to be one of the simpler ones, pseudo-code is pretty 
> easy, the hard part is all of the stuff unrelated to cifs:
> Ideally if there were generic functions to help out, cifs writepages 
> would look roughly like the following
> 
> cifs_writepages(struct address_space *mapping, struct writeback_control 
> *wbc)
> {
>    
>     while (no more pages to write) {
>         /* find writeable file handle for this inode */
>         /* find the biggest set of contiguous pages that total less than 
> wsize */
>         if (packet signing is enabled)
>                 /* write lock pages so they can not be changed under us 
> while we are calculating the checksum */
>       
>        CIFSSMBWrite2(tree_connection, network_file_handle, array of 
> iovecs, number of iovecs);
> 
>         if(packet signing was enabled)
>                 /* unlock pages */
> 
>         if(error) {
>              set page errors
>              if (mounted "hard" )
>                    continue; /* retry */
>              else /* if no retry possible */
>                    return error to caller;
>        }
>         update bytes written statistics
>         update index to point to next set of pages
>     }  /* end while loop */
> }

write_cache_pages() now takes care of the 

     while (no more pages to write) {
     }

part.  All you have to do is to make the body of the loop into a
function and pass it a structure with the data you want to preserve
between invocations.

The hard part is untangling the breaks and continues.

Miklos
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux