<br><br>
<div><span class="gmail_quote">On 12/22/05, <b class="gmail_sendername">Todd Poynor</b> <<a href="mailto:tpoynor@mvista.com">tpoynor@mvista.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Mikhail Ryleev wrote:<br><br>> It also fixes a problem with partially written data that actually should
<br>> return the amount of data written.<br><br>May be OK, most callers will simply treat as an error, but various other<br>commit_write implementations don't do this. What code expects a partial<br>count return?</blockquote>
<div> </div>
<div>For example it is called by generic_file_write routine which is an implementation of "write" call. </div>
<div>Since it is that generic, we have to be extremely careful what we return here. </div>
<div>As for partial count return, if we change the state of the file, advance file pointer or change the size of the file, </div>
<div>we have to let the caller know that that happened. An alternative would be to completely discard changes, </div>
<div>probably it is much better but far more complex. </div>
<div> </div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">> 2. device is out of space while creating new object. In this case<br>> current code returns ENOMEM error code which is also misleading.
<br>> Unfortunatly, I do not see a simple fix here, the structure of code is<br>> such that it is hard to diffirenciate out-of-memory vs. out-of-space<br>> situation here but I think ENOSPC would be better here because it is
<br>> more likely to happen.<br>><br>>...<br>> @@ -785,7 +784,7 @@<br>> }<br>> yaffs_GrossUnlock(dev);<br>><br>> - return nWritten != n ? -ENOSPC : nWritten;<br>> + return ( nWritten == n || nWritten > 0 ) ? nWritten : -ENOSPC;
<br><br>Can't match the code change to the description above, how was ENOMEM<br>returned before?</blockquote>
<div> </div>
<div>ENOMEM is returned by yaffs_mknod call in case it failed to create new object for whatever reason and not in that patch. </div>
<div>I do not have simple solution for that, other then replace it with ENOSPC which is arguably not much better. </div>
<div> </div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Is a check for nWritten < 0 (-ENOMEM) appropriate? Or else ( nWritten<br>== n || nWritten > 0 ) can simply be nWritten > 0 .
<br><br>--<br>Todd<br></blockquote></div><br>