Commit 47279570 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] relax nr_to_write requirements

Relax the requirements on the writeback_mapping a_op.

This function is passed the number of pages which it should write.  The
current fs-writeback.c code will get confused if the address_space
writes back more pages than it was asked to.

With this change the address_space may write more pages than required
if that is convenient.  Extent-based fileystems may wish to do this.
parent 357f5a5e
...@@ -179,11 +179,12 @@ existing instances of this method ->sync_page() itself doesn't look ...@@ -179,11 +179,12 @@ existing instances of this method ->sync_page() itself doesn't look
well-defined... well-defined...
->writeback_mapping() is used for periodic writeback and for ->writeback_mapping() is used for periodic writeback and for
systemcall-initiated sync operations. The address_space should start systemcall-initiated sync operations. The address_space should start
I/O against at least *nr_to_write pages. *nr_to_write must be decremented I/O against at least *nr_to_write pages. *nr_to_write must be
for each page which is written. *nr_to_write must not go negative (this decremented for each page which is written. The address_space
will be relaxed later). If nr_to_write is NULL, all dirty pages must implementation may write more (or less) pages than *nr_to_write asks
be written. for, but it should try to be reasonably close. If nr_to_write is NULL,
all dirty pages must be written.
->vm_writeback() is called from the VM. The address_space should ->vm_writeback() is called from the VM. The address_space should
start I/O against at least *nr_to_write pages, including the passed page. As start I/O against at least *nr_to_write pages, including the passed page. As
......
...@@ -257,7 +257,7 @@ static void sync_sb_inodes(struct super_block *sb, int sync_mode, ...@@ -257,7 +257,7 @@ static void sync_sb_inodes(struct super_block *sb, int sync_mode,
if (current_is_pdflush()) if (current_is_pdflush())
writeback_release(bdi); writeback_release(bdi);
if (nr_to_write && *nr_to_write == 0) if (nr_to_write && *nr_to_write <= 0)
break; break;
} }
out: out:
...@@ -301,7 +301,7 @@ void writeback_unlocked_inodes(int *nr_to_write, int sync_mode, ...@@ -301,7 +301,7 @@ void writeback_unlocked_inodes(int *nr_to_write, int sync_mode,
older_than_this); older_than_this);
spin_lock(&sb_lock); spin_lock(&sb_lock);
} }
if (nr_to_write && *nr_to_write == 0) if (nr_to_write && *nr_to_write <= 0)
break; break;
} }
spin_unlock(&sb_lock); spin_unlock(&sb_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment