parent
5dbc3bcd61
commit
ee7b064667
|
@ -36,7 +36,10 @@ func Convert(r bazilfuse.Request, logger *log.Logger) (o Op) {
|
||||||
|
|
||||||
switch typed := r.(type) {
|
switch typed := r.(type) {
|
||||||
case *bazilfuse.InitRequest:
|
case *bazilfuse.InitRequest:
|
||||||
to := &InitOp{}
|
to := &InitOp{
|
||||||
|
maxReadahead: typed.MaxReadahead,
|
||||||
|
}
|
||||||
|
|
||||||
o = to
|
o = to
|
||||||
co = &to.commonOp
|
co = &to.commonOp
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ type Op interface {
|
||||||
// mount to succeed.
|
// mount to succeed.
|
||||||
type InitOp struct {
|
type InitOp struct {
|
||||||
commonOp
|
commonOp
|
||||||
|
|
||||||
|
maxReadahead uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *InitOp) Respond(err error) {
|
func (o *InitOp) Respond(err error) {
|
||||||
|
@ -58,7 +60,7 @@ func (o *InitOp) Respond(err error) {
|
||||||
|
|
||||||
resp := &bazilfuse.InitResponse{}
|
resp := &bazilfuse.InitResponse{}
|
||||||
|
|
||||||
// Unconditionally enable large WriteFile ops from the kernel on Linux.
|
// Ask the Linux kernel for larger write requests.
|
||||||
//
|
//
|
||||||
// As of 2015-03-26, the behavior in the kernel is:
|
// As of 2015-03-26, the behavior in the kernel is:
|
||||||
//
|
//
|
||||||
|
@ -77,6 +79,26 @@ func (o *InitOp) Respond(err error) {
|
||||||
resp.Flags |= bazilfuse.InitBigWrites
|
resp.Flags |= bazilfuse.InitBigWrites
|
||||||
resp.MaxWrite = maxWrite
|
resp.MaxWrite = maxWrite
|
||||||
|
|
||||||
|
// Ask the Linux kernel for larger read requests.
|
||||||
|
//
|
||||||
|
// As of 2015-03-26, the behavior in the kernel is:
|
||||||
|
//
|
||||||
|
// * (http://goo.gl/bQ1f1i, http://goo.gl/HwBrR6) Set the local variable
|
||||||
|
// ra_pages to be init_response->max_readahead divided by the page size.
|
||||||
|
//
|
||||||
|
// * (http://goo.gl/gcIsSh, http://goo.gl/LKV2vA) Set
|
||||||
|
// backing_dev_info::ra_pages to the min of that value and what was sent
|
||||||
|
// in the request's max_readahead field.
|
||||||
|
//
|
||||||
|
// * (http://goo.gl/u2SqzH) Use backing_dev_info::ra_pages when deciding
|
||||||
|
// how much to read ahead.
|
||||||
|
//
|
||||||
|
// * (http://goo.gl/JnhbdL) Don't read ahead at all if that field is zero.
|
||||||
|
//
|
||||||
|
// Reading a page at a time is a drag. Ask for as much as the kernel is
|
||||||
|
// willing to give us.
|
||||||
|
resp.MaxReadahead = o.maxReadahead
|
||||||
|
|
||||||
// Respond.
|
// Respond.
|
||||||
o.commonOp.logger.Printf("Responding: %v", &resp)
|
o.commonOp.logger.Printf("Responding: %v", &resp)
|
||||||
o.r.(*bazilfuse.InitRequest).Respond(resp)
|
o.r.(*bazilfuse.InitRequest).Respond(resp)
|
||||||
|
|
Loading…
Reference in New Issue