Rearranged the writer lock to do encode after releasing the lock.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
The lock in get_snapset_context is rearranged to hold for shorter
duration of time. No data against the performance improvement but it is
the right thing to do.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>