Re: Handle bad file descriptors with EBADF

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

 



On Sat, 3 Nov 2012, Noah Watkins wrote:
> The libcephfs interface asserts valid file descriptors, so clients are
> forced to manage this or risk crashes. Pushed to wip-bad-fd is changes
> that handle this case by returning -EBADF. Review welcome :)

This looks good to me.  The one thing I'd change before merging is to use 
an iterator and find() in the get_filehandle() helper.  Most existing code 
does something like

	if (container.count(key))
		return container[key];

but this is actually doing the lookup twice.  A better pattern:

	map<foo, bar>::iterator p = container.find(key);
	if (p == container.end())
		return NULL;
	return p->second;

Hopefully someday a motivated person with OCD will go through and convert 
existing code to do this.

	http://tracker.newdream.net/issues/432

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux